WdfRequestComplete method
[Applies to KMDF and UMDF]
The WdfRequestComplete method completes a specified I/O request and supplies a completion status.
Syntax
VOID WdfRequestComplete( [in] WDFREQUEST Request, [in] NTSTATUS Status );
Parameters
- Request [in]
-
A handle to the framework request object that represents the I/O request that is being completed.
- Status [in]
-
An NTSTATUS value that represents the completion status of the request. Valid status values include, but are not limited to, the following:
Return value
None.
A bug check occurs if the driver supplies an invalid object handle.
Remarks
After a driver calls WdfRequestComplete, higher-level drivers on the driver stack can call WdfRequestGetStatus to obtain the completion status value that was specified for the Status parameter. Typically, drivers call WdfRequestGetStatus from within a CompletionRoutine callback function.
After a call to WdfRequestComplete returns, the request handle is no longer valid unless the driver has called WdfObjectReference to add one or more additional reference counts to the request object. Note that after WdfRequestComplete returns, the driver must not attempt to access the associated WDM IRP structure, even if it has called WdfObjectReference.
Instead of calling WdfRequestComplete, the driver can call WdfRequestCompleteWithInformation or WdfRequestCompleteWithPriorityBoost.
When your driver calls WdfRequestComplete, the framework supplies a default value that the system uses to boost the run-time priority of the thread that requested the I/O operation. For information about default priority boost values, see Specifying Priority Boosts When Completing I/O Requests. Your driver can call WdfRequestCompleteWithPriorityBoost to override the default priority boost value.
For more information about calling WdfRequestComplete, see Completing I/O Requests.
Examples
The following code example is a section of a request handler. The request handler accepts only read and write requests, and it completes a each request with an error status if the request type is not read or write.
VOID MyEvtIoDefault( IN WDFQUEUE Queue, IN WDFREQUEST Request ) { WDF_REQUEST_PARAMETERS params; WDF_DMA_DIRECTION direction; ... WDF_REQUEST_PARAMETERS_INIT(¶ms); WdfRequestGetParameters( Request, ¶ms ); // // Validate and gather parameters. // switch (params.Type) { case WdfRequestTypeRead: length = params.Parameters.Read.Length; direction = WdfDmaDirectionReadFromDevice; break; case WdfRequestTypeWrite: length = params.Parameters.Write.Length; direction = WdfDmaDirectionWriteToDevice; break; default: WdfRequestComplete( Request, STATUS_INVALID_DEVICE_REQUEST ); return; } ... }
Requirements
See also
- WDF_REQUEST_PARAMETERS
- WDF_REQUEST_PARAMETERS_INIT
- WdfObjectReference
- WdfRequestCompleteWithInformation
- WdfRequestCompleteWithPriorityBoost
- WdfRequestGetStatus