예제 #1
0
 public FlushRequest(byte[] buffer, int offset) : base(buffer, offset)
 {
     StructureSize = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 0);
     Reserved1     = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 2);
     Reserved2     = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 4);
     FileId        = new FileID(buffer, offset + SMB2Header.Length + 8);
 }
예제 #2
0
 public ChangeNotifyRequest(byte[] buffer, int offset) : base(buffer, offset)
 {
     StructureSize      = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 0);
     Flags              = (ChangeNotifyFlags)LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 2);
     OutputBufferLength = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 4);
     FileId             = new FileID(buffer, offset + SMB2Header.Length + 8);
     CompletionFilter   = (NotifyChangeFilter)LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 24);
     Reserved           = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 28);
 }
예제 #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);
        }
예제 #4
0
 public SetInfoRequest(byte[] buffer, int offset) : base(buffer, offset)
 {
     StructureSize         = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 0);
     InfoType              = (InfoType)ByteReader.ReadByte(buffer, offset + SMB2Header.Length + 2);
     FileInfoClass         = ByteReader.ReadByte(buffer, offset + SMB2Header.Length + 3);
     BufferLength          = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 4);
     BufferOffset          = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 8);
     Reserved              = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 10);
     AdditionalInformation = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 12);
     FileId = new FileID(buffer, offset + SMB2Header.Length + 16);
     Buffer = ByteReader.ReadBytes(buffer, offset + BufferOffset, (int)BufferLength);
 }
예제 #5
0
 public QueryDirectoryRequest(byte[] buffer, int offset) : base(buffer, offset)
 {
     StructureSize        = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 0);
     FileInformationClass = (FileInformationClass)ByteReader.ReadByte(buffer, offset + SMB2Header.Length + 2);
     Flags              = (QueryDirectoryFlags)ByteReader.ReadByte(buffer, offset + SMB2Header.Length + 3);
     FileIndex          = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 4);
     FileId             = new FileID(buffer, offset + SMB2Header.Length + 8);
     FileNameOffset     = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 24);
     FileNameLength     = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 26);
     OutputBufferLength = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 28);
     FileName           = ByteReader.ReadUTF16String(buffer, offset + FileNameOffset, FileNameLength / 2);
 }
예제 #6
0
 public IOCtlResponse(byte[] buffer, int offset) : base(buffer, offset)
 {
     StructureSize = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 0);
     Reserved      = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 2);
     CtlCode       = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 4);
     FileId        = new FileID(buffer, offset + SMB2Header.Length + 8);
     InputOffset   = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 24);
     InputCount    = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 28);
     OutputOffset  = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 32);
     OutputCount   = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 36);
     Flags         = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 40);
     Reserved2     = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 44);
     Input         = ByteReader.ReadBytes(buffer, offset + (int)InputOffset, (int)InputCount);
     Output        = ByteReader.ReadBytes(buffer, offset + (int)OutputOffset, (int)OutputCount);
 }
예제 #7
0
 public WriteRequest(byte[] buffer, int offset) : base(buffer, offset)
 {
     StructureSize          = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 0);
     DataOffset             = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 2);
     DataLength             = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 4);
     Offset                 = LittleEndianConverter.ToUInt64(buffer, offset + SMB2Header.Length + 8);
     FileId                 = new FileID(buffer, offset + SMB2Header.Length + 16);
     Channel                = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 32);
     RemainingBytes         = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 36);
     WriteChannelInfoOffset = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 40);
     WriteChannelInfoLength = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 42);
     Flags            = (WriteFlags)LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 44);
     Data             = ByteReader.ReadBytes(buffer, offset + DataOffset, (int)DataLength);
     WriteChannelInfo = ByteReader.ReadBytes(buffer, offset + WriteChannelInfoOffset, WriteChannelInfoLength);
 }
예제 #8
0
 public ReadRequest(byte[] buffer, int offset) : base(buffer, offset)
 {
     StructureSize         = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 0);
     Padding               = ByteReader.ReadByte(buffer, offset + SMB2Header.Length + 2);
     Flags                 = (ReadFlags)ByteReader.ReadByte(buffer, offset + SMB2Header.Length + 3);
     ReadLength            = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 4);
     Offset                = LittleEndianConverter.ToUInt64(buffer, offset + SMB2Header.Length + 8);
     FileId                = new FileID(buffer, offset + SMB2Header.Length + 16);
     MinimumCount          = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 32);
     Channel               = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 36);
     RemainingBytes        = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 40);
     ReadChannelInfoOffset = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 44);
     ReadChannelInfoLength = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 46);
     if (ReadChannelInfoLength > 0)
     {
         ReadChannelInfo = ByteReader.ReadBytes(buffer, offset + ReadChannelInfoOffset, ReadChannelInfoLength);
     }
 }
예제 #9
0
 public CreateResponse(byte[] buffer, int offset) : base(buffer, offset)
 {
     StructureSize         = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 0);
     OplockLevel           = (OplockLevel)ByteReader.ReadByte(buffer, offset + SMB2Header.Length + 2);
     Flags                 = (CreateResponseFlags)ByteReader.ReadByte(buffer, offset + SMB2Header.Length + 3);
     CreateAction          = (CreateAction)LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 4);
     CreationTime          = FileTimeHelper.ReadNullableFileTime(buffer, offset + SMB2Header.Length + 8);
     LastAccessTime        = FileTimeHelper.ReadNullableFileTime(buffer, offset + SMB2Header.Length + 16);
     LastWriteTime         = FileTimeHelper.ReadNullableFileTime(buffer, offset + SMB2Header.Length + 24);
     ChangeTime            = FileTimeHelper.ReadNullableFileTime(buffer, offset + SMB2Header.Length + 32);
     AllocationSize        = LittleEndianConverter.ToInt64(buffer, offset + SMB2Header.Length + 40);
     EndofFile             = LittleEndianConverter.ToInt64(buffer, offset + SMB2Header.Length + 48);
     FileAttributes        = (FileAttributes)LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 56);
     Reserved2             = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 60);
     FileId                = new FileID(buffer, offset + SMB2Header.Length + 64);
     CreateContextsOffsets = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 80);
     CreateContextsLength  = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 84);
     if (CreateContextsLength > 0)
     {
         CreateContexts = CreateContext.ReadCreateContextList(buffer, offset + (int)CreateContextsOffsets);
     }
 }