From fcf4e99e019cc1a44ab7e0bbe90054f0384c788a Mon Sep 17 00:00:00 2001 From: Anton Danielsson Date: Mon, 5 Oct 2015 14:51:56 +0200 Subject: [PATCH] Use IsWindowsXPOrGreater instead of the deprecated GetVersionEx. --- src/sysinfo.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/sysinfo.cc b/src/sysinfo.cc index f45d1236..508e44a3 100644 --- a/src/sysinfo.cc +++ b/src/sysinfo.cc @@ -18,6 +18,7 @@ #ifdef BENCHMARK_OS_WINDOWS #include #include +#include #else #include #include @@ -235,10 +236,8 @@ void InitializeSystemInfo() { #elif defined BENCHMARK_OS_WINDOWS // In NT, read MHz from the registry. If we fail to do so or we're in win9x // then make a crude estimate. - OSVERSIONINFO os; - os.dwOSVersionInfoSize = sizeof(os); DWORD data, data_size = sizeof(data); - if (GetVersionEx(&os) && os.dwPlatformId == VER_PLATFORM_WIN32_NT && + if (IsWindowsXPOrGreater() && SUCCEEDED( SHGetValueA(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0",