mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-26 10:48:15 +02:00
Client: SMB1FileStore, SMB2FileStore: Added Disconnect method
This commit is contained in:
parent
d15db358cb
commit
4e3e861d91
2 changed files with 25 additions and 0 deletions
|
@ -384,6 +384,18 @@ namespace SMBLibrary.Client
|
||||||
return NTStatus.STATUS_INVALID_SMB;
|
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)
|
private static ExtendedFileAttributes ToExtendedFileAttributes(FileAttributes fileAttributes)
|
||||||
{
|
{
|
||||||
// We only return flags that can be used with NtCreateFile
|
// We only return flags that can be used with NtCreateFile
|
||||||
|
|
|
@ -177,6 +177,19 @@ namespace SMBLibrary.Client
|
||||||
return NTStatus.STATUS_INVALID_SMB;
|
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)
|
private void TrySendCommand(SMB2Command request)
|
||||||
{
|
{
|
||||||
request.Header.TreeID = m_treeID;
|
request.Header.TreeID = m_treeID;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue