Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results


Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging

The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.

Check out The OSR Learning Library at:

Prevent PDO from becoming a phantom device after parent is removed

TKFRvisionTKFRvision Member Posts: 3

Disclaimer: This is for a hobby project, this isnt for work πŸ˜…. I am a beginner when it comes to driver development.

I have a kmdf wdf driver that is root enumerated and behaves kind of like a bus or fdo. It creates a pdo when it gets installed via devcon for now.
After it is installed it creates a pdo. This works. But when I remove my driver the pdo does not get removed properly but keeps its registry entries and therefore becomes a non-present aka a phantom device. Since this phantom device allocates a com number this is really annoying since I always have to remove it manually. Is there a way to force the removal of a pdo? I already tried both static enumeration with wdfpdomarkmissing on EvtDeviceReleaseHardware and dynamic enumeration using WdfChildListRequestChildEject. Both of them are not working.


  • Shane_CorbinShane_Corbin Member Posts: 304

    One thing you could do is install your driver with a proper installer. During uninstall make a custom action that calls DIF_REMOVE for each of your devices you want to forcefully remove.

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,563

    How do you create your PDO? You said you're using KMDF. If you're using the provided WdfChildList APIs, then it is your responsibility at unplug time to call WdfChidListBeginScan/WdfChlidListEndScan, which tells the system "I have no child PDOs".

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • TKFRvisionTKFRvision Member Posts: 3
    edited May 27

    Yeah that is exactly what I am doing. If for example I do this during an ioctl request, the pdo get's "unplugged" too. But it just gets grayed out (becomes a phantom device). I want it removed from the registry completely.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Internals & Software Drivers 19-23 June 2023 Live, Online
Writing WDF Drivers 10-14 July 2023 Live, Online
Kernel Debugging 16-20 October 2023 Live, Online
Developing Minifilters 13-17 November 2023 Live, Online