/// <summary> /// Create Trans2SetFileSystemInformation requestfor client to set the file system information on server. /// </summary> /// <param name = "messageId">the id of message, used to identity the request and the server response. </param> /// <param name = "sessionUid">the valid session id, must be response by server of the session setup request. </param> /// <param name = "treeId">the valid tree connect id, must be response by server of the tree connect. </param> /// <param name = "flags"> /// The Flags field contains individual flags, as specified in [CIFS] sections 2.4.2 and 3.1.1. /// </param> /// <param name = "flags2"> /// The Flags2 field contains individual bit flags that, depending on the negotiated SMB dialect, indicate /// various client and server capabilities. /// </param> /// <param name = "fileId">the valid file id to operation on, response by server. </param> /// <param name = "transactOptions"> /// A set of bit flags that alter the behavior of the requested operation. Unused bit fields MUST be set to /// zero by the client sending the request, and MUST be ignored by the server receiving the request. The /// client MAY set either or both of the following bit flags /// </param> /// <param name = "timeOut"> /// The maximum amount of time in milliseconds to wait for the operation to complete. The client SHOULD set /// this to 0 to indicate that no time-out is given. If the operation does not complete within the specified /// time, the server MAY abort the request and send a failure response. /// </param> /// <param name = "isUsePathThrough"> /// Indicates that the client is requesting a native Microsoft Windows® NT operating system information level, /// as specified in section 3.2.4.7 and in [MS-FSCC] section 2.4. /// </param> /// <param name = "informationLevel"> /// Indicates that client specifies the information it is requesting. Server return different data based on /// the client's request. /// </param> /// <param name = "data">the information data to be set. </param> /// <returns>a set file information request packet </returns> private SmbTrans2SetFsInformationRequestPacket CreateTrans2SetFileSystemInformationRequest( ushort messageId, ushort sessionUid, ushort treeId, SmbHeader_Flags_Values flags, SmbHeader_Flags2_Values flags2, ushort fileId, Trans2SmbParametersFlags transactOptions, uint timeOut, bool isUsePathThrough, QueryFSInformationLevel informationLevel, byte[] data) { if (isUsePathThrough) { informationLevel = (QueryFSInformationLevel) (informationLevel + SmbCapability.CONST_SMB_INFO_PASSTHROUGH); } SmbTrans2SetFsInformationRequestPacket packet = new SmbTrans2SetFsInformationRequestPacket( this.cifsClient.CreateTrans2SetFsInformationRequest( messageId, sessionUid, treeId, (SmbFlags)flags, (SmbFlags2)flags2, this.capability.MaxParameterCount, this.capability.MaxDataCount, this.capability.MaxSetupCount, transactOptions, timeOut, "")); // Set Trans2_Parameters TRANS2_SET_FILE_SYSTEM_INFORMATION_Request_Trans2_Parameters trans2Parameters = new TRANS2_SET_FILE_SYSTEM_INFORMATION_Request_Trans2_Parameters(); trans2Parameters.FID = fileId; trans2Parameters.InformationLevel = informationLevel; // Set Trans2_Data TRANS2_SET_FILE_SYSTEM_INFORMATION_Request_Trans2_Data trans2Data = new TRANS2_SET_FILE_SYSTEM_INFORMATION_Request_Trans2_Data(); trans2Data.Data = data; packet.Trans2Parameters = trans2Parameters; packet.Trans2Data = trans2Data; packet.UpdateCountAndOffset(); return packet; }
/// <summary> /// to decode the Trans2 parameters: from the general Trans2Parameters to the concrete Trans2 Parameters. /// </summary> protected override void DecodeTrans2Parameters() { if (this.smbData.Trans2_Parameters != null) { this.trans2Parameters = CifsMessageUtils.ToStuct<TRANS2_SET_FILE_SYSTEM_INFORMATION_Request_Trans2_Parameters>( this.smbData.Trans2_Parameters); } }