How to find FDO?

I’m writing some sort of diagnostic tool. My driver is sitting as
upper class filter and I need to know for shure, which device below is
FDO. And I have to do it strictly from kernel mode. I’ve hardly tried
to find documented way but with no luck. So the question: is it
possible and how?

Thank you.


Best regards, Nikolay
mailto:xxxxx@gmail.com

There is no way to do this. The role of an FDO is exactly that, a role.
It is the one by default who owns power policy for the device and the
interfaces for it. Any driver in the stack (w/the appropriate
architecture) can assume any of the specific functions of an FDO and not
actually be the FDO.

This begs the question, why do you need to know who is the FDO in the
stack? What are you going to do with that information once you have it?
Perhaps there is another way.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Nikolay Korneev
Sent: Tuesday, July 18, 2006 10:23 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to find FDO?

I’m writing some sort of diagnostic tool. My driver is sitting as upper
class filter and I need to know for shure, which device below is FDO.
And I have to do it strictly from kernel mode. I’ve hardly tried to find
documented way but with no luck. So the question: is it possible and
how?

Thank you.


Best regards, Nikolay
mailto:xxxxx@gmail.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

I’m writing some sort of diagnostic tool. My driver is sitting as
upper class filter and I need to know for shure, which device below is
FDO. And I have to do it strictly from kernel mode. I’ve hardly tried
to find documented way but with no luck. So the question: is it
possible and how?

Thank you.


Best regards, Nikolay
mailto:xxxxx@gmail.com

> This begs the question, why do you need to know who is the FDO in the

stack? What are you going to do with that information once you have it?
Perhaps there is another way.

I’ve registered as upper class filter for USB setup class. So my driver
is called for host-controllers, hubs, storage devices and some other…
And I want to know in which particular stack am I. I wanted to know that
getting FDO’s driver object and comparing its name with the list of well
known usb drivers.

I would be happy if I could get the service name for a device like user-mode
SetupDiGetDeviceRegistryProperty( SPDRP_SERVICE ) does. But IoGetDeviceProperty
does’t provide this type of info.

Thank you, Doron.


Best regards, Nikolay
mailto:xxxxx@gmail.com

Seeing that the usb device class is used by many many different drives
(not the right thing to do, but it is done nevertheless), I don’t know
how far you are going to get. Also, a hardcoded list might break when
MSFT renames a driver to some other name, but I digress…

…you could do this with heuristics. If you are assigned resources in
start device, you are most likely on a host controller for instance.
You could use IoGetDeviceInterfaces, pass in your stack’s PDO and
specify well known device interfaces (like GUID_DEVINTERFACE_USB_HUB,
GUID_DEVINTERFACE_USB_DEVICE, or GUID_DEVINTERFACE_USB_HOST_CONTROLLER
for host controllers/hubs/devices etc etc).

d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Nikolay Korneev
Sent: Tuesday, July 18, 2006 11:43 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] How to find FDO?

This begs the question, why do you need to know who is the FDO in the
stack? What are you going to do with that information once you have
it?
Perhaps there is another way.

I’ve registered as upper class filter for USB setup class. So my driver
is called for host-controllers, hubs, storage devices and some other…
And I want to know in which particular stack am I. I wanted to know that
getting FDO’s driver object and comparing its name with the list of well
known usb drivers.

I would be happy if I could get the service name for a device like
user-mode SetupDiGetDeviceRegistryProperty( SPDRP_SERVICE ) does. But
IoGetDeviceProperty does’t provide this type of info.

Thank you, Doron.


Best regards, Nikolay
mailto:xxxxx@gmail.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

>It is the one by default who owns power policy for the device and the

Correction: for storage LUN stacks, PDO is the power policy owner.

For keyboard and mouse stacks, the upper filter of Kbd/Mouclass is the power
policy owner.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com