/// <summary>
        /// FSCTL Bad command request.
        /// </summary>
        /// <param name="messageId">This is used to associate a response with a request.</param>
        /// <param name="sessionId">The current session ID for this connection.</param>
        /// <param name="treeId">The tree ID for the corrent share connection.</param>
        /// <param name="isSigned">Indicate whether the message is signed or not for this response.</param>
        /// <param name="fid">The file identifier.</param>
        /// <param name="command">This is used to tell the adapter to send an invalid kind of command.</param>
        public void FsctlBadCommandRequest(
            int messageId,
            int sessionId,
            int treeId,
            bool isSigned,
            int fid,
            FsctlInvalidCommand command)
        {
            #region Create Packet

            NamespaceCifs.SmbNtTransactIoctlRequestPacket smbPacket = new NamespaceCifs.SmbNtTransactIoctlRequestPacket();

            ushort uid = (ushort)this.uId[(uint)sessionId];
            uint functionCode = (uint)command;
            byte[] data = new byte[DataCount];

            smbPacket = this.smbClientStack.CreateNTTransIOCtlRequest(
                (ushort)this.fId[(uint)fid],
                true,
                byte.MinValue,
                functionCode,
                data);

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

            SmbErrorResponsePacket smbErrorResponsePacket = response as SmbErrorResponsePacket;
            NamespaceCifs.SmbHeader smbErrorHeader = smbErrorResponsePacket.SmbHeader;
            this.ErrorResponse(smbErrorHeader.Mid + this.addMidMark, (MessageStatus)smbErrorHeader.Status);

            #endregion
        }
        public void FSCCFSCTLNameRequest(int messageId,
            int sessionId,
            int treeId,
            bool isSigned,
            int fid,
            FSCCFSCTLName fsctlName)
        {
            #region Create Packet

            NamespaceCifs.SmbNtTransactIoctlRequestPacket smbPacket = new NamespaceCifs.SmbNtTransactIoctlRequestPacket();

            ushort uid = (ushort)this.uId[(uint)sessionId];
            uint functionCode = (uint)fsctlName;
            byte[] data = new byte[DataCount];
            this.fsccFSCTLName = fsctlName.ToString();

            smbPacket = this.smbClientStack.CreateNTTransIOCtlRequest(
                (ushort)this.fId[(uint)fid],
                true,
                byte.MinValue,
                functionCode,
                data);

            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;
                this.ErrorResponse(
                    smbErrorHeader.Mid + this.addMidMark,
                    (MessageStatus)smbErrorHeader.Status);
            }
            else
            {
                NamespaceCifs.SmbNtTransactIoctlResponsePacket smbNtTransactIoctlResponsePacket
                    = response as SmbNtTransactIoctlResponsePacket;

                NamespaceCifs.SmbHeader ntTransactIoctlResponseHeader = smbNtTransactIoctlResponsePacket.SmbHeader;

                VerifyMessageSyntaxFsctlNameResponse(smbNtTransactIoctlResponsePacket);

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

            #endregion
        }