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#[bitfield]
14#[derive(BinWrite, BinRead, Debug, Default, Clone, Copy, PartialEq, Eq)]
15#[bw(map = |&x| Self::into_bytes(x))]
16#[br(map = Self::from_bytes)]
17pub struct FileAttributes {
18    /// A file or directory that is read-only.
19    /// For a file, applications can read the file but cannot write to it or delete it.
20    /// For a directory, applications cannot delete it,
21    /// but applications can create and delete files from that directory.
22    pub readonly: bool,
23    /// A file or directory that is hidden.
24    /// Files and directories marked with this attribute do not appear in an ordinary directory listing.
25    pub hidden: bool,
26    /// A file or directory that the operating system uses a part of or uses exclusively.
27    pub system: bool,
28    #[skip]
29    __: bool,
30
31    /// This item is a directory.
32    pub directory: bool,
33    /// A file or directory that requires to be archived.
34    /// Applications use this attribute to mark files for backup or removal.
35    pub archive: bool,
36    #[skip]
37    __: bool,
38    /// A file that does not have other attributes set.
39    /// This flag is used to clear all other flags by specifying it with no other flags set.
40    /// This flag MUST be ignored if other flags are set.
41    pub normal: bool,
42
43    /// A file that is being used for temporary storage.
44    /// The operating system can choose to store this file's data in memory rather than on mass storage,
45    /// writing the data to mass storage only if data remains in the file when the file is closed.
46    pub temporary: bool,
47    /// A file that is a sparse file.
48    pub sparse_file: bool,
49    /// A file or directory that has an associated reparse point.
50    pub reparse_point: bool,
51    /// A file or directory that is compressed. For a file, all of the data in the file is compressed.
52    /// For a directory, compression is the default for newly created files and subdirectories.
53    pub compressed: bool,
54
55    /// The data in this file is not available immediately.
56    /// This attribute indicates that the file data is physically moved to offline storage.
57    /// This attribute is used by Remote Storage, which is hierarchical storage management software.
58    pub offline: bool,
59    /// A file or directory that is not indexed by the content indexing service.
60    pub not_content_indexed: bool,
61    /// A file or directory that is encrypted.
62    /// For a file, all data streams in the file are encrypted.
63    /// For a directory, encryption is the default for newly created files and subdirectories.
64    pub encrypted: bool,
65    /// A file or directory that is configured with integrity support.
66    /// For a file, all data streams in the file have integrity support.
67    /// For a directory, integrity support is the default for newly created files and subdirectories, unless the caller specifies otherwise.
68    pub integrity_stream: bool,
69
70    #[skip]
71    __: bool,
72    /// A file or directory that is configured to be excluded from the data integrity scan.
73    /// For a directory configured with FILE_ATTRIBUTE_NO_SCRUB_DATA,
74    /// the default for newly created files and subdirectories is to inherit the FILE_ATTRIBUTE_NO_SCRUB_DATA attribute.
75    pub no_scrub_data: bool,
76    /// This attribute appears only in directory enumeration classes.
77    /// When this attribute is set, it means that the file or directory has no physical representation on the local system; the item is virtual.
78    /// 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.
79    /// This attribute can only be set by kernel-mode components. This attribute is for use with hierarchical storage management software.
80    pub recall_on_open: bool,
81    /// This attribute indicates user intent that the file or directory should be kept fully present locally even when not being actively accessed.
82    /// This attribute is for use with hierarchical storage management software.
83    pub pinned: bool,
84
85    /// This attribute indicates that the file or directory should not be kept fully present locally except when being actively accessed.
86    /// This attribute is for use with hierarchical storage management software.
87    pub unpinned: bool,
88    #[skip]
89    __: bool,
90    /// When this attribute is set, it means that the file or directory is not fully present locally.
91    /// 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).
92    /// For a directory it means that some of the directory contents are being virtualized from another location.
93    /// 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.
94    /// Only kernel-mode callers can set this attribute. This attribute is for use with hierarchical storage management software.
95    pub recall_on_data_access: bool,
96    #[skip]
97    __: B9,
98}