// wdfrequest.h
VOID WdfRequestSetCompletionRoutine(
[in] WDFREQUEST Request,
[in, optional] PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine,
[in, optional] __drv_aliasesMem WDFCONTEXT CompletionContext
);
View the official Windows Driver Kit DDI reference
No description available.
[Applies to KMDF and UMDF]
The WdfRequestSetCompletionRoutine method registers or deregisters a completion routine for the specified framework request object.
Request
[in]A handle to a framework request object.
CompletionRoutine
[in, optional]A pointer to a CompletionRoutine callback function, if the driver is registering a completion routine, or NULL of the driver is deregistering a previously registered completion routine.
CompletionContext
[in, optional]An untyped pointer to driver-defined context information that the framework passes to the CompletionRoutine callback function. This parameter is optional and can be NULL.
A bug check occurs if the driver supplies an invalid object handle.
If your driver forwards I/O requests, but if you want your driver to be notified when a lower-level driver completes the request, your driver can provide a CompletionRoutine callback function and call WdfRequestSetCompletionRoutine to register the function. The framework calls the callback function after a lower-level driver completes the I/O request.
If the driver sets an I/O completion callback, the driver must format the request before sending it to the default I/O target even if the driver does not change any of the parameters in the request. Formatting can be done using WdfRequestFormatRequestUsingCurrentType.
For more information about WdfRequestSetCompletionRoutine, see Completing I/O Requests.
For a code example that uses WdfRequestSetCompletionRoutine, see WdfRequestSend.