How to find hard disk device like: device\harddisk0\dr0 and so on...

Enumerate all bearers of the Disk PnP devinterface using SetupDi calls.

For each, call IOCTL_STORAGE_GET_DEVICE_NUMBER

Then build the strings of Device\HardDisk%d\DR0

Or, better, avoid the latter names altogether. They are not persistent across boots and across USB flash drives plug/unplug, while the PnP names are persistent (with the only exception of USB flash drives without serial numbers, but I never ever saw one).


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Hello,
>
> I’m trying to figure where to get the info to get the disks that are connected in a format of Device\HardDisk0\DR0, Device\HardDisk1\DR2 and so on…
>
> It is the same as in DeviceTree.
>
> Where do I dig this info from?
>
> Thanks,
>
>
>