https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a7e4d66be52c7affd7ee1f...
commit a7e4d66be52c7affd7ee1f0ea88a72b1c625d423 Author: Serge Gautherie reactos-git_serge_171003@gautherie.fr AuthorDate: Thu Feb 13 03:25:42 2020 +0100 Commit: Mark Jansen mark.jansen@reactos.org CommitDate: Sun Apr 26 14:16:59 2020 +0200
[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;