12.1 Cancel Routine Requirements

A Cancel routine is called to complete a given IRP for a given target device object after setting the IRP's I/O status block with STATUS_CANCELLED for Status and zero for Information.

A Cancel routine is always called with the system cancel spin lock held on its behalf. Until it calls IoReleaseCancelSpinLock, this routine runs at DISPATCH_LEVEL IRQL, and it is run in an arbitrary thread context.

Running at IRQL DISPATCH_LEVEL and in an arbitrary thread context restricts the set of support routines a Cancel routine can call.

For more information about managing IRQLs in NT drivers, see Chapter 16. For specific information about the IRQL(s) at which any particular support routine can be called, see the Kernel-Mode Driver Reference.