Expand Minimize

CompletionRoutine function

[Applies to KMDF and UMDF]

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

Syntax


EVT_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine;

void CompletionRoutine(
  _In_  WDFREQUEST Request,
  _In_  WDFIOTARGET Target,
  _In_  PWDF_REQUEST_COMPLETION_PARAMS Params,
  _In_  WDFCONTEXT Context
)
{ ... }

Parameters

Request [in]

A handle to a framework request object that represents the completed I/O request.

Target [in]

A handle to an I/O target object that represents the I/O target that completed the request.

Params [in]

A pointer to a WDF_REQUEST_COMPLETION_PARAMS structure that contains information about the completed request.

Context [in]

Driver-supplied context information, which the driver specified in a previous call to WdfRequestSetCompletionRoutine.

Return value

None

Remarks

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.

Note that the completion parameters structure contains valid information only if the driver has formatted the request by calling one of the WdfIoTargetFormatXxx methods. For an example, see WdfIoTargetFormatRequestForRead.

Examples

The function type is declared 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
    );


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

Minimum KMDF version

1.0

Minimum UMDF version

2.0

Header

Wdfrequest.h (include Wdf.h)

IRQL

<=DISPATCH_LEVEL

See also

WdfRequestSetCompletionRoutine
WDF_REQUEST_COMPLETION_PARAMS

 

 

Send comments about this topic to Microsoft

顯示:
© 2014 Microsoft