/// <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 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="isUsePassthrough">
        /// Indicate whether adding SMB_INFO_PASSTHROUGH in InformationLevel field of the request.
        /// </param>
        /// <param name="informationLevel">This can be used to query information from the server.</param>
        /// <param name="otherBits">If it contains other bits.</param>
        /// <param name="reserved">The reserved int value.</param>
        public void Trans2QueryFsInfoRequest(
            int messageId,
            int sessionId,
            int treeId,
            bool isSigned,
            bool isUsePassthrough,
            [Domain("InfoLevelQueriedByFS")] InformationLevel informationLevel,
            bool otherBits,
            int reserved)
        {
            #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.informationLevelBytes[(ushort)informationLevel];

            this.smbClientStack.Capability.IsUsePathThrough = isUsePassthrough;

            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.SMB_QUERY_FS_ATTRIBUTE_INFO;
            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);

            VerifyTransport(smbPacketResponse);
            VerifyCommonMessageSyntax(smbPacketResponse);

            if (response.GetType() == typeof(SmbErrorResponsePacket))
            {
                SmbErrorResponsePacket smbErrorResponsePacket = response as SmbErrorResponsePacket;
                NamespaceCifs.SmbHeader smbErrorHeader = smbErrorResponsePacket.SmbHeader;

                if (smbErrorHeader.Status == (uint)MessageStatus.StatusInvalidInfoClass)
                {
                    smbErrorHeader.Status = (uint)MessageStatus.NotSupported;
                }
                this.ErrorResponse(smbErrorHeader.Mid + this.addMidMark, (MessageStatus)smbErrorHeader.Status);
            }
            else
            {
                SmbTrans2QueryFsInformationResponsePacket smbTrans2QueryFsInformationPacket
                    = response as SmbTrans2QueryFsInformationResponsePacket;

                NamespaceCifs.SmbHeader trans2QueryFsInformationResponseHeader =
                    smbTrans2QueryFsInformationPacket.SmbHeader;

                this.Trans2QueryFsInfoResponse(
                    trans2QueryFsInformationResponseHeader.Mid + this.addMidMark,
                    this.QueryUidTable(smbPacketResponse),
                    this.QueryTidTable(smbPacketResponse),
                    (smbPacketResponse).IsSignRequired,
                    (MessageStatus)trans2QueryFsInformationResponseHeader.Status);
            }

            #endregion
        }
        /// <summary>
        /// find the transaction2 packet.
        /// </summary>
        /// <param name="command">the command of transaction2 packet.</param>
        /// <returns>the target transaction2 packet</returns>
        private static SmbPacket FindTheTrans2Packet(Trans2SubCommand command)
        {
            SmbPacket smbPacket = null;
            switch ((Trans2SubCommand)command)
            {
                case Trans2SubCommand.TRANS2_FIND_FIRST2:
                    smbPacket = new SmbTrans2FindFirst2RequestPacket();
                    break;

                case Trans2SubCommand.TRANS2_FIND_NEXT2:
                    smbPacket = new SmbTrans2FindNext2RequestPacket();
                    break;

                case Trans2SubCommand.TRANS2_QUERY_FS_INFORMATION:
                    smbPacket = new SmbTrans2QueryFsInformationRequestPacket();
                    break;

                case Trans2SubCommand.TRANS2_SET_FS_INFORMATION:
                    smbPacket = new SmbTrans2SetFsInformationRequestPacket();
                    break;

                case Trans2SubCommand.TRANS2_QUERY_PATH_INFORMATION:
                    smbPacket = new SmbTrans2QueryPathInformationRequestPacket();
                    break;

                case Trans2SubCommand.TRANS2_SET_PATH_INFORMATION:
                    smbPacket = new SmbTrans2SetPathInformationRequestPacket();
                    break;

                case Trans2SubCommand.TRANS2_QUERY_FILE_INFORMATION:
                    smbPacket = new SmbTrans2QueryFileInformationRequestPacket();
                    break;

                case Trans2SubCommand.TRANS2_SET_FILE_INFORMATION:
                    smbPacket = new SmbTrans2SetFileInformationRequestPacket();
                    break;

                case Trans2SubCommand.TRANS2_GET_DFS_REFERRAL:
                    smbPacket = new SmbTrans2GetDfsReferralRequestPacket();
                    break;

                default:
                    break;
            }
            return smbPacket;
        }