Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > Iterating over WDM device stack

Reply
Thread Tools Display Modes

Iterating over WDM device stack

 
 
Ilya Konstantinov
Guest
Posts: n/a

 
      02-23-2011
[cross-posted to StackOverflow - http://stackoverflow.com/questions/5...-device-stack]

As I understand, one can iterate the device stack of WDM devices only
from the bottoms up, because DEVICE_OBJECT has an AttachedDevice
member (but not a LowerDevice member). Luckily, the AddDevice callback
receives the PhysicalDeviceObject so you one iterate over the entire
stack.

From within my filter driver I'm trying to determine whether I'm
already filtering a certain device object. (Let's say I have a legit
reason for this. Bear with me.) My idea was to go over every
DEVICE_OBJECT in the stack and compare its DriverObject member to
mine.

Judging from the existence of IoGetAttachedDeviceReference, I assume
just accessing AttachedDevice isn't a safe thing to do, for the risk
of the device suddenly going away. However,
IoGetAttachedDeviceReference brings me straight to the top of the
stack, which is no good for me.

So, is there a safe way to iterate over a device stack?

Thanks!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Vista Mobile Device Center - my WM5 device is not recognised Steve Spiller [MSFT] ActiveSync 0 10-22-2007 05:16 PM
Bluetooth, Changing from Toshiba stack to MS stack Jan Windows Vista Hardware 2 10-18-2007 05:55 PM
Cannot reuse old Device name in WMDC (Final) mlai ActiveSync 3 03-06-2007 08:15 AM
Re: Vista and IMate Jamin WMDC 6 RTM Problem Gary Waliczek [MSFT] ActiveSync 4 02-23-2007 06:20 PM
Trouble with driver on Windows Vista Beta 2 sujatha Windows Vista Installation 0 06-08-2006 06:44 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59