Forráskód Böngészése

Client: SMB1FileStore, SMB2FileStore: Added Disconnect method

Tal Aloni 7 éve
szülő
commit
4e3e861d91
2 módosított fájl, 25 hozzáadás és 0 törlés
  1. 12 0
      SMBLibrary/Client/SMB1FileStore.cs
  2. 13 0
      SMBLibrary/Client/SMB2FileStore.cs

+ 12 - 0
SMBLibrary/Client/SMB1FileStore.cs

@@ -384,6 +384,18 @@ namespace SMBLibrary.Client
             return NTStatus.STATUS_INVALID_SMB;
         }
 
+        public NTStatus Disconnect()
+        {
+            TreeDisconnectRequest request = new TreeDisconnectRequest();
+            TrySendMessage(request);
+            SMB1Message reply = m_client.WaitForMessage(CommandName.SMB_COM_TREE_DISCONNECT);
+            if (reply != null)
+            {
+                return reply.Header.Status;
+            }
+            return NTStatus.STATUS_INVALID_SMB;
+        }
+
         private static ExtendedFileAttributes ToExtendedFileAttributes(FileAttributes fileAttributes)
         {
             // We only return flags that can be used with NtCreateFile

+ 13 - 0
SMBLibrary/Client/SMB2FileStore.cs

@@ -177,6 +177,19 @@ namespace SMBLibrary.Client
             return NTStatus.STATUS_INVALID_SMB;
         }
 
+        public NTStatus Disconnect()
+        {
+            TreeDisconnectRequest request = new TreeDisconnectRequest();
+            TrySendCommand(request);
+            SMB2Command response = m_client.WaitForCommand(SMB2CommandName.TreeDisconnect);
+            if (response != null)
+            {
+                return response.Header.Status;
+            }
+
+            return NTStatus.STATUS_INVALID_SMB;
+        }
+
         private void TrySendCommand(SMB2Command request)
         {
             request.Header.TreeID = m_treeID;