CompletionRoutine
Windows Driver Kit: Kernel-Mode Driver Framework
CompletionRoutine

A driver's CompletionRoutine event callback function executes when another driver completes a specified I/O request.

EVT_WDF_REQUEST_COMPLETION_ROUTINE  CompletionRoutine;

VOID
  CompletionRoutine (
    IN WDFREQUEST  Request,
    IN WDFIOTARGET  Target,
    IN PWDF_REQUEST_COMPLETION_PARAMS  Params,
    IN WDFCONTEXT  Context
    )
  {…}

You must declare the function by using the EVT_WDF_REQUEST_COMPLETION_ROUTINE type. For more information, see the following Example section.

Parameters

Request
A handle to a framework request object that represents the completed I/O request.
Target
A handle to an I/O target object that represents the I/O target that completed the request.
Params
A pointer to a WDF_REQUEST_COMPLETION_PARAMS structure that contains information about the completed request.
Context
Driver-supplied context information, which the driver specified in a previous call to WdfRequestSetCompletionRoutine.

Return Value

None

Comments

To register a CompletionRoutine callback function for an I/O request, a driver must call WdfRequestSetCompletionRoutine. For more information about this callback function, see Completing I/O Requests.

Example

To define a CompletionRoutine callback function that is named MyCompletionRoutine, you must first provide a function declaration that SDV and other verification tools require, as follows:

EVT_WDF_REQUEST_COMPLETION_ROUTINE  MyCompletionRoutine;

Then, implement your callback function as follows:

VOID
  MyCompletionRoutine (
    IN WDFREQUEST  Request,
    IN WDFIOTARGET  Target,
    IN PWDF_REQUEST_COMPLETION_PARAMS  Params,
    IN WDFCONTEXT  Context
    )
  {…}

Requirements

Versions: The CompletionRoutine event callback is supported by version 1.0 and later versions of KMDF.

IRQL: <=DISPATCH_LEVEL

Headers: Defined in Wdfrequest.h, as follows:

typedef VOID
  (EVT_WDF_REQUEST_COMPLETION_ROUTINE)(
    IN WDFREQUEST  Request,
    IN WDFIOTARGET  Target,
    IN PWDF_REQUEST_COMPLETION_PARAMS  Params,
    IN WDFCONTEXT  Context
    );

Include Wdf.h.

See Also

WdfRequestSetCompletionRoutine, WDF_REQUEST_COMPLETION_PARAMS


Send feedback on this topic
Built on November 19, 2009
Page view tracker