Discussion:
How to determine adapter driver name from disk handle?
(too old to reply)
BB
2010-08-10 19:53:49 UTC
Permalink
I'm attempting to do something that seems like it should be very
easily doable, and yet... not.



I have a list of loaded drivers. From that I can also determine their
PCI location.

I have a list of adapters, but not neccessarily their drivers,
friendlynames, etc (unless they're SCSI and then there are some direct
registry reads to CurrentControlSet that can work.)

I have a list of drives and their handles. I can get the "adapter
number" that they're attached to. I can get their SCSI address.




Is there any way to correlate the drives and adapter-drivers list so
that I can say drive #2 is attached to the msahci.sys driver (for
example?)
BB
2010-08-10 20:32:34 UTC
Permalink
Post by BB
Is there any way to correlate the drives and adapter-drivers list so
that I can say drive #2 is attached to the msahci.sys driver (for
example?)
And just to be totally clear, I need to do this from user-space code,
not the driver.
Maxim S. Shatskih
2010-08-10 21:15:09 UTC
Permalink
Post by BB
Is there any way to correlate the drives and adapter-drivers list so
that I can say drive #2 is attached to the msahci.sys driver (for
example?)
Storage device numbers are not persistent across boots. If you will boot with another set of disks plugged - then the SDNs for old disks will change too.

So, "drive 2" is not of much use.

But, to corellate, use SetupDi APIs to find all storage controllers, then - for each one - add all its children of the Disk class, then get the SDNs for these disks.
--
Maxim S. Shatskih
Windows DDK MVP
***@storagecraft.com
http://www.storagecraft.com
Loading...