[ROSPERF] PrintOSVersion(): Fix RegQueryValueExW() use

This commit is contained in:
Serge Gautherie 2020-02-13 03:25:42 +01:00 committed by Mark Jansen
parent e4f70e5434
commit 2505bd3a43

View file

@ -290,12 +290,11 @@ ProcessTest(PTEST Test, PPERF_INFO PerfInfo)
static void
PrintOSVersion(void)
{
#define BUFSIZE 160
OSVERSIONINFOEXW VersionInfo;
BOOL OsVersionInfoEx;
HKEY hKey;
WCHAR ProductType[BUFSIZE];
DWORD BufLen;
WCHAR ProductType[9] = { L'\0' };
DWORD BufLen, dwType;
LONG Ret;
unsigned RosVersionLen;
LPWSTR RosVersion;
@ -423,8 +422,6 @@ PrintOSVersion(void)
}
else /* Test for specific product on Windows NT 4.0 SP5 and earlier */
{
BufLen = BUFSIZE;
Ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
0, KEY_QUERY_VALUE, &hKey);
@ -433,15 +430,17 @@ PrintOSVersion(void)
return;
}
Ret = RegQueryValueExW(hKey, L"ProductType", NULL, NULL,
BufLen = sizeof(ProductType);
Ret = RegQueryValueExW(hKey, L"ProductType", NULL, &dwType,
(LPBYTE) ProductType, &BufLen);
if (ERROR_SUCCESS != Ret || BUFSIZE < BufLen)
RegCloseKey(hKey);
if (Ret != ERROR_SUCCESS || dwType != REG_SZ)
{
return;
}
RegCloseKey(hKey);
if (0 == lstrcmpiW(L"WINNT", ProductType))
{
wprintf(L"Workstation ");