Implement Flush for SMB2 (#93)

Co-authored-by: Nich Overend <nich@opusinvestors.com>
This commit is contained in:
Nich Overend 2021-07-22 16:43:00 +01:00 committed by GitHub
parent 4456bc75c5
commit a0bb742dc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -117,7 +117,20 @@ namespace SMBLibrary.Client
public NTStatus FlushFileBuffers(object handle)
{
throw new NotImplementedException();
FlushRequest request = new FlushRequest();
request.FileId = (FileID) handle;
TrySendCommand(request);
SMB2Command response = m_client.WaitForCommand(request.MessageID);
if (response != null)
{
if (response.Header.Status == NTStatus.STATUS_SUCCESS && response is FlushResponse)
{
return response.Header.Status;
}
}
return NTStatus.STATUS_INVALID_SMB;
}
public NTStatus LockFile(object handle, long byteOffset, long length, bool exclusiveLock)