Path: blob/main_old/src/third_party/systeminfo/SystemInfo.cpp
1693 views
/*1* Copyright (C) 2009 Apple Inc. All Rights Reserved.2*3* Redistribution and use in source and binary forms, with or without4* modification, are permitted provided that the following conditions5* are met:6* 1. Redistributions of source code must retain the above copyright7* notice, this list of conditions and the following disclaimer.8* 2. Redistributions in binary form must reproduce the above copyright9* notice, this list of conditions and the following disclaimer in the10* documentation and/or other materials provided with the distribution.11*12* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY13* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE14* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR15* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR16* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,17* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,18* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR19* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY20* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT21* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE22* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.23*/2425#include <windows.h>26#include "common/platform.h"2728#if _WIN32_WINNT_WINBLUE29# include <versionhelpers.h>30#endif3132namespace rx33{3435#ifndef _WIN32_WINNT_WINBLUE36static bool IsWindowsVistaOrGreater()37{38OSVERSIONINFOEXW osvi = {};39osvi.dwOSVersionInfoSize = sizeof(osvi);40osvi.dwMajorVersion = HIBYTE(_WIN32_WINNT_VISTA);41osvi.dwMinorVersion = LOBYTE(_WIN32_WINNT_VISTA);42DWORDLONG condition = 0;43VER_SET_CONDITION(condition, VER_MAJORVERSION, VER_GREATER_EQUAL);44VER_SET_CONDITION(condition, VER_MINORVERSION, VER_GREATER_EQUAL);45return !!::VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION, condition);46}47#endif4849bool isWindowsVistaOrGreater()50{51static bool initialized = false;52static bool cachedIsWindowsVistaOrGreater;5354if (!initialized)55{56initialized = true;57#if defined(ANGLE_ENABLE_WINDOWS_STORE)58cachedIsWindowsVistaOrGreater = true;59#else60cachedIsWindowsVistaOrGreater = IsWindowsVistaOrGreater();61#endif62}63return cachedIsWindowsVistaOrGreater;64}6566} // namespace rx676869