-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add system check and block on new windows versions
- Loading branch information
Showing
4 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "./sys_check.hpp" | ||
|
||
// use message boxes to notify the user of system failure | ||
#include <SDL3/SDL.h> | ||
|
||
#include <cstdlib> | ||
|
||
#if defined(_WIN32) || defined(WIN32) | ||
|
||
#ifndef WIN32_LEAN_AND_MEAN | ||
#define WIN32_LEAN_AND_MEAN | ||
#endif | ||
|
||
#include <windows.h> | ||
#include <winnt.h> | ||
|
||
void runSysCheck(void) { | ||
NTSTATUS(WINAPI *RtlGetVersion)(LPOSVERSIONINFOEXW); | ||
OSVERSIONINFOEXW osInfo; | ||
|
||
*(FARPROC*)&RtlGetVersion = GetProcAddress(GetModuleHandleA("ntdll"), "RtlGetVersion"); | ||
|
||
if (NULL != RtlGetVersion) { | ||
osInfo.dwOSVersionInfoSize = sizeof(osInfo); | ||
RtlGetVersion(&osInfo); | ||
|
||
// check | ||
if ( | ||
osInfo.dwBuildNumber >= 26000 // canary versions of 11 24H2 included | ||
) { | ||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Unsupported System", "Your version of windows is too new and endangers the privacy of all involved.", nullptr); | ||
exit(0); | ||
} | ||
} | ||
} | ||
|
||
#else | ||
|
||
void runSysCheck(void) { | ||
// do nothing | ||
} | ||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#pragma once | ||
|
||
// perform system checks and potentially terminate | ||
void runSysCheck(void); |