PCOPYFILE2_PROGRESS_ROUTINE callback function (winbase.h)

An application-defined callback function used with the CopyFile2 function. It is called when a portion of a copy or move operation is completed. The PCOPYFILE2_PROGRESS_ROUTINE type defines a pointer to this callback function. CopyFile2ProgressRoutine is a placeholder for the application-defined function name.

Syntax

PCOPYFILE2_PROGRESS_ROUTINE Pcopyfile2ProgressRoutine;

COPYFILE2_MESSAGE_ACTION Pcopyfile2ProgressRoutine(
  [in]           const COPYFILE2_MESSAGE *pMessage,
  [in, optional] PVOID pvCallbackContext
)
{...}

Parameters

[in] pMessage

Pointer to a COPYFILE2_MESSAGE structure.

[in, optional] pvCallbackContext

Copy of value passed in the pvCallbackContext member of the COPYFILE2_EXTENDED_PARAMETERS structure passed to CopyFile2.

Return value

Value from the COPYFILE2_MESSAGE_ACTION enumeration indicating what action should be taken.

Return code/value Description
COPYFILE2_PROGRESS_CONTINUE
0
Continue the copy operation.
COPYFILE2_PROGRESS_CANCEL
1
Cancel the copy operation. The CopyFile2 function will fail, return HRESULT_FROM_WIN32(ERROR_REQUEST_ABORTED) and any partially copied fragments will be deleted.
COPYFILE2_PROGRESS_STOP
2
Stop the copy operation. The CopyFile2 function will fail, return HRESULT_FROM_WIN32(ERROR_REQUEST_ABORTED) and any partially copied fragments will be left intact. The operation can be restarted using the COPY_FILE_RESUME_FROM_PAUSE flag only if COPY_FILE_RESTARTABLE was set in the dwCopyFlags member of the COPYFILE2_EXTENDED_PARAMETERS structure passed to the CopyFile2 function.
COPYFILE2_PROGRESS_QUIET
3
Continue the copy operation but do not call the CopyFile2ProgressRoutine callback function again for this operation.
COPYFILE2_PROGRESS_PAUSE
4
Pause the copy operation. In most cases the CopyFile2 function will fail and return HRESULT_FROM_WIN32(ERROR_REQUEST_PAUSED) and any partially copied fragments will be left intact (except for the header written that is used to resume the copy operation later.) In case the copy operation was complete at the time the pause request is processed the CopyFile2 call will complete successfully and no resume header will be written.

Remarks

The COPYFILE2_CALLBACK_STREAM_FINISHED message is the last message for a paused copy. If COPYFILE2_PROGRESS_PAUSE is returned in response to a COPYFILE2_CALLBACK_STREAM_FINISHED message then no further callbacks will be sent.

To compile an application that uses the PCOPYFILE2_PROGRESS_ROUTINE function pointer type, define the _WIN32_WINNT macro as 0x0601 or later. For more information, see Using the Windows Headers.

In Windows 8 and Windows Server 2012, this function is supported by the following technologies.

Technology Supported
Server Message Block (SMB) 3.0 protocol Yes
SMB 3.0 Transparent Failover (TFO) Yes
SMB 3.0 with Scale-out File Shares (SO) Yes
Cluster Shared Volume File System (CsvFS) Yes
Resilient File System (ReFS) Yes

Requirements

Requirement Value
Minimum supported client Windows 8 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 [desktop apps | UWP apps]
Target Platform Windows
Header winbase.h (include Windows.h)