Пример #1
0
        public NTTransactCreateRequest(byte[] parameters, byte[] data, bool isUnicode)
        {
            int parametersOffset = 0;

            Flags             = (NTCreateFlags)LittleEndianReader.ReadUInt32(parameters, ref parametersOffset);
            RootDirectoryFID  = LittleEndianReader.ReadUInt32(parameters, ref parametersOffset);
            DesiredAccess     = (AccessMask)LittleEndianReader.ReadUInt32(parameters, ref parametersOffset);
            AllocationSize    = LittleEndianReader.ReadInt64(parameters, ref parametersOffset);
            ExtFileAttributes = (ExtendedFileAttributes)LittleEndianReader.ReadUInt32(parameters, ref parametersOffset);
            ShareAccess       = (ShareAccess)LittleEndianReader.ReadUInt32(parameters, ref parametersOffset);
            CreateDisposition = (CreateDisposition)LittleEndianReader.ReadUInt32(parameters, ref parametersOffset);
            CreateOptions     = (CreateOptions)LittleEndianReader.ReadUInt32(parameters, ref parametersOffset);
            uint securityDescriptiorLength = LittleEndianReader.ReadUInt32(parameters, ref parametersOffset);

            _ = LittleEndianReader.ReadUInt32(parameters, ref parametersOffset);
            uint nameLength = LittleEndianReader.ReadUInt32(parameters, ref parametersOffset);

            ImpersonationLevel = (ImpersonationLevel)LittleEndianReader.ReadUInt32(parameters, ref parametersOffset);
            SecurityFlags      = (SecurityFlags)ByteReader.ReadByte(parameters, ref parametersOffset);

            if (isUnicode)
            {
                parametersOffset++;
            }
            Name = SMB1Helper.ReadFixedLengthString(parameters, ref parametersOffset, isUnicode, (int)nameLength);
            if (securityDescriptiorLength > 0)
            {
                SecurityDescriptor = new SecurityDescriptor(data, 0);
            }
            ExtendedAttributes = FileFullEAInformation.ReadList(data, (int)securityDescriptiorLength);
        }
Пример #2
0
        public FindFileNamesInfo(byte[] buffer, int offset, bool isUnicode)
        {
            NextEntryOffset = LittleEndianReader.ReadUInt32(buffer, ref offset);
            FileIndex       = LittleEndianReader.ReadUInt32(buffer, ref offset);
            uint fileNameLength = LittleEndianReader.ReadUInt32(buffer, ref offset);

            FileName = SMB1Helper.ReadFixedLengthString(buffer, ref offset, isUnicode, (int)fileNameLength);
        }
Пример #3
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);
        }
        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);
        }