/// <summary> /// to create a SetInformation2 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="fid">This is the FID representing the file for which attributes are to be set.</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="createDate">This is the FID representing the file for which attributes are to be set</param> /// <param name="creationTime">This is the date when the file was created</param> /// <param name="lastAccessDate">This is the date when the file was last accessed</param> /// <param name="lastAccessTime">This is the time on LastAccessDate when the file was last accessed.</param> /// <param name="lastWriteDate">This is the date when data were last written to the file</param> /// <param name="lastWriteTime">This is the time on LastWriteDate when data were last written to the /// file.</param> /// <returns>a SetInformation2 request packet</returns> public SmbSetInformation2RequestPacket CreateSetInformation2Request( ushort messageId, ushort uid, ushort treeId, ushort fid, SmbFlags flags, SmbFlags2 flags2, SmbDate createDate, SmbTime creationTime, SmbDate lastAccessDate, SmbTime lastAccessTime, SmbDate lastWriteDate, SmbTime lastWriteTime) { SmbSetInformation2RequestPacket packet = new SmbSetInformation2RequestPacket(); packet.SmbHeader = CifsMessageUtils.CreateSmbHeader(SmbCommand.SMB_COM_SET_INFORMATION2, messageId, uid, treeId, flags, flags2); SMB_COM_SET_INFORMATION2_Request_SMB_Parameters smbParameters = new SMB_COM_SET_INFORMATION2_Request_SMB_Parameters(); smbParameters.FID = fid; smbParameters.CreateDate = createDate; smbParameters.CreationTime = creationTime; smbParameters.LastAccessDate = lastAccessDate; smbParameters.LastAccessTime = lastAccessTime; smbParameters.LastWriteDate = lastWriteDate; smbParameters.LastWriteTime = lastWriteTime; smbParameters.WordCount = (byte)(Marshal.SizeOf(smbParameters) / NumBytesOfWord); SMB_COM_SET_INFORMATION2_Request_SMB_Data smbData = new SMB_COM_SET_INFORMATION2_Request_SMB_Data(); smbData.ByteCount = 0; packet.SmbParameters = smbParameters; packet.SmbData = smbData; return packet; }
/// <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_SET_INFORMATION2_Request_SMB_Data>( TypeMarshal.ToBytes(this.smbDataBlock)); }