The detail I want likes "USB NAME" in this image
Getting the letter "F" is also usefull.
Note that these code must able to run on winxp and newer.
Thanks for your help!
The detail I want likes "USB NAME" in this image
Getting the letter "F" is also usefull.
Note that these code must able to run on winxp and newer.
Thanks for your help!
you can use a combination of DeviceIOControl
and SetupDiGetDeviceInterfaceDetail
full source code is on Get USB disk drive letter by device path or handle
( https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/a87c4cc3-bfc1-4664-8317-af30f03a715e/get-usb-drive-details?forum=wdk do not try to get a serial number because some manufacturers of USB devices di not support serial numbers)
other possiblity (easier) is to use combination of GetDriveType()
and GetDisksProperty()
source code is on https://www.codeproject.com/Articles/6559/How-To-get-the-usbdisk-s-drive-letter-properly
a very easy version is in How to retrieve removable storage drive letter using C/C++
yet another possibility is on How to list physical disks? and GetLogicalDrives() for loop (uses GetLogicalDrive
(returns a bitmask that has to be translated to the common drive letters A:, B: C:,...
)) <- this is too complicated
not in C++ you could use wmic
tool