mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-23 17:55:55 +02:00
SMB2: Improved LockRequest implementation
This commit is contained in:
parent
4e4a416fd5
commit
f96e6fe404
1 changed files with 4 additions and 4 deletions
|
@ -18,7 +18,7 @@ namespace SMBLibrary.SMB2
|
|||
public const int DeclaredSize = 48;
|
||||
|
||||
private ushort StructureSize;
|
||||
public ushort LockCount;
|
||||
// ushort LockCount;
|
||||
public byte LSN; // 4 bits
|
||||
public uint LockSequenceIndex; // 28 bits
|
||||
public FileID FileId;
|
||||
|
@ -32,18 +32,18 @@ namespace SMBLibrary.SMB2
|
|||
public LockRequest(byte[] buffer, int offset) : base(buffer, offset)
|
||||
{
|
||||
StructureSize = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 0);
|
||||
LockCount = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 2);
|
||||
ushort lockCount = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 2);
|
||||
uint temp = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 4);
|
||||
LSN = (byte)(temp >> 28);
|
||||
LockSequenceIndex = (temp & 0x0FFFFFFF);
|
||||
FileId = new FileID(buffer, offset + SMB2Header.Length + 8);
|
||||
Locks = LockElement.ReadLockList(buffer, offset + SMB2Header.Length + 24, (int)LockCount);
|
||||
Locks = LockElement.ReadLockList(buffer, offset + SMB2Header.Length + 24, (int)lockCount);
|
||||
}
|
||||
|
||||
public override void WriteCommandBytes(byte[] buffer, int offset)
|
||||
{
|
||||
LittleEndianWriter.WriteUInt16(buffer, offset + 0, StructureSize);
|
||||
LittleEndianWriter.WriteUInt16(buffer, offset + 2, LockCount);
|
||||
LittleEndianWriter.WriteUInt16(buffer, offset + 2, (ushort)Locks.Count);
|
||||
LittleEndianWriter.WriteUInt32(buffer, offset + 4, (uint)(LSN & 0x0F) << 28 | (uint)(LockSequenceIndex & 0x0FFFFFFF));
|
||||
FileId.WriteBytes(buffer, offset + 8);
|
||||
LockElement.WriteLockList(buffer, offset + 24, Locks);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue