ISMBClient: Added MaxReadSize and MaxWriteSize properties

This commit is contained in:
Tal Aloni 2017-10-07 12:38:48 +03:00
parent 78aa93276a
commit 8a7d144483
2 changed files with 31 additions and 0 deletions

View file

@ -25,5 +25,15 @@ namespace SMBLibrary.Client
List<string> ListShares(out NTStatus status);
ISMBFileStore TreeConnect(string shareName, out NTStatus status);
uint MaxReadSize
{
get;
}
uint MaxWriteSize
{
get;
}
}
}

View file

@ -567,6 +567,27 @@ namespace SMBLibrary.Client
}
}
public uint MaxReadSize
{
get
{
return ClientMaxBufferSize - (SMB1Header.Length + 3 + ReadAndXResponse.ParametersLength);
}
}
public uint MaxWriteSize
{
get
{
uint result = ServerMaxBufferSize - (SMB1Header.Length + 3 + WriteAndXRequest.ParametersFixedLength + 4);
if (m_unicode)
{
result--;
}
return result;
}
}
public static void TrySendMessage(Socket socket, SMB1Message message)
{
SessionMessagePacket packet = new SessionMessagePacket();