public void TraditionalTestCase_IgnoreFields_CopyChunk_05()
        {
            #region Connect to the specified server

            smbClientStack.Connect(serverName, serverPort, ipVersion, bufferSize);

            #endregion

            #region Send the Negotiate request

            // Create a SMB_COM_NEGOTIATE request.
            SmbNegotiateRequestPacket negotiateRequest =
                smbClientStack.CreateNegotiateRequest(
                StackSmb.SignState.NONE,
                new string[] {
                    DialectNameString.PCNET1,
                    DialectNameString.LANMAN10,
                    DialectNameString.WFW10,
                    DialectNameString.LANMAN12,
                    DialectNameString.LANMAN21,
                    DialectNameString.NTLANMAN
                });

            // Send the SMB_COM_NEGOTIATE request and expect the response in timeout milliseconds.
            smbClientStack.SendPacket(negotiateRequest);
            StackPacket response = smbClientStack.ExpectPacket(timeout);

            // Check whether server return a response.
            Site.Assert.IsNotNull(
                response,
                "SMB_COM_NEGOTIATE response should not be null.");

            // Check whether server returns a SMB_COM_NEGOTIATE response.
            Site.Assert.IsInstanceOfType(
                response,
                typeof(SmbNegotiateResponsePacket),
                "SMB_COM_NEGOTIATE response should be received.");

            // Check the response validity by verifying the Status field in the SMB Header packet.
            SmbNegotiateResponsePacket negotiateResponse = (SmbNegotiateResponsePacket)response;
            Site.Assert.AreEqual<uint>(
                (uint)SmbStatus.STATUS_SUCCESS,
                negotiateRequest.SmbHeader.Status,
                "SMB_COM_NEGOTIATE response status should be SUCCESS.");

            #endregion

            #region Send the first SMB_COM_SESSION_SETUP_ANDX  Request

            SmbSecurityPackage smbSecurityPackage = (SmbSecurityPackage)Enum.Parse(
                typeof(SmbSecurityPackage),
                Site.Properties["SmbSecurityPackageType"] as string,
                true);

            // Create the first SMB_COM_SESSION_SETUP_ANDX request.
            SmbSessionSetupAndxRequestPacket sessionSetupAndxRequest =
                smbClientStack.CreateFirstSessionSetupRequest(
                smbSecurityPackage,
                serverName,
                domainName,
                userName,
                password);

            // Send the first SMB_COM_SESSION_SETUP_ANDX request and expect the response in timeout milliseconds.
            smbClientStack.SendPacket(sessionSetupAndxRequest);
            response = smbClientStack.ExpectPacket(timeout);

            // Check whether server return a response.
            Site.Assert.IsNotNull(
                response,
                "SMB_COM_SESSION_SETUP_ANDX response should not be null.");

            // Check whether server returns a the SMB_COM_SESSION_SETUP_ANDX response.
            Site.Assert.IsInstanceOfType(
                response,
                typeof(SmbSessionSetupAndxResponsePacket),
                "SMB_COM_SESSION_SETUP_ANDX response should be received.");

            // Check the response validity by verifying the Status field in the SMB Header packet.
            // If SMB SecurityPackage type is NTLM, the expected SUCCESS response status is STATUS_MORE_PROCESSING_REQUIRED,
            // else if SMB SecurityPackage type is Kerberos, the expected SUCCESS response status is STATUS_SUCCESS.
            SmbSessionSetupAndxResponsePacket sessionSetupResponse = (SmbSessionSetupAndxResponsePacket)response;
            Site.Assert.IsTrue(
                (int)sessionSetupResponse.SmbHeader.Status == (int)SmbStatus.STATUS_MORE_PROCESSING_REQUIRED ||
                (int)sessionSetupResponse.SmbHeader.Status == (int)SmbStatus.STATUS_SUCCESS,
                "SMB_COM_SESSION_SETUP_ANDX response status should be SUCCESS.");

            #endregion

            #region Send the second SMB_COM_SESSION_SETUP_ANDX  request

            // Create the second SMB_COM_SESSION_SETUP_ANDX request.
            ushort sessionUid = sessionSetupResponse.SmbHeader.Uid;

            if ((int)sessionSetupResponse.SmbHeader.Status == (int)SmbStatus.STATUS_MORE_PROCESSING_REQUIRED)
            {
                SmbSessionSetupAndxRequestPacket secondSessionSetupRequest =
                    smbClientStack.CreateSecondSessionSetupRequest(sessionUid, smbSecurityPackage);

                // Send the second SMB_COM_SESSION_SETUP_ANDX request and expect the response in timeout milliseconds.
                smbClientStack.SendPacket(secondSessionSetupRequest);
                response = smbClientStack.ExpectPacket(timeout);

                // Check whether server return a response.
                Site.Assert.IsNotNull(
                    response,
                    "SMB_COM_SESSION_SETUP_ANDX response should not be null.");

                // Check whether server returns a the SMB_COM_SESSION_SETUP_ANDX response.
                Site.Assert.IsInstanceOfType(
                    response,
                    typeof(SmbSessionSetupAndxResponsePacket),
                    "SMB_COM_SESSION_SETUP_ANDX response should be received.");

                // Check the response validity by verifying the Status field in the SMB Header packet.
                sessionSetupResponse = (SmbSessionSetupAndxResponsePacket)response;
                Site.Assert.AreEqual<uint>(
                    (uint)SmbStatus.STATUS_SUCCESS,
                    sessionSetupResponse.SmbHeader.Status,
                    "SMB_COM_SESSION_SETUP_ANDX response status should be SUCCESS.");
            }

            #endregion

            #region Send the SMB_COM_TREE_CONNECT_ANDX request

            string path = Site.Properties["SutNtfsShare1FullName"];

            SmbTreeConnectAndxRequestPacket treeconnectRequest =
            smbClientStack.CreateTreeConnectRequest(sessionUid, path);

            smbClientStack.SendPacket(treeconnectRequest);
            response = smbClientStack.ExpectPacket(timeout);

            SmbTreeConnectAndxResponsePacket treeConnectResponse = (SmbTreeConnectAndxResponsePacket)response;
            #endregion

            #region Send the NT_CREATE_ANDX request

            ushort treeId = treeConnectResponse.SmbHeader.Tid;
            string fileName = Site.Properties["SutShareTest1"];
            smbClientStack.Capability.Flag |= SmbHeader_Flags_Values.OPLOCK;

            SmbNtCreateAndxRequestPacket createRequest =
                smbClientStack.CreateCreateRequest(
                treeId,
                fileName,
                StackCifs.NtTransactDesiredAccess.FILE_READ_DATA
                | StackCifs.NtTransactDesiredAccess.FILE_READ_EA
                | StackCifs.NtTransactDesiredAccess.FILE_READ_ATTRIBUTES
                | StackCifs.NtTransactDesiredAccess.FILE_WRITE_DATA,
                StackCifs.SMB_EXT_FILE_ATTR.NONE,
                StackCifs.NtTransactShareAccess.FILE_SHARE_READ
                | StackCifs.NtTransactShareAccess.FILE_SHARE_DELETE,
                StackCifs.NtTransactCreateDisposition.FILE_OPEN_IF,
                NtTransactCreateOptions.FILE_OPEN_REPARSE_POINT
                | NtTransactCreateOptions.FILE_SEQUENTIAL_ONLY
                | NtTransactCreateOptions.FILE_NON_DIRECTORY_FILE,
                StackCifs.NtTransactImpersonationLevel.SEC_ANONYMOUS,
                CreateFlags.NT_CREATE_REQUEST_OPLOCK);

            smbClientStack.SendPacket(createRequest);
            response = smbClientStack.ExpectPacket(timeout);

            #endregion

            #region Send the NT_CREATE_ANDX request

            SmbNtCreateAndxResponsePacket createResponse = (SmbNtCreateAndxResponsePacket)response;
            ushort fileId1 = createResponse.SmbParameters.FID;
            uint offset = uint.Parse(Site.Properties["SmbTransportWriteOffset"].ToString());
            byte[] writeData = new byte[17000];

            for (int i = 0; i < writeData.Length; i++)
            {
                writeData[i] = (byte)'a';
            }

            SmbWriteAndxRequestPacket writeRequest = smbClientStack.CreateWriteRequest(fileId1, offset, writeData);

            smbClientStack.SendPacket(writeRequest);
            response = smbClientStack.ExpectPacket(timeout);

            #endregion

            #region Send the WRITE_ANDX request

            SmbWriteAndxResponsePacket writeAndxResponsePacket = response as SmbWriteAndxResponsePacket;
            string fileName2 = Site.Properties["SutShareTest2"];

            SmbNtCreateAndxRequestPacket createSecondRequest =
                smbClientStack.CreateCreateRequest(
                treeId,
                fileName2,
                StackCifs.NtTransactDesiredAccess.FILE_READ_DATA
                | StackCifs.NtTransactDesiredAccess.FILE_WRITE_DATA
                | StackCifs.NtTransactDesiredAccess.FILE_APPEND_DATA,
                StackCifs.SMB_EXT_FILE_ATTR.NONE,
                StackCifs.NtTransactShareAccess.FILE_SHARE_WRITE
                | StackCifs.NtTransactShareAccess.FILE_SHARE_DELETE,
                StackCifs.NtTransactCreateDisposition.FILE_OPEN_IF,
                NtTransactCreateOptions.FILE_OPEN_REPARSE_POINT
                | NtTransactCreateOptions.FILE_SEQUENTIAL_ONLY
                | NtTransactCreateOptions.FILE_NON_DIRECTORY_FILE,
                StackCifs.NtTransactImpersonationLevel.SEC_ANONYMOUS,
                CreateFlags.NT_CREATE_REQUEST_OPBATCH);

            smbClientStack.SendPacket(createSecondRequest);
            response = smbClientStack.ExpectPacket(timeout);

            #endregion

            #region Send the NT_CREATE_ANDX

            SmbNtCreateAndxResponsePacket createSecondResponse = (SmbNtCreateAndxResponsePacket)response;
            ushort fileId2 = createSecondResponse.SmbParameters.FID;

            SmbNtTransFsctlSrvRequestResumeKeyRequestPacket nTTransIOCtlRequestResumeKeyRequest =
                smbClientStack.CreateNTTransIOCtlRequestResumeKeyRequest(fileId1, true, 0);

            StackCifs.SmbHeader smbHeader = nTTransIOCtlRequestResumeKeyRequest.SmbHeader;
            smbHeader.Uid = sessionUid;
            smbHeader.Tid = treeId;
            nTTransIOCtlRequestResumeKeyRequest.SmbHeader = smbHeader;

            smbClientStack.SendPacket(nTTransIOCtlRequestResumeKeyRequest);
            response = smbClientStack.ExpectPacket(timeout);

            SmbNtTransFsctlSrvRequestResumeKeyResponsePacket nTTransIOCtlRequestResumeKeyResponse =
                (SmbNtTransFsctlSrvRequestResumeKeyResponsePacket)response;

            #endregion

            #region Send the NT_TRANS_IO_CTL request

            bool isFsctl = true;
            byte isFlags = (byte)0;
            byte[] copychunkResumeKey = nTTransIOCtlRequestResumeKeyResponse.NtTransData.ResumeKey;

            nTTransIOCtlRequestResumeKeyRequest =
                smbClientStack.CreateNTTransIOCtlRequestResumeKeyRequest(fileId1, true, 0);

            smbHeader = nTTransIOCtlRequestResumeKeyRequest.SmbHeader;
            smbHeader.Uid = sessionUid;
            smbHeader.Tid = treeId;
            nTTransIOCtlRequestResumeKeyRequest.SmbHeader = smbHeader;

            smbClientStack.SendPacket(nTTransIOCtlRequestResumeKeyRequest);
            response = smbClientStack.ExpectPacket(timeout);

            #endregion

            #region Capture requirement r9074

            nTTransIOCtlRequestResumeKeyResponse =
                (SmbNtTransFsctlSrvRequestResumeKeyResponsePacket)response;
            byte[] copychunkResumeKey2 = nTTransIOCtlRequestResumeKeyResponse.NtTransData.ResumeKey;

            // Compare copychunkResumeKey and copychunkResumeKey2, if same, capture 9074
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-SMB_R9074");

            //
            // Verify MS-SMB requirement: MS-SMB_R9074
            //
            bool isVerifyR9074 = CompareArrayEquals(copychunkResumeKey, copychunkResumeKey2);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR9074,
                9074,
                @"[In Copychunk Resume Key Generation] The generation of Copychunk Resume Keys MUST satisfy the
                following constraints:The Copychunk Resume Key MUST remain valid for the lifetime of the open file
                on the server.");

            #endregion

            #region Send the NT_TRANSACT_COPY_CHUNK_List request

            NT_TRANSACT_COPY_CHUNK_List list = new NT_TRANSACT_COPY_CHUNK_List();
            list.Length = (uint)64;
            list.SourceOffset = (ulong)0;
            list.DestinationOffset = (ulong)0;

            SmbNtTransFsctlSrvCopyChunkRequestPacket nTTransIOCtlCopyChunkRequest =
                smbClientStack.CreateNTTransIOCtlCopyChunkRequest(fileId2, isFsctl, isFlags, copychunkResumeKey, list);

            smbClientStack.SendPacket(nTTransIOCtlCopyChunkRequest);
            response = smbClientStack.ExpectPacket(timeout);

            #endregion

            #region Send the NT_TRANSACT_COPY_CHUNK_Request_NT_Trans_Data request

            SmbNtTransFsctlSrvCopyChunkResponsePacket nTTransIOCtlCopyChunkResponse1 =
                (SmbNtTransFsctlSrvCopyChunkResponsePacket)response;

            list.Length = (uint)64;
            list.SourceOffset = (ulong)0;
            list.DestinationOffset = (ulong)0;
            list.Reserved = 0xFFFF;

            nTTransIOCtlCopyChunkRequest =
                smbClientStack.CreateNTTransIOCtlCopyChunkRequest(fileId2, isFsctl, isFlags, copychunkResumeKey, list);
            NT_TRANSACT_COPY_CHUNK_Request_NT_Trans_Data TransData = nTTransIOCtlCopyChunkRequest.NtTransData;

            TransData.Unused = 0xFFFF;
            nTTransIOCtlCopyChunkRequest.NtTransData = TransData;

            smbClientStack.SendPacket(nTTransIOCtlCopyChunkRequest);
            response = smbClientStack.ExpectPacket(timeout);

            #endregion

            #region Capture requirements R109390

            SmbNtTransFsctlSrvCopyChunkResponsePacket nTTransIOCtlCopyChunkResponse2 =
                (SmbNtTransFsctlSrvCopyChunkResponsePacket)response;

            // Compare 2 copy chunckResponse
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-SMB_R109390");

            //
            // Verify MS-SMB requirement: MS-SMB_R109390
            //
            bool isVerifyR109390 = VerifyResponse(nTTransIOCtlCopyChunkResponse1, nTTransIOCtlCopyChunkResponse2);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR109390,
                109390,
                @"[In  Client Request Extensions]Reserved (4 bytes):
                reply is the same whether zero or non-zero is used this field.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-SMB_R109396");

            //
            // Verify MS-SMB requirement: MS-SMB_R109396
            //
            bool isVerifyR109396 = VerifyResponse(nTTransIOCtlCopyChunkResponse1, nTTransIOCtlCopyChunkResponse2);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR109396,
                109396,
                @"[In SRV_COPYCHUNK]Reserved (4 bytes):
                reply is the same whether zero or non-zero is used in this field.");

            #endregion

            #region Send the SMB_NT_TRANS_FSCTL_SRV request request

            nTTransIOCtlRequestResumeKeyRequest =
                smbClientStack.CreateNTTransIOCtlRequestResumeKeyRequest(fileId2, true, 0);

            smbHeader = nTTransIOCtlRequestResumeKeyRequest.SmbHeader;
            smbHeader.Uid = sessionUid;
            smbHeader.Tid = treeId;
            nTTransIOCtlRequestResumeKeyRequest.SmbHeader = smbHeader;

            smbClientStack.SendPacket(nTTransIOCtlRequestResumeKeyRequest);
            response = smbClientStack.ExpectPacket(timeout);

            #endregion

            #region Capture reuqirements R9073

            nTTransIOCtlRequestResumeKeyResponse =
                (SmbNtTransFsctlSrvRequestResumeKeyResponsePacket)response;

            byte[] copychunkResumeKey3 = nTTransIOCtlRequestResumeKeyResponse.NtTransData.ResumeKey;

            //
            // Add the comment information for debugging
            //
            Site.Log.Add(
                LogEntryKind.Comment,
                @"Verify MS-SMB_R9073");

            //
            // Verify MS-SMB requirement: MS-SMB_R9073
            //
            bool isVerifyR9073 = CompareArrayEquals(copychunkResumeKey, copychunkResumeKey3);

            Site.CaptureRequirementIfIsFalse(
                isVerifyR9073,
                9073,
                @"[In Copychunk Resume Key Generation]
                The generation of Copychunk Resume Keys MUST satisfy the following constraints:
                The Copychunk Resume Key MUST be unique on the SMB server for a given open file on a server.");

            #endregion

            #region Disconnect the tree, session and connection.

            // TreeDisconnect
            SmbTreeDisconnectRequestPacket treeDisconnectRequest =
                smbClientStack.CreateTreeDisconnectRequest(treeId);

            smbClientStack.SendPacket(treeDisconnectRequest);
            response = smbClientStack.ExpectPacket(timeout);

            // Check whether server return a response.
            Site.Assert.IsNotNull(
                response,
                "SMB_COM_TREE_DISCONNECT response should not be null.");

            Site.Assert.IsInstanceOfType(
                response,
                typeof(SmbTreeDisconnectResponsePacket),
                "SMB_COM_TREE_DISCONNECT response should be received.");

            // Check the response validity by verifying the Status field in the SMB Header packet.
            SmbTreeDisconnectResponsePacket treeDisconnectResponse = (SmbTreeDisconnectResponsePacket)response;
            Site.Assert.AreEqual<uint>(
                (uint)SmbStatus.STATUS_SUCCESS,
                treeDisconnectResponse.SmbHeader.Status,
                "SMB_COM_TREE_DISCONNECT response status should be SUCCESS.");

            // LogOff
            SmbLogoffAndxRequestPacket logoffRequest = smbClientStack.CreateLogoffRequest(sessionUid);

            smbClientStack.SendPacket(logoffRequest);
            response = smbClientStack.ExpectPacket(timeout);

            // Check whether server return a response.
            Site.Assert.IsNotNull(
                response,
                "SMB_COM_LOGOFF_ANDX response should not be null.");

            Site.Assert.IsInstanceOfType(
                response,
                typeof(SmbLogoffAndxResponsePacket),
                "SMB_COM_LOGOFF_ANDX response should be received.");

            // Check the response validity by verifying the Status field in the SMB Header packet.
            SmbLogoffAndxResponsePacket logoffResponse = (SmbLogoffAndxResponsePacket)response;
            Site.Assert.AreEqual<uint>(
                (uint)SmbStatus.STATUS_SUCCESS,
                logoffResponse.SmbHeader.Status,
                "SMB_COM_LOGOFF_ANDX response status should be SUCCESS.");

            // Disconnect
            smbClientStack.Disconnect();

            Site.Assert.IsFalse(
               smbClientStack.IsDataAvailable,
               "SmbClient should not receive any packet after Disconnect method is called.");

            #endregion
        }
        /// <summary>
        /// Create NTTransIOCtlCopyChunk request for client to copy chunk to server file. 
        /// </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 = "isFsctl">
        /// This field is TRUE if the command is a file system control command and the FID is a file system control  
        /// device. Otherwise, the command is a device control command and FID is an I/O device. 
        /// </param>
        /// <param name = "isFlags">
        /// If bit 0 is set, the command is to be applied to a share root handle. The share MUST be a Distributed File 
        ///  System (DFS) type 
        /// </param>
        /// <param name = "copychunkResumeKey">
        /// A 24-byte resume key generated by the SMB server that can be subsequently used by the client to uniquely  
        /// identify the open source file in a FSCTL_SRV_COPYCHUNK request. 
        /// </param>
        /// <param name = "list">
        /// A concatenated list of copychunk blocks. This field is as specified in section 2.2.14.7.3.1. 
        /// </param>
        /// <returns>a nt transaction rename request packet </returns>
        /// <exception cref = "ArgumentNullException">list must not be null </exception>
        /// <exception cref = "ArgumentException">
        /// The number of entries in the copychunk list. MUST NOT be 0. 
        /// </exception>
        private SmbNtTransFsctlSrvCopyChunkRequestPacket CreateNTTransIOCtlCopyChunkRequest(
            ushort messageId,
            ushort sessionUid,
            ushort treeId,
            SmbHeader_Flags_Values flags,
            SmbHeader_Flags2_Values flags2,
            ushort fileId,
            bool isFsctl,
            byte isFlags,
            byte[] copychunkResumeKey,
            NT_TRANSACT_COPY_CHUNK_List[] list)
        {
            if (list == null)
            {
                throw new ArgumentNullException("list");
            }

            if (list.Length == 0)
            {
                throw new ArgumentException(
                    "The number of entries in the copychunk list. MUST NOT be 0.", "list");
            }

            SmbNtTransFsctlSrvCopyChunkRequestPacket request = new SmbNtTransFsctlSrvCopyChunkRequestPacket(
                this.cifsClient.CreateNtTransactIoctlRequest(
                messageId, sessionUid, treeId, (SmbFlags)flags, (SmbFlags2)flags2,
                this.capability.MaxSetupCount, this.capability.MaxParameterCount, this.capability.MaxDataCount,
                (uint)NtTransFunctionCode.FSCTL_SRV_COPYCHUNK, fileId, isFsctl, isFlags, null));

            // update the copy chunk trans data.
            NT_TRANSACT_COPY_CHUNK_Request_NT_Trans_Data ntTransData = request.NtTransData;

            ntTransData.CopyChunkResumeKey = copychunkResumeKey;
            ntTransData.ChunkCount = (uint)list.Length;
            ntTransData.List = list;

            request.NtTransData = ntTransData;

            request.UpdateCountAndOffset();

            return request;
        }
        /// <summary>
        /// NT_TRANSACT_IOCTL Client Request.
        /// </summary>
        /// <param name="messageId">Message ID used to identify the message.</param>
        /// <param name="sessionId">Session ID used to identify the session.</param>
        /// <param name="treeId">Tree ID used to identify the tree connection.</param>
        /// <param name="isSigned">
        /// Indicate whether the SUT has message signing enabled or required.
        /// </param>
        /// <param name="fid">The file identifier.</param>
        /// <param name="copychunkResumeKeysize">The server resume key for a source file.</param>
        /// <param name="sourceOffset">The offset in the source file to copy from.</param>
        /// <param name="targetOffset">The offset in the target file to copy to.</param>
        /// <param name="length">The number of bytes to copy from the source file to the target file.</param>
        public void FsctlSrvCopyChunkRequest(
            int messageId,
            int sessionId,
            int treeId,
            bool isSigned,
            int fid,
            string copychunkResumeKeysize,
            int sourceOffset,
            int targetOffset,
            int length)
        {
            #region Create Packet

            SmbNtTransFsctlSrvCopyChunkRequestPacket smbPacket = new SmbNtTransFsctlSrvCopyChunkRequestPacket();
            ushort uid = (ushort)this.uId[(uint)sessionId];

            byte[] copyChunkResumeKey = null;
            if (copychunkResumeKeysize == CopyChunkResumeKey)
            {
                copyChunkResumeKey = SmbAdapter.resumeKey;
            }
            else
            {
                copyChunkResumeKey = new byte[24];
                for (int i = 0; i < 24; i++)
                {
                    copyChunkResumeKey[i] = 0x10;
                }
            }

            byte isFlags = byte.MinValue;
            NT_TRANSACT_COPY_CHUNK_List list = new NT_TRANSACT_COPY_CHUNK_List();
            list.Length = (uint)this.copyWordCount;
            list.SourceOffset = (ulong)sourceOffset;
            list.DestinationOffset = (ulong)targetOffset;

            smbPacket = this.smbClientStack.CreateNTTransIOCtlCopyChunkRequest(
                (ushort)this.fId[(uint)fid],
                true,
                isFlags,
                copyChunkResumeKey,
                list);

            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
            {
                SmbNtTransFsctlSrvCopyChunkResponsePacket smbFsctlSrvCopyChunkPacket
                    = response as SmbNtTransFsctlSrvCopyChunkResponsePacket;

                NamespaceCifs.SmbHeader ntTransFsctlSrvCopyChunkResponseHeader = smbFsctlSrvCopyChunkPacket.SmbHeader;

                VerifyMessageSyntaxFsctlSrvCopychunkResponse(smbFsctlSrvCopyChunkPacket);

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

            #endregion
        }