Last active
November 11, 2022 11:54
-
-
Save sthalik/17613fc4eefcae39d4e871d2f2fb7ecd to your computer and use it in GitHub Desktop.
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
#ifdef _WIN32 | |
#include <windows.h> | |
#ifdef _MSC_VER | |
#pragma comment(lib, "ntdll.lib") | |
#endif | |
extern "C" __declspec(dllimport) long WINAPI RtlGetVersion (PRTL_OSVERSIONINFOEXW); | |
static bool check_windows_build_number(unsigned major, unsigned minor, unsigned build) | |
{ | |
if (RTL_OSVERSIONINFOEXW rovi = {.dwOSVersionInfoSize = sizeof(rovi)}; !RtlGetVersion(&rovi)) | |
return rovi.dwMajorVersion > major || | |
rovi.dwMajorVersion == major && rovi.dwMinorVersion > minor || | |
rovi.dwMajorVersion == major && rovi.dwMinorVersion == minor && rovi.dwBuildNumber >= build; | |
else | |
return false; | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment