IoSetCompletionRoutineExCheck rule (wdm)

The IoSetCompletionRoutineExCheck rule specifies that the IoSetCompletionRoutineEx routine returns an NTSTATUS value. The driver must check this value to determine if the IoCompletion routine was successfully registered before calling IoCallDriver or PoCallDriver.

If the IoCompletion routine is successfully registered, IoSetCompletionRoutineEx allocates memory that remains allocated until the IoCompletion routine executes. Drivers must ensure that their IoCompletion routine executes by calling IoCallDriver or PoCallDriver otherwise, the kernel will leak memory.

Driver model: WDM

How to test

At compile time

Run Static Driver Verifier and specify the IoSetCompletionRoutineExCheck 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

IoCallDriver IoSetCompletionRoutineEx PoCallDriver