From a7e4d66be52c7affd7ee1f0ea88a72b1c625d423 Mon Sep 17 00:00:00 2001 From: Serge Gautherie Date: Thu, 13 Feb 2020 03:25:42 +0100 Subject: [PATCH] [SHELL32] DoGetProductType(): Use RegGetValueW() instead of RegQueryValueExW(), to enforce a null terminator. Addendum to 9f4e8ef25b53d27494efab569288452fbaa1cdfa. --- dll/win32/shell32/wine/shellpath.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dll/win32/shell32/wine/shellpath.c b/dll/win32/shell32/wine/shellpath.c index 17a6877edad..892748d56b7 100644 --- a/dll/win32/shell32/wine/shellpath.c +++ b/dll/win32/shell32/wine/shellpath.c @@ -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;