ControlDeviceDeleted rule (kmdf)

The ControDeviceDeleted rule specifies that if a PnP driver creates a control device object, the driver must delete the control device object in one of the cleanup callback functions before the driver unloads.

If an FDO or filter driver calls WdfDeviceCreate for the control device object, the driver must call WdfObjectDelete for the control device object from the driver's cleanup callback function for the WDFDEVICE object, the destroy callback function for WDFDEVICE object, or the EvtDeviceSelfManagedIoCleanup event callback function.

Driver model: KMDF

How to test

At compile time

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

WdfDeviceCreate WdfObjectDelete