public override byte[] GetParameters(bool isUnicode) { int length = 28; if (isUnicode) { length += FileName.Length * 2 + 2; } else { length += FileName.Length + 1; } byte[] parameters = new byte[length]; LittleEndianWriter.WriteUInt16(parameters, 0, (ushort)Flags); AccessMode.WriteBytes(parameters, 2); LittleEndianWriter.WriteUInt16(parameters, 4, Reserved1); LittleEndianWriter.WriteUInt16(parameters, 6, (ushort)FileAttributes); UTimeHelper.WriteUTime(parameters, 8, CreationTime); OpenMode.WriteBytes(parameters, 12); LittleEndianWriter.WriteUInt32(parameters, 14, AllocationSize); ByteWriter.WriteBytes(parameters, 18, Reserved, 10); SMB1Helper.WriteSMBString(parameters, 28, isUnicode, FileName); return(parameters); }
public override byte[] GetBytes(bool isUnicode) { this.SMBParameters = new byte[ParametersLength]; int parametersOffset = 4; LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)OptionalSupport); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, (uint)MaximalShareAccessRights); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, (uint)GuestMaximalShareAccessRights); // Should be written as OEM string but it doesn't really matter string serviceString = ServiceNameHelper.GetServiceString(Service); if (isUnicode) { this.SMBData = new byte[serviceString.Length + NativeFileSystem.Length * 2 + 3]; } else { this.SMBData = new byte[serviceString.Length + NativeFileSystem.Length + 2]; } int offset = 0; ByteWriter.WriteNullTerminatedAnsiString(this.SMBData, ref offset, serviceString); SMB1Helper.WriteSMBString(this.SMBData, ref offset, isUnicode, NativeFileSystem); return(base.GetBytes(isUnicode)); }
public override byte[] GetBytes(bool isUnicode) { ChallengeLength = (byte)this.Challenge.Length; this.SMBParameters = new byte[ParametersLength]; LittleEndianWriter.WriteUInt16(this.SMBParameters, 0, DialectIndex); ByteWriter.WriteByte(this.SMBParameters, 2, (byte)SecurityMode); LittleEndianWriter.WriteUInt16(this.SMBParameters, 3, MaxMpxCount); LittleEndianWriter.WriteUInt16(this.SMBParameters, 5, MaxNumberVcs); LittleEndianWriter.WriteUInt32(this.SMBParameters, 7, MaxBufferSize); LittleEndianWriter.WriteUInt32(this.SMBParameters, 11, MaxRawSize); LittleEndianWriter.WriteUInt32(this.SMBParameters, 15, SessionKey); LittleEndianWriter.WriteUInt32(this.SMBParameters, 19, (uint)Capabilities); FileTimeHelper.WriteFileTime(this.SMBParameters, 23, SystemTime); LittleEndianWriter.WriteInt16(this.SMBParameters, 31, ServerTimeZone); ByteWriter.WriteByte(this.SMBParameters, 33, ChallengeLength); // [MS-CIFS] <90> Padding is not added before DomainName // DomainName and ServerName are always in Unicode this.SMBData = new byte[Challenge.Length + (DomainName.Length + 1) * 2 + (ServerName.Length + 1) * 2]; int offset = 0; ByteWriter.WriteBytes(this.SMBData, ref offset, Challenge); SMB1Helper.WriteSMBString(this.SMBData, ref offset, true, DomainName); SMB1Helper.WriteSMBString(this.SMBData, ref offset, true, ServerName); return(base.GetBytes(isUnicode)); }
public override byte[] GetBytes(bool isUnicode) { this.SMBParameters = new byte[ParametersLength]; LittleEndianWriter.WriteUInt16(this.SMBParameters, 4, (ushort)Action); int offset = 0; if (isUnicode) { // A Unicode string MUST be aligned to a 16-bit boundary with respect to the beginning of the SMB Header. // Note: SMBData starts at an odd offset. int padding = 1; this.SMBData = new byte[padding + NativeOS.Length * 2 + NativeLanMan.Length * 2 + PrimaryDomain.Length * 2 + 6]; offset = padding; } else { this.SMBData = new byte[NativeOS.Length + NativeLanMan.Length + PrimaryDomain.Length + 3]; } SMB1Helper.WriteSMBString(this.SMBData, ref offset, isUnicode, NativeOS); SMB1Helper.WriteSMBString(this.SMBData, ref offset, isUnicode, NativeLanMan); SMB1Helper.WriteSMBString(this.SMBData, ref offset, isUnicode, PrimaryDomain); return(base.GetBytes(isUnicode)); }
public override byte[] GetBytes(bool isUnicode) { this.SMBParameters = new byte[ParametersLength]; int parametersOffset = 4; LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)Flags); AccessMode.WriteBytes(this.SMBParameters, ref parametersOffset); LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)SearchAttrs); LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)FileAttrs); UTimeHelper.WriteUTime(this.SMBParameters, ref parametersOffset, CreationTime); OpenMode.WriteBytes(this.SMBParameters, ref parametersOffset); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, AllocationSize); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, Timeout); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, Reserved); int padding = 0; if (isUnicode) { padding = 1; this.SMBData = new byte[padding + FileName.Length * 2 + 2]; } else { this.SMBData = new byte[FileName.Length + 1]; } SMB1Helper.WriteSMBString(this.SMBData, padding, isUnicode, FileName); return(base.GetBytes(isUnicode)); }
public override byte[] GetBytes(bool isUnicode) { ushort securityBlobLength = (ushort)SecurityBlob.Length; this.SMBParameters = new byte[ParametersLength]; LittleEndianWriter.WriteUInt16(this.SMBParameters, 4, (ushort)Action); LittleEndianWriter.WriteUInt16(this.SMBParameters, 6, securityBlobLength); int padding = 0; if (isUnicode) { // A Unicode string MUST be aligned to a 16-bit boundary with respect to the beginning of the SMB Header. // Note: SMBData starts at an odd offset. padding = (1 + securityBlobLength) % 2; this.SMBData = new byte[SecurityBlob.Length + padding + NativeOS.Length * 2 + NativeLanMan.Length * 2 + 4]; } else { this.SMBData = new byte[SecurityBlob.Length + NativeOS.Length + NativeLanMan.Length + 2]; } int offset = 0; ByteWriter.WriteBytes(this.SMBData, ref offset, SecurityBlob); offset += padding; SMB1Helper.WriteSMBString(this.SMBData, ref offset, isUnicode, NativeOS); SMB1Helper.WriteSMBString(this.SMBData, ref offset, isUnicode, NativeLanMan); return(base.GetBytes(isUnicode)); }
public SessionSetupAndXRequest(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode) { MaxBufferSize = LittleEndianConverter.ToUInt16(this.SMBParameters, 4); MaxMpxCount = LittleEndianConverter.ToUInt16(this.SMBParameters, 6); VcNumber = LittleEndianConverter.ToUInt16(this.SMBParameters, 8); SessionKey = LittleEndianConverter.ToUInt32(this.SMBParameters, 10); OEMPasswordLength = LittleEndianConverter.ToUInt16(this.SMBParameters, 14); UnicodePasswordLength = LittleEndianConverter.ToUInt16(this.SMBParameters, 16); Reserved = LittleEndianConverter.ToUInt32(this.SMBParameters, 18); Capabilities = (Capabilities)LittleEndianConverter.ToUInt32(this.SMBParameters, 22); OEMPassword = ByteReader.ReadBytes(this.SMBData, 0, OEMPasswordLength); UnicodePassword = ByteReader.ReadBytes(this.SMBData, OEMPasswordLength, UnicodePasswordLength); int dataOffset = OEMPasswordLength + UnicodePasswordLength; if (isUnicode) { // A Unicode string MUST be aligned to a 16-bit boundary with respect to the beginning of the SMB Header. // Note: SMBData starts at an odd offset. int padding = (1 + OEMPasswordLength + UnicodePasswordLength) % 2; dataOffset += padding; } AccountName = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); PrimaryDomain = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); NativeOS = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); NativeLanMan = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); }
public SetInformation2Request(byte[] buffer, int offset) : base(buffer, offset, false) { FID = LittleEndianConverter.ToUInt16(this.SMBParameters, 0); CreationDateTime = SMB1Helper.ReadNullableSMBDateTime(this.SMBParameters, 2); LastAccessDateTime = SMB1Helper.ReadNullableSMBDateTime(this.SMBParameters, 6); LastWriteDateTime = SMB1Helper.ReadNullableSMBDateTime(this.SMBParameters, 10); }
public override byte[] GetBytes(bool isUnicode) { this.SMBParameters = new byte[ParametersLength]; LittleEndianWriter.WriteUInt16(this.SMBParameters, 0, (ushort)SearchAttributes); if (isUnicode) { int padding = 1; this.SMBData = new byte[2 + OldFileName.Length * 2 + NewFileName.Length * 2 + 4 + padding]; } else { this.SMBData = new byte[2 + OldFileName.Length + NewFileName.Length + 2]; } int dataOffset = 0; ByteWriter.WriteByte(this.SMBData, ref dataOffset, BufferFormat1); SMB1Helper.WriteSMBString(this.SMBData, ref dataOffset, isUnicode, OldFileName); ByteWriter.WriteByte(this.SMBData, ref dataOffset, BufferFormat2); if (isUnicode) { dataOffset++; // padding } SMB1Helper.WriteSMBString(this.SMBData, ref dataOffset, isUnicode, NewFileName); return(base.GetBytes(isUnicode)); }
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); uint eaLength = 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); }
public NTCreateAndXRequest(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode) { Reserved = ByteReader.ReadByte(this.SMBParameters, 4); ushort nameLength = LittleEndianConverter.ToUInt16(this.SMBParameters, 5); Flags = (NTCreateFlags)LittleEndianConverter.ToUInt32(this.SMBParameters, 7); RootDirectoryFID = LittleEndianConverter.ToUInt32(this.SMBParameters, 11); DesiredAccess = (AccessMask)LittleEndianConverter.ToUInt32(this.SMBParameters, 15); AllocationSize = LittleEndianConverter.ToInt64(this.SMBParameters, 19); ExtFileAttributes = (ExtendedFileAttributes)LittleEndianConverter.ToUInt32(this.SMBParameters, 27); ShareAccess = (ShareAccess)LittleEndianConverter.ToUInt32(this.SMBParameters, 31); CreateDisposition = (CreateDisposition)LittleEndianConverter.ToUInt32(this.SMBParameters, 35); CreateOptions = (CreateOptions)LittleEndianConverter.ToUInt32(this.SMBParameters, 39); ImpersonationLevel = (ImpersonationLevel)LittleEndianConverter.ToUInt32(this.SMBParameters, 43); SecurityFlags = (SecurityFlags)ByteReader.ReadByte(this.SMBParameters, 47); int dataOffset = 0; if (isUnicode) { // A Unicode string MUST be aligned to a 16-bit boundary with respect to the beginning of the SMB Header. // Note: SMBData starts at an odd offset. dataOffset = 1; } FileName = SMB1Helper.ReadSMBString(this.SMBData, dataOffset, isUnicode); }
public FindFileNamesInfo(byte[] buffer, int offset, bool isUnicode) : base() { 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); }
public Transaction2SetPathInformationRequest(byte[] parameters, byte[] data, bool isUnicode) : base() { InformationLevel = LittleEndianConverter.ToUInt16(parameters, 0); Reserved = LittleEndianConverter.ToUInt32(parameters, 2); FileName = SMB1Helper.ReadSMBString(parameters, 6, isUnicode); InformationBytes = data; }
public CheckDirectoryRequest(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode) { BufferFormat = ByteReader.ReadByte(this.SMBData, 0); if (BufferFormat != SupportedBufferFormat) { throw new InvalidDataException("Unsupported Buffer Format"); } DirectoryName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode); }
public override void WriteBytes(byte[] buffer, ref int offset, bool isUnicode) { uint fileNameLength = (uint)(isUnicode ? FileName.Length * 2 : FileName.Length); LittleEndianWriter.WriteUInt32(buffer, ref offset, NextEntryOffset); LittleEndianWriter.WriteUInt32(buffer, ref offset, FileIndex); LittleEndianWriter.WriteUInt32(buffer, ref offset, fileNameLength); SMB1Helper.WriteSMBString(buffer, ref offset, isUnicode, FileName); }
public override byte[] GetParameters(bool isUnicode) { int length = 4; length += isUnicode ? DirectoryName.Length * 2 + 2 : DirectoryName.Length + 1 + 1; byte[] parameters = new byte[length]; LittleEndianWriter.WriteUInt32(parameters, 0, Reserved); SMB1Helper.WriteSMBString(parameters, 4, isUnicode, DirectoryName); return(parameters); }
public override byte[] GetBytes(bool isUnicode) { this.SMBParameters = new byte[ParametersLength]; LittleEndianWriter.WriteUInt16(this.SMBParameters, 0, FID); SMB1Helper.WriteSMBDateTime(this.SMBParameters, 2, CreationDateTime); SMB1Helper.WriteSMBDateTime(this.SMBParameters, 6, LastAccessDateTime); SMB1Helper.WriteSMBDateTime(this.SMBParameters, 10, LastWriteDateTime); return(base.GetBytes(isUnicode)); }
public TransactionQueryNamedPipeInfoResponse(byte[] parameters, bool isUnicode) : base() { OutputBufferSize = LittleEndianConverter.ToUInt16(parameters, 0); InputBufferSize = LittleEndianConverter.ToUInt16(parameters, 2); MaximumInstances = ByteReader.ReadByte(parameters, 4); CurrentInstances = ByteReader.ReadByte(parameters, 5); PipeNameLength = ByteReader.ReadByte(parameters, 6); // Note: Trans_Parameters is aligned to 4 byte boundary PipeName = SMB1Helper.ReadSMBString(parameters, 8, isUnicode); }
public TreeConnectAndXResponse(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode) { OptionalSupport = (OptionalSupportFlags)LittleEndianConverter.ToUInt16(this.SMBParameters, 4); int dataOffset = 0; string serviceString = ByteReader.ReadNullTerminatedAnsiString(this.SMBData, ref dataOffset); NativeFileSystem = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); Service = ServiceNameHelper.GetServiceName(serviceString); }
public Transaction2QueryPathInformationRequest(byte[] parameters, byte[] data, bool isUnicode) : base() { InformationLevel = LittleEndianConverter.ToUInt16(parameters, 0); Reserved = LittleEndianConverter.ToUInt32(parameters, 4); FileName = SMB1Helper.ReadSMBString(parameters, 6, isUnicode); if (!IsPassthroughInformationLevel && QueryInformationLevel == QueryInformationLevel.SMB_INFO_QUERY_EAS_FROM_LIST) { GetExtendedAttributeList = new FullExtendedAttributeList(data, 0); } }
public DeleteRequest(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode) { SearchAttributes = (SMBFileAttributes)LittleEndianConverter.ToUInt16(this.SMBParameters, 0); BufferFormat = ByteReader.ReadByte(this.SMBData, 0); if (BufferFormat != SupportedBufferFormat) { throw new InvalidDataException("Unsupported Buffer Format"); } FileName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode); }
public SetInformationRequest(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode) { FileAttributes = (SMBFileAttributes)LittleEndianConverter.ToUInt16(this.SMBParameters, 0); LastWriteTime = UTimeHelper.ReadNullableUTime(this.SMBParameters, 2); Reserved = ByteReader.ReadBytes(this.SMBParameters, 6, 10); BufferFormat = ByteReader.ReadByte(this.SMBData, 0); if (BufferFormat != SupportedBufferFormat) { throw new InvalidDataException("Unsupported Buffer Format"); } FileName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode); }
public Transaction2FindNext2Request(byte[] parameters, byte[] data, bool isUnicode) : base() { SID = LittleEndianConverter.ToUInt16(parameters, 0); SearchCount = LittleEndianConverter.ToUInt16(parameters, 2); InformationLevel = (FindInformationLevel)LittleEndianConverter.ToUInt16(parameters, 4); ResumeKey = LittleEndianConverter.ToUInt32(parameters, 6); Flags = (FindFlags)LittleEndianConverter.ToUInt16(parameters, 10); FileName = SMB1Helper.ReadSMBString(parameters, 12, isUnicode); if (InformationLevel == FindInformationLevel.SMB_INFO_QUERY_EAS_FROM_LIST) { GetExtendedAttributeList = new ExtendedAttributeNameList(data, 0); } }
public Transaction2Open2Request(byte[] parameters, byte[] data, bool isUnicode) : base() { Flags = (Open2Flags)LittleEndianConverter.ToUInt16(parameters, 0); AccessMode = new AccessModeOptions(parameters, 2); Reserved1 = LittleEndianConverter.ToUInt16(parameters, 4); FileAttributes = (SMBFileAttributes)LittleEndianConverter.ToUInt16(parameters, 6); CreationTime = UTimeHelper.ReadNullableUTime(parameters, 8); OpenMode = new OpenMode(parameters, 12); AllocationSize = LittleEndianConverter.ToUInt32(parameters, 14); Reserved = ByteReader.ReadBytes(parameters, 18, 10); FileName = SMB1Helper.ReadSMBString(parameters, 28, isUnicode); ExtendedAttributeList = new FullExtendedAttributeList(data, 0); }
public TreeConnectAndXResponseExtended(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode) { int parametersOffset = 4; OptionalSupport = (OptionalSupportFlags)LittleEndianReader.ReadUInt16(this.SMBParameters, ref parametersOffset); MaximalShareAccessRights = (AccessMask)LittleEndianReader.ReadUInt32(this.SMBParameters, ref parametersOffset); GuestMaximalShareAccessRights = (AccessMask)LittleEndianReader.ReadUInt32(this.SMBParameters, ref parametersOffset); int dataOffset = 0; string serviceString = ByteReader.ReadNullTerminatedAnsiString(this.SMBData, ref dataOffset); NativeFileSystem = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); Service = ServiceNameHelper.GetServiceName(serviceString); }
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 override void WriteBytes(byte[] buffer, ref int offset, bool isUnicode) { uint fileNameLength = (byte)(isUnicode ? FileName.Length * 2 : FileName.Length); LittleEndianWriter.WriteUInt32(buffer, ref offset, NextEntryOffset); LittleEndianWriter.WriteUInt32(buffer, ref offset, FileIndex); FileTimeHelper.WriteFileTime(buffer, ref offset, CreationTime); FileTimeHelper.WriteFileTime(buffer, ref offset, LastAccessTime); FileTimeHelper.WriteFileTime(buffer, ref offset, LastWriteTime); FileTimeHelper.WriteFileTime(buffer, ref offset, LastAttrChangeTime); LittleEndianWriter.WriteInt64(buffer, ref offset, EndOfFile); LittleEndianWriter.WriteInt64(buffer, ref offset, AllocationSize); LittleEndianWriter.WriteUInt32(buffer, ref offset, (uint)ExtFileAttributes); LittleEndianWriter.WriteUInt32(buffer, ref offset, fileNameLength); SMB1Helper.WriteSMBString(buffer, ref offset, isUnicode, FileName); }
public override byte[] GetBytes(bool isUnicode) { int length = 1; if (isUnicode) { length += DirectoryName.Length * 2 + 2; } else { length += DirectoryName.Length + 1; } this.SMBData = new byte[length]; ByteWriter.WriteByte(this.SMBData, 0, BufferFormat); SMB1Helper.WriteSMBString(this.SMBData, 1, isUnicode, DirectoryName); return(base.GetBytes(isUnicode)); }
public override byte[] GetParameters(bool isUnicode) { int length = ParametersFixedLength; if (isUnicode) { length += FileName.Length * 2 + 2; } else { length += FileName.Length + 1; } byte[] parameters = new byte[length]; LittleEndianWriter.WriteUInt16(parameters, 0, InformationLevel); LittleEndianWriter.WriteUInt32(parameters, 2, Reserved); SMB1Helper.WriteSMBString(parameters, 6, isUnicode, FileName); return(parameters); }
public NTCreateAndXResponse(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 = SMB1Helper.ReadNullableFileTime(this.SMBParameters, ref parametersOffset); LastAccessTime = SMB1Helper.ReadNullableFileTime(this.SMBParameters, ref parametersOffset); LastWriteTime = SMB1Helper.ReadNullableFileTime(this.SMBParameters, ref parametersOffset); LastChangeTime = SMB1Helper.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 = NamedPipeStatus.Read(this.SMBParameters, ref parametersOffset); Directory = (ByteReader.ReadByte(this.SMBParameters, ref parametersOffset) > 0); }