Пример #1
0
 public QueryFSVolumeInfo(byte[] buffer, int offset)
 {
     VolumeCreationTime = FileTimeHelper.ReadNullableFileTime(buffer, offset + 0);
     SerialNumber       = LittleEndianConverter.ToUInt32(buffer, offset + 8);
     VolumeLabelSize    = LittleEndianConverter.ToUInt32(buffer, offset + 12);
     Reserved           = LittleEndianConverter.ToUInt16(buffer, offset + 16);
     VolumeLabel        = ByteReader.ReadUTF16String(buffer, offset + 18, (int)VolumeLabelSize);
 }
Пример #2
0
 public SetFileBasicInfo(byte[] buffer, int offset)
 {
     CreationTime      = FileTimeHelper.ReadNullableFileTime(buffer, offset + 0);
     LastAccessTime    = FileTimeHelper.ReadNullableFileTime(buffer, offset + 8);
     LastWriteTime     = FileTimeHelper.ReadNullableFileTime(buffer, offset + 16);
     LastChangeTime    = FileTimeHelper.ReadNullableFileTime(buffer, offset + 24);
     ExtFileAttributes = (ExtendedFileAttributes)LittleEndianConverter.ToUInt32(buffer, offset + 32);
     Reserved          = LittleEndianConverter.ToUInt32(buffer, offset + 36);
 }
Пример #3
0
 public QueryFileBasicInfo(byte[] buffer, int offset)
 {
     CreationTime      = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
     LastAccessTime    = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
     LastWriteTime     = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
     LastChangeTime    = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
     ExtFileAttributes = (ExtendedFileAttributes)LittleEndianReader.ReadUInt32(buffer, ref offset);
     Reserved          = LittleEndianReader.ReadUInt32(buffer, ref offset);
 }
Пример #4
0
 public CloseResponse(byte[] buffer, int offset) : base(buffer, offset)
 {
     StructureSize  = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 0);
     Flags          = (CloseFlags)LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 2);
     Reserved       = 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);
 }
Пример #5
0
        public FindFileDirectoryInfo(byte[] buffer, int offset, bool isUnicode) : base()
        {
            NextEntryOffset    = LittleEndianReader.ReadUInt32(buffer, ref offset);
            FileIndex          = LittleEndianReader.ReadUInt32(buffer, ref offset);
            CreationTime       = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
            LastAccessTime     = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
            LastWriteTime      = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
            LastAttrChangeTime = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
            EndOfFile          = LittleEndianReader.ReadInt64(buffer, ref offset);
            AllocationSize     = LittleEndianReader.ReadInt64(buffer, ref offset);
            ExtFileAttributes  = (ExtendedFileAttributes)LittleEndianReader.ReadUInt32(buffer, ref offset);
            uint fileNameLength = LittleEndianReader.ReadUInt32(buffer, ref offset);

            FileName = SMB1Helper.ReadFixedLengthString(buffer, ref offset, isUnicode, (int)fileNameLength);
        }
