Skip to content

Commit

Permalink
From eebb6614b73b652984a7abc709310187447acd75 Mon Sep 17 00:00:00 2001
Browse files Browse the repository at this point in the history
From: Andrey Nazarov <[email protected]>
Date: Sat, 11 Sep 2021 21:44:30 +0300
Subject: [PATCH 378/396] Use versionhelpers.h to check Windows version.

See NVIDIA#212.
  • Loading branch information
Paril committed Dec 10, 2021
1 parent 25d567c commit f9dde97
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/windows/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#if USE_WINSVC
#include <winsvc.h>
#endif
#include <versionhelpers.h>

HINSTANCE hGlobalInstance;

Expand Down Expand Up @@ -1073,27 +1074,15 @@ Sys_Init
*/
void Sys_Init(void)
{
OSVERSIONINFO vinfo;
#ifndef _WIN64
HMODULE module;
BOOL (WINAPI * pSetProcessDEPPolicy)(DWORD);
#endif
cvar_t *var q_unused;

// check windows version
vinfo.dwOSVersionInfoSize = sizeof(vinfo);
#pragma warning(push)
#pragma warning(disable: 4996) // warning C4996: 'GetVersionExA': was declared deprecated
if (!GetVersionEx(&vinfo)) {
Sys_Error("Couldn't get OS info");
}
#pragma warning(pop)
if (vinfo.dwPlatformId != VER_PLATFORM_WIN32_NT) {
Sys_Error(PRODUCT " requires Windows NT");
}
if (vinfo.dwMajorVersion < 5) {
Sys_Error(PRODUCT " requires Windows 2000 or greater");
}
if (!IsWindowsXPOrGreater())
Sys_Error(PRODUCT " requires Windows XP or greater");

if (!QueryPerformanceFrequency(&timer_freq))
Sys_Error("QueryPerformanceFrequency failed");
Expand Down

0 comments on commit f9dde97

Please sign in to comment.