Example #1
0
 public override void WriteCommandBytes(byte[] buffer, int offset)
 {
     LittleEndianWriter.WriteUInt16(buffer, offset + 0, StructureSize);
     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);
 }
Example #2
0
 public static void WriteLockList(byte[] buffer, int offset, List <LockElement> locks)
 {
     for (int lockIndex = 0; lockIndex < locks.Count; lockIndex++)
     {
         LockElement element = locks[lockIndex];
         element.WriteBytes(buffer, offset + lockIndex * StructureLength);
     }
 }
Example #3
0
        public LockRequest(byte[] buffer, int offset) : base(buffer, offset)
        {
            StructureSize = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 0);
            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);
        }
Example #4
0
        public static List <LockElement> ReadLockList(byte[] buffer, int offset, int lockCount)
        {
            List <LockElement> result = new List <LockElement>();

            for (int lockIndex = 0; lockIndex < lockCount; lockIndex++)
            {
                LockElement element = new LockElement(buffer, offset + lockIndex * StructureLength);
                result.Add(element);
            }
            return(result);
        }