Discussion:
How to get the device instance id of a disk or volume?
(too old to reply)
Hemant Kulkarni
17 years ago
Permalink
am developing a software where I store the Instance ID of every disk in the
system. How can I get the Instance ID from a disk number? e.g I want Instance
ID of DIsk0 DIsk1 etc.?

here is what I am doing

1] SetupDiClassGuidsFromNameA("DiskDrive",***);
to get the GUID for disk drives

2]SetupDiEnumDeviceInf(***) to enumrate all the disks.This gives me Instance
ID's of all the disks after using SetupDiGetDeviceInstanceId()

but how can I get the device instance ID of spesific disk(like Disk0)?
Uwe Sieber
17 years ago
Permalink
...
Call SetupDiGetDeviceInterfaceDetail to get each disk's
DevicePath found in the SP_DEVICE_INTERFACE_DETAIL_DATA
struct. Remove the trailing backslash, use CreateFile
to get a handle (0 access is good engouh) and call
IOCTL_STORAGE_GET_DEVICE_NUMBER with the handle to
get the device number.


Uwe

Continue reading on narkive:
Loading...