[enum] use Unicode when retrieving the device friendly name

* This should fix the improper display of some localized strings such as
  "Microsoft Virtual Disk"
This commit is contained in:
Pete Batard 2016-06-05 20:21:16 +01:00
parent de386329e4
commit 66534640a4
3 changed files with 26 additions and 6 deletions

View file

@ -376,7 +376,7 @@ BOOL GetDevices(DWORD devnum)
&datatype, (LPBYTE)buffer, sizeof(buffer), &size) && IsRemovable(buffer);
memset(buffer, 0, sizeof(buffer));
if (!SetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_FRIENDLYNAME,
if (!SetupDiGetDeviceRegistryPropertyU(dev_info, &dev_info_data, SPDRP_FRIENDLYNAME,
&datatype, (LPBYTE)buffer, sizeof(buffer), &size)) {
uprintf("SetupDiGetDeviceRegistryProperty (Friendly Name) failed: %s\n", WindowsErrorString());
// We can afford a failure on this call - just replace the name with "USB Storage Device (Generic)"