StartIoCancel rule (wdm)

The StartIoCancel rule specifies that the driver must not call IoSetStartIoAttributes with the NonCancelable parameter set to FALSE before calling IoSetCancelRoutine with a non-NULLCancel routine.

Setting the NonCancelable parameter to FALSE before registering the Cancel routine can result in a cancellation race condition.

Because a driver's Cancel routine must include a call to IoReleaseCancelSpinLock (to release the spin lock that the I/O Manager acquires before calling the Cancel routine), consider verifying your driver with both the StartIoCancel rule and the CancelSpinLock rule.

Driver model: WDM

How to test

At compile time

Run Static Driver Verifier and specify the StartIoCancel rule.

Use the following steps to run an analysis of your code:
  1. Prepare your code (use role type declarations).
  2. Run Static Driver Verifier.
  3. View and analyze the results.

For more information, see Using Static Driver Verifier to Find Defects in Drivers.

Applies to

IoSetCancelRoutine IoSetStartIoAttributes

See also

CancelSpinLock