public override byte[] GetBytes(bool isUnicode) { this.SMBParameters = new byte[ParametersLength]; int parametersOffset = 4; LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, FID); LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)FileAttrs); UTimeHelper.WriteUTime(this.SMBParameters, ref parametersOffset, LastWriteTime); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, FileDataSize); LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)AccessRights); LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)ResourceType); NMPipeStatus.WriteBytes(this.SMBParameters, ref parametersOffset); OpenResults.WriteBytes(this.SMBParameters, ref parametersOffset); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, ServerFID); LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, Reserved); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, (uint)MaximalAccessRights); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, (uint)GuestMaximalAccessRights); return(base.GetBytes(isUnicode)); }
public OpenAndXRequest(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode) { int parametersOffset = 4; Flags = (OpenFlags)LittleEndianReader.ReadUInt16(this.SMBParameters, ref parametersOffset); AccessMode = AccessModeOptions.Read(this.SMBParameters, ref parametersOffset); SearchAttrs = (SMBFileAttributes)LittleEndianReader.ReadUInt16(this.SMBParameters, ref parametersOffset); FileAttrs = (SMBFileAttributes)LittleEndianReader.ReadUInt16(this.SMBParameters, ref parametersOffset); CreationTime = UTimeHelper.ReadNullableUTime(this.SMBParameters, ref parametersOffset); OpenMode = OpenMode.Read(this.SMBParameters, ref parametersOffset); AllocationSize = LittleEndianReader.ReadUInt32(this.SMBParameters, ref parametersOffset); Timeout = LittleEndianReader.ReadUInt32(this.SMBParameters, ref parametersOffset); Reserved = LittleEndianReader.ReadUInt32(this.SMBParameters, ref parametersOffset); int dataOffset = 0; if (isUnicode) { dataOffset = 1; // 1 byte padding for 2 byte alignment } FileName = SMB1Helper.ReadSMBString(this.SMBData, dataOffset, isUnicode); }
public override byte[] GetBytes(bool isUnicode) { this.SMBParameters = new byte[ParametersLength]; LittleEndianWriter.WriteUInt16(this.SMBParameters, 0, (ushort)FileAttributes); UTimeHelper.WriteUTime(this.SMBParameters, 2, LastWriteTime); ByteWriter.WriteBytes(this.SMBParameters, 6, Reserved, 10); int length = 1; if (isUnicode) { length += FileName.Length * 2 + 2; } else { length += FileName.Length + 1; } this.SMBData = new byte[length]; ByteWriter.WriteByte(this.SMBData, 0, BufferFormat); SMB1Helper.WriteSMBString(this.SMBData, 1, isUnicode, FileName); return(base.GetBytes(isUnicode)); }
public CloseRequest(byte[] buffer, int offset) : base(buffer, offset, false) { FID = LittleEndianConverter.ToUInt16(this.SMBParameters, 0); LastTimeModified = UTimeHelper.ReadNullableUTime(this.SMBParameters, 2); }