WdfRequestIsCanceled function (wdfrequest.h)
[Applies to KMDF and UMDF]
The WdfRequestIsCanceled method determines whether the I/O manager has attempted to cancel a specified I/O request.
Syntax
BOOLEAN WdfRequestIsCanceled(
[in] WDFREQUEST Request
);
Parameters
[in] Request
A handle to a framework request object.
Return value
WdfRequestIsCanceled returns TRUE if the I/O manager has attempted to cancel the specified I/O request. This method may return TRUE even if the calling driver does not own the request. If the driver does not own the request, it should not call WdfRequestIsCanceled. See additional information in Remarks.
WdfRequestIsCanceled returns FALSE for one of the following reasons:
- The I/O manager has not attempted to cancel the request.
- The calling driver does not own the request.
- The calling driver has called the WdfRequestMarkCancelable or WdfRequestMarkCancelableEx method.
A bug check occurs if the driver supplies an invalid object handle.
Remarks
If your driver has not called WdfRequestMarkCancelable or WdfRequestMarkCancelableEx to register an EvtRequestCancel callback function, but if you want your driver to determine if the I/O manager has attempted to cancel an I/O request, the driver can call WdfRequestIsCanceled.
If the driver has called WdfRequestMarkCancelable or WdfRequestMarkCancelableEx, it must call WdfRequestUnmarkCancelable before calling WdfRequestIsCanceled.
A driver can call WdfRequestIsCanceled for a request only if the driver owns the I/O request.
If WdfRequestIsCanceled returns TRUE, your driver should cancel the request by calling WdfRequestComplete with a Status parameter of STATUS_CANCELLED. If the driver attempts to complete a request that it does not own, the driver can cause the system to crash.
For more information about WdfRequestIsCanceled, see Canceling I/O Requests
Examples
The following code example calls WdfRequestComplete if WdfRequestIsCanceled returns TRUE.
if (WdfRequestIsCanceled(request)) {
WdfRequestComplete(
request,
STATUS_CANCELLED
);
}
Requirements
Requirement | Value |
---|---|
Target Platform | Universal |
Minimum KMDF version | 1.0 |
Minimum UMDF version | 2.0 |
Header | wdfrequest.h (include Wdf.h) |
Library | Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF) |
IRQL | <=DISPATCH_LEVEL |
DDI compliance rules | DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf), ReqIsCancOnCancReq(kmdf) |