aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Danielsson <anton.danielsson@dirac.se>2015-10-05 14:51:56 +0200
committerAnton Danielsson <anton.danielsson@dirac.se>2015-10-08 10:48:34 +0200
commitfcf4e99e019cc1a44ab7e0bbe90054f0384c788a (patch)
treefe657d418d08568c1ca9c99196a52e8b7b474382
parente605cb0802f97cab812939752b327cb72a8ab357 (diff)
downloadgoogle-benchmark-fcf4e99e019cc1a44ab7e0bbe90054f0384c788a.tar.gz
Use IsWindowsXPOrGreater instead of the deprecated GetVersionEx.
-rw-r--r--src/sysinfo.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/sysinfo.cc b/src/sysinfo.cc
index f45d123..508e44a 100644
--- a/src/sysinfo.cc
+++ b/src/sysinfo.cc
@@ -18,6 +18,7 @@
#ifdef BENCHMARK_OS_WINDOWS
#include <Shlwapi.h>
#include <Windows.h>
+#include <VersionHelpers.h>
#else
#include <fcntl.h>
#include <sys/resource.h>
@@ -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",