Client: SMB1FileStore, SMB2FileStore: Added Disconnect method

This commit is contained in:
Tal Aloni 2017-09-22 12:49:20 +03:00
parent d15db358cb
commit 4e3e861d91
2 changed files with 25 additions and 0 deletions

View file

@ -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

View file

@ -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;