From bbab6359b0a2fa8187c59f81f5c470c0d942fcc1 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Sat, 18 Sep 2021 22:45:29 +0200 Subject: [PATCH] Use KUSER_SHARED_DATA for checking the build number --- TitanEngine/TitanEngine.Debugger.DebugLoop.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/TitanEngine/TitanEngine.Debugger.DebugLoop.cpp b/TitanEngine/TitanEngine.Debugger.DebugLoop.cpp index 3631fff..499104f 100644 --- a/TitanEngine/TitanEngine.Debugger.DebugLoop.cpp +++ b/TitanEngine/TitanEngine.Debugger.DebugLoop.cpp @@ -57,17 +57,11 @@ __declspec(dllexport) void TITCALL DebugLoop() bool IsDbgReplyLaterSupported = false; // Check if DBG_REPLY_LATER is supported based on Windows version (Windows 10, version 1507 or above) - OSVERSIONINFOEXA OSInfo; - OSInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA); - - if (GetVersionExA((LPOSVERSIONINFOA)&OSInfo)) + // https://www.gaijin.at/en/infos/windows-version-numbers + const uint32_t NtBuildNumber = *(uint32_t*)(0x7FFE0000 + 0x260); + if (NtBuildNumber != 0 && NtBuildNumber >= 10240) { - if (OSInfo.wProductType == VER_NT_WORKSTATION && - (OSInfo.dwMajorVersion > 10 || - (OSInfo.dwMajorVersion == 10 && OSInfo.dwBuildNumber >= 1507))) - { - IsDbgReplyLaterSupported = true; - } + IsDbgReplyLaterSupported = true; } DBGFileHandle = NULL;