How to get the Drive letter and Mount Path - MSDN
Posted
by new
on Stack Overflow
See other posts from Stack Overflow
or by new
Published on 2010-06-05T12:02:13Z
Indexed on
2010/06/05
12:12 UTC
Read the original article
Hit count: 138
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 );
}
© Stack Overflow or respective owner