mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-24 19:54:25 -04:00
[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:
parent
de386329e4
commit
66534640a4
3 changed files with 26 additions and 6 deletions
|
@ -863,6 +863,26 @@ static __inline int _mkdirU(const char* dirname)
|
|||
return ret;
|
||||
}
|
||||
|
||||
// The following expects PropertyBuffer to contain a single Unicode string
|
||||
static __inline BOOL SetupDiGetDeviceRegistryPropertyU(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData,
|
||||
DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize)
|
||||
{
|
||||
DWORD ret = FALSE, err = ERROR_INVALID_DATA;
|
||||
walloc(PropertyBuffer, PropertyBufferSize);
|
||||
|
||||
ret = SetupDiGetDeviceRegistryPropertyW(DeviceInfoSet, DeviceInfoData, Property,
|
||||
PropertyRegDataType, (PBYTE)wPropertyBuffer, PropertyBufferSize, RequiredSize);
|
||||
err = GetLastError();
|
||||
if ((ret != 0) && (wchar_to_utf8_no_alloc(wPropertyBuffer,
|
||||
(char*)(uintptr_t)PropertyBuffer, PropertyBufferSize) == 0)) {
|
||||
err = GetLastError();
|
||||
ret = FALSE;
|
||||
}
|
||||
wfree(PropertyBuffer);
|
||||
SetLastError(err);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue