3.2.4.20.2.2 Application Requests a Server Side Data Copy
The application provides:
A handle to the Open identifying the destination file.
The FSCTL code for the server side copy, either FSCTL_SRV_COPYCHUNK or FSCTL_SRV_COPYCHUNK_WRITE.<165>
The key for the source file queried, as specified in the previous section "Application Requests a Source File Key".
An array of ranges to copy. Each item in the array MUST contain the source offset, the destination offset, and the number of bytes to copy.
If the handle is invalid, or if no Open referenced by the handle is found, the client MUST return an implementation-specific error code. If the handle is valid and Open is found, the client MUST proceed as follows.
For the specified Open, the client MUST select a connection as specified in section 3.2.4.1.7. If no connection is available, the client MUST fail the FSCTL operation.
Otherwise, the client initializes an SMB2 IOCTL Request following the syntax specified in section 2.2.31. The SMB2 header MUST be initialized as follows:
The Command field is set to SMB2 IOCTL.
The MessageId field is set as specified in section 3.2.4.1.3.
The SessionId field is set to Open.TreeConnect.Session.SessionId.
The TreeId field is set to Open.TreeConnect.TreeConnectId.
The SMB2 IOCTL Request MUST be initialized as follows:
The CtlCode field MUST be set to the FSCTL code supplied by the application.
The FileId field is set to Open.FileId.
The Buffer field is set to an SRV_COPYCHUNK_COPY Request, as specified in section 2.2.31.1.
The SourceKey field is set to the key of the source file.
For each range to be copied, the client initializes the Chunks field following the syntax specified in section 2.2.31.1.1 using the application provided source offset, destination offset, and length, in bytes.
The ChunkCount is set to the number of chunks being sent.
The InputOffset field is set to the offset to the Buffer, in bytes, from the beginning of the SMB2 header.
The InputCount is set to the size, in bytes, of the Buffer field.
The OutputOffset field SHOULD<166> be set to zero.
The OutputCount field is set to 0.
The MaxInputResponse field is set to 0.
The MaxOutputResponse field is set to the size of a SRV_COPYCHUNK_RESPONSE structure, as specified in section 2.2.32.1.
SMB2_0_IOCTL_IS_FSCTL is set to TRUE in the Flags field.
The request MUST be sent to the server.