Get the symbolic link of physical drive.

Hi all,
I’m developping a user mode service. I will use the service program to
monitor the add and remove of the physical drive.
I implement it in this way:
1.RegisterDeviceNotification with filter DBT_DEVTYP_DEVICEINTERFACE
2.Process the WM_DEVICECHANGE message
What I need is to get the symbolic link of the physical drive like
“\.\PhysicalDrive1”.
I can do it by send IOCTL_STORAGE_GET_DEVICE_NUMBER when physical drive is
arrival, but it seems I can’t do this when it is removed.
So could anyone offer some idea? Thanks in advance.

Ted Chang

> I can do it by send IOCTL_STORAGE_GET_DEVICE_NUMBER when physical drive is

arrival, but it seems I can’t do this when it is removed.

So what? you’re getting the device interface name. When it is arrived, get the device number, and save it to DevInterfacePath -> PhysicalDriveNumberPath map.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com