Tech Support > Microsoft Windows > Drivers > How to retrieve the lower-level device object
How to retrieve the lower-level device object
Posted by Bell Kwong on January 2nd, 2008


Hi all,

Suppose I get a device object in the device stack, how can I retrieve
its direct lower-level device object. This kind of backward-lookup operation
has confused me for a long time.

(PS: My driver acts something similar with DeviceTree (from DDK), but I
don't want to walk around the whole device space.)

Thanks in advance.

Bell K.


Posted by Don Burn on January 2nd, 2008


You cannot, there is no standard place for this link, and such a standard
would be impossible since the driver could be a MUX that feeds to a number
of drivers.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply


"Bell Kwong" <dev@79cn.com> wrote in message
news:%23mK9UESTIHA.6060@TK2MSFTNGP05.phx.gbl...


Posted by Bell Kwong on January 2nd, 2008


As DDK describes, the IoDetachDevice routine releases an attachment between
the caller's device object and a lower driver's device object.

How does IODetachDevice achieve this purpose?


"Don Burn" <burn@stopspam.windrvr.com>


Posted by Don Burn on January 3rd, 2008


The caller passing in the device object to detach. You are asking for the
value of the call, which only the driver knows.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply


"Bell Kwong" <dev@79cn.com> wrote in message
news:O6RLIEaTIHA.5516@TK2MSFTNGP02.phx.gbl...


Posted by Bell Kwong on January 3rd, 2008


Well...Don, thanks. Actually, I am asking for the internal action within
IoDetachDevice. I know the current device object to be detached, but the
more I want to know is the way "IoDetachDevice" finds out the related
lower-level device object (and the upper-level device object, but easy to
obtain).

Seriously, the behavior of IoDetachDevice should cover the device objects
mentioned above. So, let's turn back to the subject: How to retrieve the
lower-level device object according to a known device object.

Bell K.

"Don Burn" <burn@stopspam.windrvr.com>


Posted by Maxim S. Shatskih on January 3rd, 2008


You must pass the lower device object explicitly to IoDetachDevice.

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

"Bell Kwong" <dev@79cn.com> wrote in message
news:eMjxjhaTIHA.5264@TK2MSFTNGP02.phx.gbl...