Skip to content

Instantly share code, notes, and snippets.

@ijat
Created September 5, 2020 03:22
Show Gist options
  • Save ijat/396663fc902683f9a86be84a7fcd88c5 to your computer and use it in GitHub Desktop.
Save ijat/396663fc902683f9a86be84a7fcd88c5 to your computer and use it in GitHub Desktop.
Check if Windows 8.1 or higher c++
bool IsWindows81orHigher() {
NTSTATUS(WINAPI * RtlGetVersion)(LPOSVERSIONINFOEXW);
OSVERSIONINFOEXW osInfo;
*(FARPROC*)&RtlGetVersion = GetProcAddress(GetModuleHandleA("ntdll"), "RtlGetVersion");
if (NULL != RtlGetVersion)
{
osInfo.dwOSVersionInfoSize = sizeof(osInfo);
RtlGetVersion(&osInfo);
return (osInfo.dwMajorVersion >= 6 && osInfo.dwMinorVersion >= 3) || osInfo.dwMajorVersion >= 10;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment