TargetRelationNeedsRef rule (wdm)

The TargetRelationNeedsRef rule specifies that when processing a TargetDeviceRelation query, the driver's DispatchPnP routine calls one of the following functions to reference the child device's PDO:

This rule applies only when the driver completes the IRP by setting the Irp->IoStatus.Information pointer to a new, non-NULL value. It is not applied when the driver passes the IRP to a lower driver.

This rule does not specify what qualifies as a valid value for Irp->IoStatus.Information. This rule applies only when the driver changes the value and the new value is not NULL. A valid value is a pointer to a DEVICE_RELATIONS structure that contains the requested relations information.

This rule only applies to bus drivers.

Driver model: WDM

How to test

At compile time

Run Static Driver Verifier and specify the TargetRelationNeedsRef 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 ObReferenceObjectByHandle ObReferenceObjectByPointer PoCallDriver

See also

DanglingDeviceObjectReference