WdfDpcCancel function (wdfdpc.h)
[Applies to KMDF only]
The WdfDpcCancel method attempts to cancel the execution of a DPC object's scheduled EvtDpcFunc callback function.
Syntax
BOOLEAN WdfDpcCancel(
[in] WDFDPC Dpc,
[in] BOOLEAN Wait
);
Parameters
[in] Dpc
A handle to a framework DPC object.
[in] Wait
A Boolean value that, if TRUE, indicates that the WdfDpcCancel method will not return until the DPC object's EvtDpcFunc callback function is either canceled or finishes executing. If FALSE, the WdfDpcCancel method returns immediately.
Return value
WdfDpcCancel returns TRUE if the specified DPC object's EvtDpcFunc callback function was in the system's DPC queue. The method returns FALSE if the callback function was not in the DPC queue, either because the callback function was executing or because it had finished executing.
A bug check occurs if the driver supplies an invalid object handle.
Remarks
If the specified DPC object's EvtDpcFunc callback function is in the system's DPC queue, it is removed from the queue. If the EvtDpcFunc function is not in the queue, it is either executing or has finished executing.
If the Wait parameter is TRUE, WdfDpcCancel must be called at IRQL = PASSIVE_LEVEL. If the Wait parameter is FALSE, WdfDpcCancel can be called at any IRQL.
Examples
The following code example cancels the execution of the callback function that is associated with the DPC object that the code example in the WdfDpcCreate topic created.
WdfDpcCancel(
PDevExt->CompleteWriteDpc,
TRUE
);
Requirements
Requirement | Value |
---|---|
Target Platform | Universal |
Minimum KMDF version | 1.0 |
Header | wdfdpc.h (include Wdf.h) |
Library | Wdf01000.sys (see Framework Library Versioning.) |
IRQL | See Remarks section. |
DDI compliance rules | DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf) |