I am using win32 api with C++.
I would like to know how I can get the volume GUID using a “device path”.
My device looks like this:
\\?\usb#vid_04f2&pid_0111#5&39fe81e&0&2#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This will be the device with device instance ID
usb\VID_04f2&PID_0111\5&39fe81e&0&2. That’s probably a mass storage device aka disk. Now, the problem you have is that a mass storage device doesn’t actually have a drive letter; it’s the volume on that disk which has a drive letter. If there are two partitions, a single USB mass storage device may have two drive letters. So, there’s no direct function to get the volume.It looks like you need to enumerate the device tree rooted at
usb\VID_04f2&PID_0111\5&39fe81e&0&2to find children with device type “volume”. The DEV_BROADCAST_DEVICEINTERFACE you get will have adbcc_namefield that you can pass toGetVolumeNameForVolumeMountPoint().