/// <summary> /// to decode the smb data: from the general SmbDada to the concrete Smb Data. /// </summary> protected override void DecodeData() { this.smbData = TypeMarshal.ToStruct<SMB_COM_LOCK_AND_READ_Request_SMB_Data>( TypeMarshal.ToBytes(this.smbDataBlock)); }
/// <summary> /// to create a LockAndRead request packet. /// </summary> /// <param name="messageId">This field SHOULD be the multiplex ID that is used to associate a response with a /// request.</param> /// <param name="uid">This field SHOULD identify the authenticated instance of the user.</param> /// <param name="treeId">This field identifies the subdirectory (or tree) on the server that the client is /// accessing.</param> /// <param name="flags">An 8-bit field of 1-bit flags describing various features in effect for the /// message</param> /// <param name="flags2">A 16-bit field of 1-bit flags that represent various features in effect for the /// message. Unspecified bits are reserved and MUST be zero.</param> /// <param name="fid">This field MUST be a valid 16-bit signed integer indicating the file from which the data /// MUST be read.</param> /// <param name="countOfBytesToRead">This field is a 16-bit unsigned integer indicating the number of bytes to /// be read from the file.</param> /// <param name="readOffsetInBytes">This field is a 32-bit unsigned integer indicating the offset in number of /// bytes from which to begin reading from the file.</param> /// <param name="estimateOfRemainingBytesToBeRead">This field is a 16-bit unsigned integer indicating the /// remaining number of bytes that the client expects to read from the file.</param> /// <returns>a LockAndRead request packet</returns> public SmbLockAndReadRequestPacket CreateLockAndReadRequest( ushort messageId, ushort uid, ushort treeId, SmbFlags flags, SmbFlags2 flags2, ushort fid, ushort countOfBytesToRead, uint readOffsetInBytes, ushort estimateOfRemainingBytesToBeRead) { SmbLockAndReadRequestPacket packet = new SmbLockAndReadRequestPacket(); packet.SmbHeader = CifsMessageUtils.CreateSmbHeader(SmbCommand.SMB_COM_LOCK_AND_READ, messageId, uid, treeId, flags, flags2); SMB_COM_LOCK_AND_READ_Request_SMB_Parameters smbParameters = new SMB_COM_LOCK_AND_READ_Request_SMB_Parameters(); smbParameters.CountOfBytesToRead = countOfBytesToRead; smbParameters.ReadOffsetInBytes = readOffsetInBytes; smbParameters.EstimateOfRemainingBytesToBeRead = estimateOfRemainingBytesToBeRead; smbParameters.FID = fid; smbParameters.WordCount = (byte)(Marshal.SizeOf(smbParameters) / NumBytesOfWord); SMB_COM_LOCK_AND_READ_Request_SMB_Data smbData = new SMB_COM_LOCK_AND_READ_Request_SMB_Data(); smbData.ByteCount = 0; packet.SmbParameters = smbParameters; packet.SmbData = smbData; return packet; }