How to get the Drive letter and Mount Path - MSDN
- by new
Hello all,
I get the devices list from the system using SetupDiGetClassDevs Function - MSDN.
Also i can able to get the vendor id and product id from the devices.
But i cant able to get the drive letter and the mount path
For Example if i plug the usb drive means , i have to get the drive letter like "G:/"
Please help me to get the drive letter and mount path for the devices
if (SetupDiEnumDeviceInterfaces(hDevInfo,
NULL,&GUID_DEVINTERFACE_USB_DEVICE,i,&Interface_Info))
{
wprintf(L"\tDeviccvcvcveInstanceId : %d\n", i);
pspdidd->cbSize = sizeof(*pspdidd);
SP_DEVICE_INTERFACE_DETAIL_DATA *pDetData = NULL;
DWORD dwDetDataSize = sizeof (SP_DEVICE_INTERFACE_DETAIL_DATA) + 256;
pDetData = (SP_DEVICE_INTERFACE_DETAIL_DATA*) malloc (dwDetDataSize);
pDetData->cbSize = sizeof (SP_DEVICE_INTERFACE_DETAIL_DATA);
SetupDiGetDeviceInterfaceDetail(hDevInfo,&Interface_Info,pDetData,dwDetDataSize,
NULL,&DeviceInfoData);
qDebug ()<<QString::fromWCharArray( pDetData->DevicePath );
}