util/register: fix crashing when value string contains non-ascii chars

We can't use RegGetValueA because RegGetValueA converts wide string to non UTF-8 string, which results in crashing when printing
This commit is contained in:
李通洲
2022-11-23 15:42:19 +08:00
parent 66f8a8cdd0
commit 4fa3ca98a2
11 changed files with 88 additions and 45 deletions
+6 -6
View File
@@ -16,12 +16,12 @@ void ffDetectHostImpl(FFHostResult* host)
FF_HKEY_AUTO_DESTROY hKey = NULL;
if(!ffRegOpenKeyForRead(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\BIOS", &hKey, &host->error))
if(!ffRegOpenKeyForRead(HKEY_LOCAL_MACHINE, L"HARDWARE\\DESCRIPTION\\System\\BIOS", &hKey, &host->error))
return;
ffRegReadStrbuf(hKey, "SystemProductName", &host->productName, NULL);
ffRegReadStrbuf(hKey, "SystemFamily", &host->productFamily, NULL);
ffRegReadStrbuf(hKey, "SystemVersion", &host->productVersion, NULL);
ffRegReadStrbuf(hKey, "SystemSKU", &host->productSku, NULL);
ffRegReadStrbuf(hKey, "SystemManufacturer", &host->sysVendor, NULL);
ffRegReadStrbuf(hKey, L"SystemProductName", &host->productName, NULL);
ffRegReadStrbuf(hKey, L"SystemFamily", &host->productFamily, NULL);
ffRegReadStrbuf(hKey, L"SystemVersion", &host->productVersion, NULL);
ffRegReadStrbuf(hKey, L"SystemSKU", &host->productSku, NULL);
ffRegReadStrbuf(hKey, L"SystemManufacturer", &host->sysVendor, NULL);
}