Why the PnP manager is failing the IRP_MN_QUERY_REMOVE_DEVICE ?

Hello everyone,

I am trying to disable a device from the devcon, though the driver passes the IRP “IRP_MN_QUERY_REMOVE_DEVICE” down the stack and returns with success, PnP manager is sending “IRP_MN_CANCEL_REMOVE_DEVICE” instead of “IRP_MN_REMOVE_DEVICE”. I have looked at the setup.dev.log, PnP Manager is failing “IRP_MN_QUERY_REMOVE_DEVICE” with error

Query-removal was vetoed by ROOT\XXXX\0000? (veto type 5: PNP_VetoOutstandingOpen)
! dvi: Setting needs reboot
! dvi: Query-and-Remove failed: 0x17: CR_REMOVE_VETOED.

This driver is a Virtual Bus driver, I am trying to update the driver without a reboot required. Before disabling the Bus driver FDO, I made sure that all the child devices of this Bus device are removed and no applications opened a handle to this device.

How to proceed further on debugging to find out who opened a handle to this device?

Thanks in advance.

-Arjun

Something still has an open handle to your device

d

Bent from my phone


From: xxxxx@gmail.commailto:xxxxx
Sent: ?11/?1/?2014 2:23 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: [ntdev] Why the PnP manager is failing the IRP_MN_QUERY_REMOVE_DEVICE ?

Hello everyone,

I am trying to disable a device from the devcon, though the driver passes the IRP “IRP_MN_QUERY_REMOVE_DEVICE” down the stack and returns with success, PnP manager is sending “IRP_MN_CANCEL_REMOVE_DEVICE” instead of “IRP_MN_REMOVE_DEVICE”. I have looked at the setup.dev.log, PnP Manager is failing “IRP_MN_QUERY_REMOVE_DEVICE” with error

Query-removal was vetoed by ROOT\XXXX\0000? (veto type 5: PNP_VetoOutstandingOpen)
! dvi: Setting needs reboot
! dvi: Query-and-Remove failed: 0x17: CR_REMOVE_VETOED.

This driver is a Virtual Bus driver, I am trying to update the driver without a reboot required. Before disabling the Bus driver FDO, I made sure that all the child devices of this Bus device are removed and no applications opened a handle to this device.

How to proceed further on debugging to find out who opened a handle to this device?

Thanks in advance.

-Arjun


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

Did you try to issue !devhandles for the device to ensure that there are no opened handles for the device and its children?

>How to proceed further on debugging to find out who opened a handle to this device?

Because your driver handles IRP_MJ_CREATE/IRP_MJ_CLEANUP IRPs, you can trace who is actually opening/closing handles for the device. If you use KMDF, look at the documentation for WdfDeviceInitSetFileObjectConfig.

Thanks for your answers.
Mikae, I haven’t tried using !devhandles, will try.