Bugfixes and improvements to the WriteBytes methods of several SMB1 structures

This commit is contained in:
Tal Aloni 2017-12-08 14:21:27 +02:00
parent 387b3b6709
commit 84a771641e
3 changed files with 17 additions and 5 deletions

View file

@ -26,14 +26,14 @@ namespace SMBLibrary.SMB1
public void WriteBytes(byte[] buffer, int offset)
{
buffer[0] = (byte)OpenResult;
buffer[offset + 0] = (byte)OpenResult;
if (OpLockGranted)
{
buffer[1] = 0x80;
buffer[offset + 1] = 0x80;
}
else
{
buffer[1] = 0x00;
buffer[offset + 1] = 0x00;
}
}

View file

@ -82,6 +82,12 @@ namespace SMBLibrary.SMB1
buffer[offset + 1] |= (byte)(((byte)WriteThroughMode << 6) & 0x40);
}
public void WriteBytes(byte[] buffer, ref int offset)
{
WriteBytes(buffer, offset);
offset += Length;
}
public static AccessModeOptions Read(byte[] buffer, ref int offset)
{
offset += Length;

View file

@ -38,8 +38,14 @@ namespace SMBLibrary.SMB1
public void WriteBytes(byte[] buffer, int offset)
{
buffer[0] = (byte)FileExistsOpts;
buffer[0] |= (byte)((byte)CreateFile << 4);
buffer[offset + 0] = (byte)FileExistsOpts;
buffer[offset + 0] |= (byte)((byte)CreateFile << 4);
}
public void WriteBytes(byte[] buffer, ref int offset)
{
WriteBytes(buffer, offset);
offset += Length;
}
public static OpenMode Read(byte[] buffer, ref int offset)