SDL: windows: Added WIN_IsWindowsXP, for extreme runtime compatibility checks.

From 2144c2ac7134518e124124dc6267a76a01497d6c Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 25 Jan 2024 18:18:15 -0500
Subject: [PATCH] windows: Added WIN_IsWindowsXP, for extreme runtime
 compatibility checks.

Reference Issue #8666.
---
 src/core/windows/SDL_windows.c | 9 +++++++++
 src/core/windows/SDL_windows.h | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/src/core/windows/SDL_windows.c b/src/core/windows/SDL_windows.c
index ba5b6cbee48e..e7e0bc56d511 100644
--- a/src/core/windows/SDL_windows.c
+++ b/src/core/windows/SDL_windows.c
@@ -211,6 +211,15 @@ static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WO
         return retval;
 #endif
 
+// this is the oldest thing we run on (and we may lose support for this in SDL3 at any time!),
+//  so there's no "OrGreater" as that would always be TRUE. The other functions are here to
+//  ask "can we support a specific feature?" but this function is here to ask "do we need to do
+//  something different for an OS version we probably should abandon?"  :)
+BOOL WIN_IsWindowsXP(void)
+{
+    CHECKWINVER(FALSE, !WIN_IsWindowsVistaOrGreater() && IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 0));
+}
+
 BOOL WIN_IsWindowsVistaOrGreater(void)
 {
     CHECKWINVER(TRUE, IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0));
diff --git a/src/core/windows/SDL_windows.h b/src/core/windows/SDL_windows.h
index c12f9c432c7b..850b4ecac493 100644
--- a/src/core/windows/SDL_windows.h
+++ b/src/core/windows/SDL_windows.h
@@ -145,6 +145,9 @@ extern void WIN_CoUninitialize(void);
 extern HRESULT WIN_RoInitialize(void);
 extern void WIN_RoUninitialize(void);
 
+/* Returns SDL_TRUE if we're running on Windows XP (any service pack). DOES NOT CHECK XP "OR GREATER"! */
+extern BOOL WIN_IsWindowsXP(void);
+
 /* Returns SDL_TRUE if we're running on Windows Vista and newer */
 extern BOOL WIN_IsWindowsVistaOrGreater(void);