From 33336d0369181dd5d9749294d2b78280fe5bffe9 Mon Sep 17 00:00:00 2001 From: "Carl J. Bialorucki" Date: Thu, 3 Jul 2025 14:51:10 -0600 Subject: [PATCH] [APITESTS] Add GetNTVersion() macro for version detection on Windows 8.x+ (#8225) Grab the NT version from KUSER_SHARED_DATA and expose it in GetNTVersion(). --- modules/rostests/apitests/include/apitest.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/rostests/apitests/include/apitest.h b/modules/rostests/apitests/include/apitest.h index 083925f4b6d..40a3ac0471e 100644 --- a/modules/rostests/apitests/include/apitest.h +++ b/modules/rostests/apitests/include/apitest.h @@ -12,6 +12,10 @@ #define InvalidPointer ((PVOID)0x5555555555555555ULL) // #define InvalidPointer ((PVOID)0x0123456789ABCDEFULL) +/* Magic pointers come from KUSER_SHARED_DATA; needed to get true NT version on Windows 8+ */ +#define KUSER_SHARED_DATA_UMPTR 0x7FFE0000 +#define GetNTVersion() (((*(ULONG*)(KUSER_SHARED_DATA_UMPTR + 0x026C)) << 8) | (*(ULONG*)(KUSER_SHARED_DATA_UMPTR + 0x0270))) + #include #define StartSeh() \