Some questions regarding IoReportDetectedDevice

Hi Guys,

Your help will be truly appreciated.

We’d developed a virtual volume driver that we’d been using in order to export some data on simple removable storage devices.

Recently, we’d tried to make the virtual volume “mountable”, by creating a fake PDO (using IoReportDetectedDevice) and attaching our device objects onto it.

It seem to work very well, but the real problems start with the fake PDO that outlives our device instances :/.

If we’re keeping the fake PDO (== not uninstalling it manually, before reboot), when we’re calling IoReportDetectedDevice, after reboot, the call usually fails with STATUS_NO_SUCH_DEVICE (I’m assuming that the PnP Manager is recycling the ‘old’ PDOs, rather than create new ones).

Do you know if this is the case, or why does the function call fails? Is there a way to properly reuse the fake PDOs, after reboot, and hence overcoming the issue?

What is the best way to remove such a device?

I can guess that most of you will recommend rewriting the whole solution into having a dedicated bus driver that will handle my devices, but I just don’t have the time :(.

I don’t want to cleanup these devices, using UM SetupDi* API, as it may cause some unwanted race conditions (for example, if the system bugchecks or the UM app lags, I won’t be able to delete them on time).

Is there some other, sound, elegant and correct way to remove these devices?

Thanks in advance,
Leonid.

There is no way to do this. This api is a one way street, reoporting presence only. Doing this in a kmdf bus driver (can be the same driver you have now) is a couple of days work at worst

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@gmail.com
Sent: Sunday, June 21, 2009 12:19 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Some questions regarding IoReportDetectedDevice

Hi Guys,

Your help will be truly appreciated.

We’d developed a virtual volume driver that we’d been using in order to export some data on simple removable storage devices.

Recently, we’d tried to make the virtual volume “mountable”, by creating a fake PDO (using IoReportDetectedDevice) and attaching our device objects onto it.

It seem to work very well, but the real problems start with the fake PDO that outlives our device instances :/.

If we’re keeping the fake PDO (== not uninstalling it manually, before reboot), when we’re calling IoReportDetectedDevice, after reboot, the call usually fails with STATUS_NO_SUCH_DEVICE (I’m assuming that the PnP Manager is recycling the ‘old’ PDOs, rather than create new ones).

Do you know if this is the case, or why does the function call fails? Is there a way to properly reuse the fake PDOs, after reboot, and hence overcoming the issue?

What is the best way to remove such a device?

I can guess that most of you will recommend rewriting the whole solution into having a dedicated bus driver that will handle my devices, but I just don’t have the time :(.

I don’t want to cleanup these devices, using UM SetupDi* API, as it may cause some unwanted race conditions (for example, if the system bugchecks or the UM app lags, I won’t be able to delete them on time).

Is there some other, sound, elegant and correct way to remove these devices?

Thanks in advance,
Leonid.


NTDEV is sponsored by OSR

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

Thanks Doron.

If there is something that I’d learned, is that nothing is impossible :).

Many advocate the usage of IoReportDetectedDevice for such purpose, so it seems pretty strange to me that there’s no way to workaround this issue.

What about deleting the fake PDO’s info from the registry (for the root enumerator)? Won’t it work?

If it’s indeed not possible to cleanup these devices, is there a simple way to reuse them, after reboot?

Thanks in advance,
Leonid.

xxxxx@gmail.com wrote:

Thanks Doron.

If there is something that I’d learned, is that nothing is impossible :).

Many advocate the usage of IoReportDetectedDevice for such purpose, so it seems pretty strange to me that there’s no way to workaround this issue.

What about deleting the fake PDO’s info from the registry (for the root enumerator)? Won’t it work?

If it’s indeed not possible to cleanup these devices, is there a simple way to reuse them, after reboot?

Thanks in advance,
Leonid.

This is normal, most of devices are persistent in the registry under
enum. Then can you detect and recycle them instead of creating new?

– pa

I’d thought of that, but I’m trying to avoid the overhead of mapping the fake PDOs to the devices, as I can have many devices living in parallel with “old” fake PDOs that had survived the reboot.

Isn’t there a simple way do delete them?

>Isn’t there a simple way do delete them?

Can i be more blunt? A true bus driver is how you fix this “problem.” the time you have spent trying to hack/workaround IRDD() could have been used to write a kmdf bus driver which would be nearly finished by now.

Who advocated the use of IRDD? It certainly wasn’t me…

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@gmail.com
Sent: Monday, June 22, 2009 5:39 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Some questions regarding IoReportDetectedDevice

I’d thought of that, but I’m trying to avoid the overhead of mapping the fake PDOs to the devices, as I can have many devices living in parallel with “old” fake PDOs that had survived the reboot.

Isn’t there a simple way do delete them?


NTDEV is sponsored by OSR

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

wrote in message news:xxxxx@ntdev…
> I’d thought of that, but I’m trying to avoid the overhead of mapping the
> fake PDOs to the devices, as I can have many devices living in parallel
> with “old” fake PDOs that had survived the reboot.
>
> Isn’t there a simple way do delete them?
>

A simple way? Yes… just go ahead and delete them.

– pa

Hi Pavel,

That approach is a bit problematic.

If I’m deleting these devices in “real time” - nothing will work until the reboot.
If I’m deleting these devices in an early stage of boot (in boot driver’s DriverEntry, for example) - I may enter into a race with the PnP manager.

Thanks,
Leonid.

xxxxx@gmail.com wrote:

Hi Pavel,

That approach is a bit problematic.

If I’m deleting these devices in “real time” - nothing will work until the reboot.
If I’m deleting these devices in an early stage of boot (in boot driver’s DriverEntry, for example) - I may enter into a race with the PnP manager.

Then, delete and immediately reboot.
That’s is simple (but, as Doron replied - not the best) way.

– pa

Well, I guess I’ll just implement the bus driver and get it over with.

Thanks for the responses,
Leonid.