devnode problem: missing parent

Hi,

I am removing PDO’s from the device relations structure on an
IRP_MN_QUERY_DEVICE_RELATIONS in a miniport filter. The system can be
manually rescanned (“Scan for hardware changes”) and everything is fine.

I add PDO’s back to the device relations and higher level drivers attach to
these PDO’s so a devnode is now present for the PDO.
Using the CM & SetupDi API I remove the higher devobjs attached to the
PDO.

At this point the PDO devobj and the associated devnode looks like this
(items with X’s have been removed since they are not relevant to the
problem)

kd> !devobj 81A90410
Device object (81a90410) is for: XXXXXX DriverObject 81a9c170
Current Irp 00000000 RefCount 0 Type 00000007 Flags 00001050
DevExt 81a904c8 DevObjExt 81a90988 Dope 816eb448 DevNode 8173e588
ExtensionFlags (0x00000010) DOE_START_PENDING
Device queue is not busy.

kd> !devnode 8173e588
DevNode 0x8173e588 for PDO 0x81a90410
Parent 0x81abd008 Sibling 0000000000 Child 0000000000
InstancePath is: XXXXXXXXXXXXXXXXXX
Flags (0x00000010) DNF_ENUMERATED
CapabilityFlags (0x00000180) SilentInstall, RawDeviceOK

Then when I manual rescan I remove the PDO’s that had the higher device
objects attached and the devnode gets into the problem state and no longer
has a parent
The PDO devobj stays the same as above

kd> !devnode 8173e588
DevNode 0x8173e588 for PDO 0x81a90410
Parent 0000000000 Sibling 0000000000 Child 0000000000
InstancePath is XXXXXXXXXXXXXXXXXX
Flags (0x12000000) DNF_HAS_PROBLEM, DNF_DEVICE_GONE
CapabilityFlags (0x00000180) SilentInstall, RawDeviceOK
Problem = CM_PROB_DEVICE_NOT_THERE

The parent devobj that is now missing from the devnode looks like this:

kd> !devnode 81abd008
DevNode 0x81abd008 for PDO 0x81abe970
Parent 0x81ac0788 Sibling 0x81abdf28 Child 0000000000
InstancePath is XXXXXXXXXXXXXXXXXX
ServiceName is XXXXX
Flags (0x000421d8) DNF_PROCESSED, DNF_ENUMERATED,
DNF_ADDED, DNF_HAS_BOOT_CONFIG,
DNF_BOOT_CONFIG_RESERVED, DNF_RESOURCE_ASSIGNED,
DNF_STARTED

Why is the parent being detached? I assume the problem flag is being set
because the parent has been detached. Whats going on here?

Any ideas on how I avoid this? IoInvalidateDeviceRelations will happen
often on the system so I need a way to keep the devnode out of this state.

Theres not much docs on the devnode so if anyone can help that would be
greatly appreciated.

Note: If an additional IoInvalidateDeviceRelations does not happen between
the time I add the PDO back to the relations the higher device objects get
attached.

Thanks for any help

Mike


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com