public static LockingRange Read32(byte[] buffer, ref int offset)
        {
            LockingRange entry = new LockingRange();

            entry.PID           = LittleEndianReader.ReadUInt16(buffer, ref offset);
            entry.ByteOffset    = LittleEndianReader.ReadUInt32(buffer, ref offset);
            entry.LengthInBytes = LittleEndianReader.ReadUInt32(buffer, ref offset);
            return(entry);
        }
Пример #2
0
        public static LockingRange Read64(byte[] buffer, ref int offset)
        {
            LockingRange entry = new LockingRange
            {
                PID = LittleEndianReader.ReadUInt16(buffer, ref offset)
            };

            offset             += 2; // padding
            entry.ByteOffset    = LittleEndianReader.ReadUInt64(buffer, ref offset);
            entry.LengthInBytes = LittleEndianReader.ReadUInt64(buffer, ref offset);
            return(entry);
        }
        public LockingAndXRequest(byte[] buffer, int offset) : base(buffer, offset, false)
        {
            FID            = LittleEndianConverter.ToUInt16(this.SMBParameters, 4);
            TypeOfLock     = (LockType)ByteReader.ReadByte(this.SMBParameters, 6);
            NewOpLockLevel = ByteReader.ReadByte(this.SMBParameters, 7);
            Timeout        = LittleEndianConverter.ToUInt32(this.SMBParameters, 8);
            ushort numberOfRequestedUnlocks = LittleEndianConverter.ToUInt16(this.SMBParameters, 12);
            ushort numberOfRequestedLocks   = LittleEndianConverter.ToUInt16(this.SMBParameters, 14);

            int dataOffset = 0;

            if ((TypeOfLock & LockType.LARGE_FILES) > 0)
            {
                for (int index = 0; index < numberOfRequestedUnlocks; index++)
                {
                    LockingRange entry = LockingRange.Read64(this.SMBData, ref dataOffset);
                    Unlocks.Add(entry);
                }

                for (int index = 0; index < numberOfRequestedLocks; index++)
                {
                    LockingRange entry = LockingRange.Read64(this.SMBData, ref dataOffset);
                    Locks.Add(entry);
                }
            }
            else
            {
                for (int index = 0; index < numberOfRequestedUnlocks; index++)
                {
                    LockingRange entry = LockingRange.Read32(this.SMBData, ref dataOffset);
                    Unlocks.Add(entry);
                }

                for (int index = 0; index < numberOfRequestedLocks; index++)
                {
                    LockingRange entry = LockingRange.Read32(this.SMBData, ref dataOffset);
                    Locks.Add(entry);
                }
            }
        }