smb_fscc/
file_attributes.rs

1//! File attributes definition.
2//!
3//! [MS-FSCC 2.6](<https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/ca28ec38-f155-4768-81d6-4bfeb8586fc9>)
4
5use binrw::prelude::*;
6use modular_bitfield::prelude::*;
7
8/// Attributes of a file or directory.
9///
10/// They can be used in any combination unless noted in the description of the attribute's meaning
11///
12/// [MS-FSCC 2.6](<https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/ca28ec38-f155-4768-81d6-4bfeb8586fc9>)
13#[smb_dtyp::mbitfield]
14pub struct FileAttributes {
15    /// A file or directory that is read-only.
16    /// For a file, applications can read the file but cannot write to it or delete it.
17    /// For a directory, applications cannot delete it,
18    /// but applications can create and delete files from that directory.
19    pub readonly: bool,
20    /// A file or directory that is hidden.
21    /// Files and directories marked with this attribute do not appear in an ordinary directory listing.
22    pub hidden: bool,
23    /// A file or directory that the operating system uses a part of or uses exclusively.
24    pub system: bool,
25    #[skip]
26    __: bool,
27
28    /// This item is a directory.
29    pub directory: bool,
30    /// A file or directory that requires to be archived.
31    /// Applications use this attribute to mark files for backup or removal.
32    pub archive: bool,
33    #[skip]
34    __: bool,
35    /// A file that does not have other attributes set.
36    /// This flag is used to clear all other flags by specifying it with no other flags set.
37    /// This flag MUST be ignored if other flags are set.
38    pub normal: bool,
39
40    /// A file that is being used for temporary storage.
41    /// The operating system can choose to store this file's data in memory rather than on mass storage,
42    /// writing the data to mass storage only if data remains in the file when the file is closed.
43    pub temporary: bool,
44    /// A file that is a sparse file.
45    pub sparse_file: bool,
46    /// A file or directory that has an associated reparse point.
47    pub reparse_point: bool,
48    /// A file or directory that is compressed. For a file, all of the data in the file is compressed.
49    /// For a directory, compression is the default for newly created files and subdirectories.
50    pub compressed: bool,
51
52    /// The data in this file is not available immediately.
53    /// This attribute indicates that the file data is physically moved to offline storage.
54    /// This attribute is used by Remote Storage, which is hierarchical storage management software.
55    pub offline: bool,
56    /// A file or directory that is not indexed by the content indexing service.
57    pub not_content_indexed: bool,
58    /// A file or directory that is encrypted.
59    /// For a file, all data streams in the file are encrypted.
60    /// For a directory, encryption is the default for newly created files and subdirectories.
61    pub encrypted: bool,
62    /// A file or directory that is configured with integrity support.
63    /// For a file, all data streams in the file have integrity support.
64    /// For a directory, integrity support is the default for newly created files and subdirectories, unless the caller specifies otherwise.
65    pub integrity_stream: bool,
66
67    #[skip]
68    __: bool,
69    /// A file or directory that is configured to be excluded from the data integrity scan.
70    /// For a directory configured with FILE_ATTRIBUTE_NO_SCRUB_DATA,
71    /// the default for newly created files and subdirectories is to inherit the FILE_ATTRIBUTE_NO_SCRUB_DATA attribute.
72    pub no_scrub_data: bool,
73    /// This attribute appears only in directory enumeration classes.
74    /// When this attribute is set, it means that the file or directory has no physical representation on the local system; the item is virtual.
75    /// Opening the item will be more expensive than usual because it will cause at least some of the file or directory content to be fetched from a remote store.
76    /// This attribute can only be set by kernel-mode components. This attribute is for use with hierarchical storage management software.
77    pub recall_on_open: bool,
78    /// This attribute indicates user intent that the file or directory should be kept fully present locally even when not being actively accessed.
79    /// This attribute is for use with hierarchical storage management software.
80    pub pinned: bool,
81
82    /// This attribute indicates that the file or directory should not be kept fully present locally except when being actively accessed.
83    /// This attribute is for use with hierarchical storage management software.
84    pub unpinned: bool,
85    #[skip]
86    __: bool,
87    /// When this attribute is set, it means that the file or directory is not fully present locally.
88    /// For a file this means that not all of its data is on local storage (for example, it may be sparse with some data still in remote storage).
89    /// For a directory it means that some of the directory contents are being virtualized from another location.
90    /// Reading the file or enumerating the directory will be more expensive than usual because it will cause at least some of the file or directory content to be fetched from a remote store.
91    /// Only kernel-mode callers can set this attribute. This attribute is for use with hierarchical storage management software.
92    pub recall_on_data_access: bool,
93    #[skip]
94    __: B9,
95}