public static void FSCCTrans2QueryFSInfoRequest(int messageId, int sessionId, int treeId, bool isSigned, FSCCTransaction2QueryFSInforLevel informationLevel) { Checker.CheckRequest(smbConnection, messageId, sessionId, treeId, isSigned, smbState); Condition.IsTrue(smbConnection.treeConnectList[treeId].smbShare.shareType == ShareType.Disk); if (informationLevel == FSCCTransaction2QueryFSInforLevel.FileFsAttributeInformation) { Requirement.AssumeCaptured("Information level in FSCC is FileFsAttributeInformation"); } else if (informationLevel == FSCCTransaction2QueryFSInforLevel.FileFsDeviceInformation) { Requirement.AssumeCaptured("Information level in FSCC is FileFsDeviceInformation"); } else if (informationLevel == FSCCTransaction2QueryFSInforLevel.FileFsSizeInformation) { Requirement.AssumeCaptured("Information level in FSCC is FileFsSizeInformation"); } else if (informationLevel == FSCCTransaction2QueryFSInforLevel.FileFsVolumeInformation) { Requirement.AssumeCaptured("Information level in FSCC is FileFsVolumeInformation"); } smbRequest = new FSCCTrans2QueryFSInfoRequest(messageId, sessionId, treeId, isSigned, informationLevel); Update.UpdateRequest(smbConnection, smbRequest); }
/// <summary> /// TRANS2_QUERY_FS_INFORMATION Request. /// </summary> /// <param name="messageId">This is used to associate a response with a request.</param> /// <param name="sessionId"> /// Set this value to 0 to request a new session setup, or set this value to a previously established session /// identifier to request reauthenticate to an existing session. /// </param> /// <param name="treeId"> /// This field identifies the subdirectory (or tree) (also referred as a share in this document) on the /// server that the client is accessing. /// </param> /// <param name="isSigned"> /// Indicate whether the SUT has message signing enabled or required. /// </param> /// <param name="informationLevel">This can be used to query information from the server.</param> public void FSCCTrans2QueryFSInfoRequest(int messageId, int sessionId, int treeId, bool isSigned, FSCCTransaction2QueryFSInforLevel informationLevel) { #region Create Packet SmbTrans2QueryFsInformationRequestPacket smbPacket = new SmbTrans2QueryFsInformationRequestPacket(); ushort uid = (ushort)this.uId[(uint)sessionId]; ushort requestedTid = (ushort)this.tId[(uint)treeId]; NamespaceCifs.Trans2SmbParametersFlags transactOptions = NamespaceCifs.Trans2SmbParametersFlags.NONE; ushort level = this.FSCCInformationLevelBytesQueryFS[(ushort)informationLevel]; fsccQueryFSLevel = (ushort)informationLevel; smbPacket = this.smbClientStack.CreateTrans2QueryFileSystemInformationRequest( requestedTid, this.maxDataCount, transactOptions, (NamespaceCifs.QueryFSInformationLevel)level); NamespaceCifs.TRANS2_QUERY_FS_INFORMATION_Request_Trans2_Parameters payload = smbPacket.Trans2Parameters; payload.InformationLevel = (NamespaceCifs.QueryFSInformationLevel)level; smbPacket.Trans2Parameters = payload; if (isSigned) { NamespaceCifs.CifsClientPerConnection connection = this.smbClientStack.Context.GetConnection(ConnectionId); NamespaceCifs.CifsClientPerSession session = this.smbClientStack.Context.GetSession(ConnectionId, uid); smbPacket.Sign(connection.ClientNextSendSequenceNumber, session.SessionKey); } #endregion #region Send and Receive ExpectPacket this.smbClientStack.SendPacket(smbPacket); StackPacket response = this.smbClientStack.ExpectPacket(this.timeout); NamespaceCifs.SmbPacket smbPacketResponse = (NamespaceCifs.SmbPacket)response; this.QueryUidTable(smbPacketResponse); this.QueryTidTable(smbPacketResponse); if (response.GetType() == typeof(SmbErrorResponsePacket)) { SmbErrorResponsePacket smbErrorResponsePacket = response as SmbErrorResponsePacket; NamespaceCifs.SmbHeader smbErrorHeader = smbErrorResponsePacket.SmbHeader; this.ErrorResponse(smbErrorHeader.Mid + this.addMidMark, (MessageStatus)smbErrorHeader.Status); } else { SmbTrans2QueryFsInformationResponsePacket smbTrans2QueryFsInformationPacket = response as SmbTrans2QueryFsInformationResponsePacket; NamespaceCifs.SmbHeader trans2QueryFsInformationResponseHeader = smbTrans2QueryFsInformationPacket.SmbHeader; FSCCTrans2QueryFSInformationResponse(smbTrans2QueryFsInformationPacket); this.FSCCTrans2QueryFSInfoResponse( trans2QueryFsInformationResponseHeader.Mid + this.addMidMark, this.QueryUidTable(smbPacketResponse), this.QueryTidTable(smbPacketResponse), (smbPacketResponse).IsSignRequired, (MessageStatus)trans2QueryFsInformationResponseHeader.Status); } #endregion }
/// <summary> /// TRANS2_QUERY_FS_INFORMATION Request /// </summary> /// <param name="messageId"> This is used to associate a response with a request.</param> /// <param name="sessionId"> Set this value to 0 to request a new session setup, or set this value to a previously established session identifier to reauthenticate to an existing session. </param> /// <param name="treeId"> This field identifies the subdirectory (or tree) (also referred to as a share in this document) on the server that the client is accessing. </param> /// <param name="isSigned"> Indicates whether the server has message signing enabled or required.</param> /// <param name="isUsePassthrough"> isUsePassthrough </param> /// <param name="informationLevel"> This can be used to query information from the server.</param> public FSCCTrans2QueryFSInfoRequest(int messageId, int sessionId, int treeId, bool isSigned, FSCCTransaction2QueryFSInforLevel informationLevel) : base(messageId, Command.FSCCTRANS2_QUERY_FS_INFORMATION) { this.sessionId = sessionId; this.treeId = treeId; this.isSigned = isSigned; this.informationLevel = informationLevel; }