Browse Source

SMB2: Improved CHANGE_NOTIFY request and response implementation

Tal Aloni 8 years ago
parent
commit
72c2d05402

+ 19 - 0
SMBLibrary/SMB2/Commands/ChangeNotifyRequest.cs

@@ -49,6 +49,25 @@ namespace SMBLibrary.SMB2
             LittleEndianWriter.WriteUInt32(buffer, offset + 28, Reserved);
         }
 
+        public bool WatchTree
+        {
+            get
+            {
+                return ((Flags & ChangeNotifyFlags.WatchTree) > 0);
+            }
+            set
+            {
+                if (value)
+                {
+                    Flags |= ChangeNotifyFlags.WatchTree;
+                }
+                else
+                {
+                    Flags &= ~ChangeNotifyFlags.WatchTree;
+                }
+            }
+        }
+
         public override int CommandLength
         {
             get

+ 10 - 0
SMBLibrary/SMB2/Commands/ChangeNotifyResponse.cs

@@ -51,6 +51,16 @@ namespace SMBLibrary.SMB2
             ByteWriter.WriteBytes(buffer, offset + FixedSize, OutputBuffer);
         }
 
+        public List<FileNotifyInformation> GetFileNotifyInformation()
+        {
+            return FileNotifyInformation.ReadList(OutputBuffer, 0);
+        }
+
+        public void SetFileNotifyInformation(List<FileNotifyInformation> notifyInformationList)
+        {
+            OutputBuffer = FileNotifyInformation.GetBytes(notifyInformationList);
+        }
+
         public override int CommandLength
         {
             get