DeleteDevice rule (wdm)

The DeleteDevice rule specifies that drivers should not rely on the I/O Manager or PnP Manager to keep the DeviceObject alive after a call to IoDeleteDevice.

Drivers should call IoDeleteDevice after the lower driver has returned. This is the recommended behavior. This rule applies to FDO and FIDO drivers.

When handling an IRP_MN_REMOVE_DEVICE request, the driver should only call IoDeleteDevice after IoCallDriver or PoCallDriver have returned.

Driver model: WDM

How to test

At compile time

Run Static Driver Verifier and specify the DeleteDevice 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 IoDeleteDevice PoCallDriver