Linking FriendlyNames from the Registry to drive letters for USB storage devices
I am writing an application that allows 开发者_开发百科Syncing to USB storage devices and I would like to display the FriendlyName
for the devices that can be found in the registry at HKLM\SYSTEM\CurrentControlSet\Enum\USBSTOR\
I am using GetLogicalDrives
to get the list of available devices, GetDriveType
to filter by DRIVE_REMOVABLE
and GetVolumeInformation
to retrieve the volume name and serial number.
I would like to also get the FriendlyName
out of the registry by linking the USBSTOR
entries to a drive letter so I know which entry is which drive.
Tricky but possible. Have a peek at my post here. That approach is roughly in the right direction here, too. You don't want to use undocumented registry fields. Instead, use the Device Information Functions from the SetupAPI and Configuration Management API
精彩评论