Пример #6
0
        public QueryFileAllInfo(byte[] buffer, int offset)
        {
            CreationTime      = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
            LastAccessTime    = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
            LastWriteTime     = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
            LastChangeTime    = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
            ExtFileAttributes = (ExtendedFileAttributes)LittleEndianReader.ReadUInt32(buffer, ref offset);
            Reserved1         = LittleEndianReader.ReadUInt32(buffer, ref offset);
            AllocationSize    = LittleEndianReader.ReadInt64(buffer, ref offset);
            EndOfFile         = LittleEndianReader.ReadInt64(buffer, ref offset);
            NumberOfLinks     = LittleEndianReader.ReadUInt32(buffer, ref offset);
            DeletePending     = (ByteReader.ReadByte(buffer, ref offset) > 0);
            Directory         = (ByteReader.ReadByte(buffer, ref offset) > 0);
            Reserved2         = LittleEndianReader.ReadUInt16(buffer, ref offset);
            EaSize            = LittleEndianReader.ReadUInt32(buffer, ref offset);
            uint fileNameLength = LittleEndianReader.ReadUInt32(buffer, ref offset);

            FileName = ByteReader.ReadUTF16String(buffer, ref offset, (int)(fileNameLength / 2));
        }
        public FindFileBothDirectoryInfo(byte[] buffer, ref int offset, bool isUnicode) : base(false)
        {
            NextEntryOffset   = LittleEndianReader.ReadUInt32(buffer, ref offset);
            FileIndex         = LittleEndianReader.ReadUInt32(buffer, ref offset);
            CreationTime      = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
            LastAccessTime    = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
            LastWriteTime     = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
            LastChangeTime    = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
            EndOfFile         = LittleEndianReader.ReadInt64(buffer, ref offset);
            AllocationSize    = LittleEndianReader.ReadInt64(buffer, ref offset);
            ExtFileAttributes = (ExtendedFileAttributes)LittleEndianReader.ReadUInt32(buffer, ref offset);
            uint fileNameLength = LittleEndianReader.ReadUInt32(buffer, ref offset);

            EASize = LittleEndianReader.ReadUInt32(buffer, ref offset);
            byte shortNameLength = ByteReader.ReadByte(buffer, ref offset);

            Reserved  = ByteReader.ReadByte(buffer, ref offset);
            ShortName = ByteReader.ReadUTF16String(buffer, ref offset, 12);
            ShortName = ShortName.Substring(0, shortNameLength);
            FileName  = SMB1Helper.ReadFixedLengthString(buffer, ref offset, isUnicode, (int)fileNameLength);
        }
        public NTCreateAndXResponseExtended(byte[] buffer, int offset) : base(buffer, offset, false)
        {
            int parametersOffset = 4;

            OpLockLevel       = (OpLockLevel)ByteReader.ReadByte(this.SMBParameters, ref parametersOffset);
            FID               = LittleEndianReader.ReadUInt16(this.SMBParameters, ref parametersOffset);
            CreateDisposition = (CreateDisposition)LittleEndianReader.ReadUInt32(this.SMBParameters, ref parametersOffset);
            CreateTime        = FileTimeHelper.ReadNullableFileTime(this.SMBParameters, ref parametersOffset);
            LastAccessTime    = FileTimeHelper.ReadNullableFileTime(this.SMBParameters, ref parametersOffset);
            LastWriteTime     = FileTimeHelper.ReadNullableFileTime(this.SMBParameters, ref parametersOffset);
            LastChangeTime    = FileTimeHelper.ReadNullableFileTime(this.SMBParameters, ref parametersOffset);
            ExtFileAttributes = (ExtendedFileAttributes)LittleEndianReader.ReadUInt32(this.SMBParameters, ref parametersOffset);
            AllocationSize    = LittleEndianReader.ReadInt64(this.SMBParameters, ref parametersOffset);
            EndOfFile         = LittleEndianReader.ReadInt64(this.SMBParameters, ref parametersOffset);
            ResourceType      = (ResourceType)LittleEndianReader.ReadUInt16(this.SMBParameters, ref parametersOffset);
            NMPipeStatus_or_FileStatusFlags = LittleEndianReader.ReadUInt16(this.SMBParameters, ref parametersOffset);
            Directory                = (ByteReader.ReadByte(this.SMBParameters, ref parametersOffset) > 0);
            VolumeGuid               = LittleEndianReader.ReadGuid(this.SMBParameters, ref parametersOffset);
            FileID                   = LittleEndianReader.ReadUInt64(this.SMBParameters, ref parametersOffset);
            MaximalAccessRights      = (AccessMask)LittleEndianReader.ReadUInt32(this.SMBParameters, ref parametersOffset);
            GuestMaximalAccessRights = (AccessMask)LittleEndianReader.ReadUInt32(this.SMBParameters, ref parametersOffset);
        }
Пример #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);
     }
 }