smb_fscc/notify.rs
1use smb_dtyp::binrw_util::prelude::*;
2
3/// FILE_NOTIFY_INFORMATION - [MS-FSCC 2.7.1](<https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/634043d7-7b39-47e9-9e26-bda64685e4c9>)
4///
5/// This structure is similar to the references struct, excluding the NextEntryOffset field. Use [`ChainedItemList<FileNotifyInformation>`] to represent a list of these structures.
6#[binrw::binrw]
7#[derive(Debug, PartialEq, Eq)]
8#[bw(import(has_next: bool))]
9pub struct FileNotifyInformation {
10 pub action: NotifyAction,
11 #[bw(try_calc = file_name.size().try_into())]
12 file_name_length: u32,
13 #[br(args(file_name_length.into()))]
14 pub file_name: SizedWideString,
15}
16
17/// See [`FileNotifyInformation`]
18#[binrw::binrw]
19#[derive(Debug, PartialEq, Eq)]
20#[brw(repr(u32))]
21pub enum NotifyAction {
22 /// The file was renamed, and FileName contains the new name.
23 /// This notification is only sent when the rename operation changes the directory the file resides in.
24 /// The client will also receive a FILE_ACTION_REMOVED notification.
25 /// This notification will not be received if the file is renamed within a directory.
26 Added = 0x1,
27
28 /// The file was renamed, and FileName contains the old name.
29 /// This notification is only sent when the rename operation changes the directory the file resides in.
30 /// The client will also receive a FILE_ACTION_ADDED notification.
31 /// This notification will not be received if the file is renamed within a directory.
32 Removed = 0x2,
33
34 /// The file was modified. This can be a change to the data or attributes of the file.
35 Modified = 0x3,
36
37 /// The file was renamed, and FileName contains the old name.
38 /// This notification is only sent when the rename operation does not change the directory the file resides in.
39 /// The client will also receive a FILE_ACTION_RENAMED_NEW_NAME notification. This notification will not be received if the file is renamed to a different directory.
40 RenamedOldName = 0x4,
41
42 /// The file was renamed, and FileName contains the new name.
43 /// This notification is only sent when the rename operation does not change the directory the file resides in.
44 /// The client will also receive a FILE_ACTION_RENAMED_OLD_NAME notification. This notification will not be received if the file is renamed to a different directory.
45 RenamedNewName = 0x5,
46
47 /// The file was added to a named stream.
48 AddedStream = 0x6,
49
50 /// The file was removed from the named stream.
51 RemovedStream = 0x7,
52
53 /// The file was modified. This can be a change to the data or attributes of the file.
54 ModifiedStream = 0x8,
55
56 /// An object ID was removed because the file the object ID referred to was deleted.
57 ///
58 /// This notification is only sent when the directory being monitored is the special directory "\$Extend\$ObjId:$O:$INDEX_ALLOCATION".
59 RemovedByDelete = 0x9,
60
61 /// An attempt to tunnel object ID information to a file being created or renamed failed because the object ID is in use by another file on the same volume.
62 ///
63 /// This notification is only sent when the directory being monitored is the special directory "\$Extend\$ObjId:$O:$INDEX_ALLOCATION".
64 IdNotTunnelled = 0xa,
65
66 /// An attempt to tunnel object ID information to a file being renamed failed because the file already has an object ID.
67 ///
68 /// This notification is only sent when the directory being monitored is the special directory "\$Extend\$ObjId:$O:$INDEX_ALLOCATION".
69 TunnelledIdCollision = 0xb,
70}