mirror of
https://github.com/google/benchmark.git
synced 2025-02-11 20:00:19 +08:00
Use IsWindowsXPOrGreater instead of the deprecated GetVersionEx.
This commit is contained in:
parent
e605cb0802
commit
fcf4e99e01
@ -18,6 +18,7 @@
|
|||||||
#ifdef BENCHMARK_OS_WINDOWS
|
#ifdef BENCHMARK_OS_WINDOWS
|
||||||
#include <Shlwapi.h>
|
#include <Shlwapi.h>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
#include <VersionHelpers.h>
|
||||||
#else
|
#else
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
@ -235,10 +236,8 @@ void InitializeSystemInfo() {
|
|||||||
#elif defined BENCHMARK_OS_WINDOWS
|
#elif defined BENCHMARK_OS_WINDOWS
|
||||||
// In NT, read MHz from the registry. If we fail to do so or we're in win9x
|
// In NT, read MHz from the registry. If we fail to do so or we're in win9x
|
||||||
// then make a crude estimate.
|
// then make a crude estimate.
|
||||||
OSVERSIONINFO os;
|
|
||||||
os.dwOSVersionInfoSize = sizeof(os);
|
|
||||||
DWORD data, data_size = sizeof(data);
|
DWORD data, data_size = sizeof(data);
|
||||||
if (GetVersionEx(&os) && os.dwPlatformId == VER_PLATFORM_WIN32_NT &&
|
if (IsWindowsXPOrGreater() &&
|
||||||
SUCCEEDED(
|
SUCCEEDED(
|
||||||
SHGetValueA(HKEY_LOCAL_MACHINE,
|
SHGetValueA(HKEY_LOCAL_MACHINE,
|
||||||
"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0",
|
"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0",
|
||||||
|
Loading…
Reference in New Issue
Block a user