From 72c2d05402f031eab6cca4402cf06bdd1f4e32c0 Mon Sep 17 00:00:00 2001 From: Tal Aloni Date: Wed, 22 Feb 2017 20:45:29 +0200 Subject: [PATCH] SMB2: Improved CHANGE_NOTIFY request and response implementation --- .../SMB2/Commands/ChangeNotifyRequest.cs | 19 +++++++++++++++++++ .../SMB2/Commands/ChangeNotifyResponse.cs | 10 ++++++++++ 2 files changed, 29 insertions(+) diff --git a/SMBLibrary/SMB2/Commands/ChangeNotifyRequest.cs b/SMBLibrary/SMB2/Commands/ChangeNotifyRequest.cs index a385090..6b1b65b 100644 --- a/SMBLibrary/SMB2/Commands/ChangeNotifyRequest.cs +++ b/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 diff --git a/SMBLibrary/SMB2/Commands/ChangeNotifyResponse.cs b/SMBLibrary/SMB2/Commands/ChangeNotifyResponse.cs index 1923ca5..305b145 100644 --- a/SMBLibrary/SMB2/Commands/ChangeNotifyResponse.cs +++ b/SMBLibrary/SMB2/Commands/ChangeNotifyResponse.cs @@ -51,6 +51,16 @@ namespace SMBLibrary.SMB2 ByteWriter.WriteBytes(buffer, offset + FixedSize, OutputBuffer); } + public List GetFileNotifyInformation() + { + return FileNotifyInformation.ReadList(OutputBuffer, 0); + } + + public void SetFileNotifyInformation(List notifyInformationList) + { + OutputBuffer = FileNotifyInformation.GetBytes(notifyInformationList); + } + public override int CommandLength { get