3.2.4.20.12 Application Requests Extent Duplication

The application provides the following:

  • SourceHandle: A handle to the Open identifying a source file from which the extent is to be copied.

  • TargetHandle: A handle to the Open identifying a file on which to issue the operation.

  • SourceOffset: The file offset, in bytes, of the start of a range of bytes in a file from which the data is to be copied.

  • DestinationOffset: The file offset, in bytes, of the start of a range of bytes in a file to which the data is to be copied.

  • ByteCount: The number of bytes to copy from source to target.

If the SourceHandle or TargetHandle is invalid, or if no Open referenced by these handles is found, the client MUST return an implementation-specific error code. If these handles are valid and the Open is found, the client MUST proceed as follows:

  • 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 TreeConnect.Session.SessionId of the Open referenced by TargetHandle.

  • The TreeId field is set to TreeConnect.TreeConnectId of the Open referenced by TargetHandle.

The SMB2 IOCTL Request MUST be initialized as specified in section 2.2.31, with the exception of the following values:

  • The CtlCode field is set to FSCTL_DUPLICATE_EXTENTS_TO_FILE.

  • The FileId field is set to the FileID of the Open referenced by TargetHandle.

  • The MaxInputResponse field is set to 0.

  • The MaxOutputResponse field is set to 0.

  • SMB2_0_IOCTL_IS_FSCTL is set to TRUE in the Flags field.

  • The Buffer field is set to an SMB2_DUPLICATE_EXTENTS_DATA Request, as specified in [MS-FSCC] section 2.3.7.2:

    • SourceFileID is set to the FileID of the Open referenced by SourceHandle.

    • SourceFileOffset is set to the application-provided SourceOffset.

    • DestinationFileOffset is set to the application-provided DestinationOffset.

    • ByteCount is set to the application-provided ByteCount.

  • The InputOffset field is set to the offset to the Buffer, in bytes, from the beginning of the SMB2 header.

  • The InputCount field is set to the size, in bytes, of the Buffer field.

The request MUST be sent to the server.