I would like to know whether i can get the drive information using the
SP_DEVICE_INTERFACE_DETAIL_DATA’s DevicePath
my device path looks like below
“\?\usb#vid_04f2&pid_0111#5&39fe81e&0&2#{a5dcbf10-6530-11d2-901f-00c04fb951ed}”
also please tell me in the winapi they say “To determine whether a drive is a USB-type drive, call SetupDiGetDeviceRegistryProperty and specify the SPDRP_REMOVAL_POLICY property.”
i too use SetupDiGetDeviceRegistryProperty like below
while ( !SetupDiGetDeviceRegistryProperty( hDevInfo,&DeviceInfoData,
SPDRP_REMOVAL_POLICY,&DataT,( PBYTE )buffer,buffersize,&buffersize ))
but i dont know how can i get the drive type using the above..
Please help me up
Probably what you are looking for you will be find here http://support.microsoft.com/kb/264203/en. Another link http://support.microsoft.com/kb/305184/en can be also interesting for you.
UPDATED: Example from http://support.microsoft.com/kb/264203/en shows you how to use to determine whether USB-Drive is removable. You can also use
SetupDiGetDeviceRegistryPropertywithSPDRP_REMOVAL_POLICYon the device instance (useSetupDiEnumDeviceInfo,SetupDiGetDeviceInstanceIdand thenSetupDiGetDeviceRegistryProperty). If returnedDWORDhasCM_REMOVAL_POLICY_EXPECT_SURPRISE_REMOVALorCM_REMOVAL_POLICY_EXPECT_ORDERLY_REMOVALas value, the drive is removable.Moreover the code example show how to open device handle which you can use with
DeviceIoControlfunction to retrieve a lot of useful information which you can need.IOCTL_STORAGE_QUERY_PROPERTY(see http://msdn.microsoft.com/en-us/library/ff566997%28v=VS.85%29.aspx) with differentQueryTypeandPropertyIdonly one example. You can useIOCTL_STORAGE_GET_DEVICE_NUMBERfor example to receive storage volumes and their disk number.If you will have full
STORAGE_DEVICE_NUMBERinformation about your USB device we will be able to find all other information about it with different ways. One of the easiest is: just enumerate all drive letters with QueryDosDevice and querySTORAGE_DEVICE_NUMBERfor every drive. If you will find full match inSTORAGE_DEVICE_NUMBERyou will find the drive letter.