[SHELL32] DoGetProductType(): Use RegGetValueW()

instead of RegQueryValueExW(), to enforce a null terminator.

Addendum to 9f4e8ef25b.
This commit is contained in:
Serge Gautherie 2020-02-13 03:25:42 +01:00 committed by Mark Jansen
parent 2505bd3a43
commit a7e4d66be5

View file

@ -70,8 +70,8 @@ DoGetProductType(PNT_PRODUCT_TYPE ProductType)
static const WCHAR ProductOptions[] = L"SYSTEM\\CurrentControlSet\\Control\\ProductOptions";
HKEY hKey;
LONG error;
WCHAR szValue[32];
DWORD cbValue, dwType;
WCHAR szValue[9];
DWORD cbValue;
static DWORD s_dwProductType = 0;
if (s_dwProductType != 0)
@ -87,8 +87,8 @@ DoGetProductType(PNT_PRODUCT_TYPE ProductType)
return FALSE;
cbValue = sizeof(szValue);
error = RegQueryValueExW(hKey, L"ProductType", NULL, &dwType, (LPBYTE)szValue, &cbValue);
if (!error && dwType == REG_SZ)
error = RegGetValueW(hKey, NULL, L"ProductType", RRF_RT_REG_SZ, NULL, (PVOID)szValue, &cbValue);
if (!error)
{
if (lstrcmpW(szValue, L"WinNT") == 0)
*ProductType = NtProductWinNt;