From 386d5b1e907ccdda70c8472f126634aa8c4ddb23 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Wed, 27 Sep 2023 13:00:50 -0400
Subject: [PATCH] Try to only define `_WIN32_WINNT` if necessary.
---
src/SDL_net.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/SDL_net.c b/src/SDL_net.c
index 86ddf7a..e0ce2ed 100644
--- a/src/SDL_net.c
+++ b/src/SDL_net.c
@@ -1,8 +1,16 @@
#include "SDL3_net/SDL_net.h"
#ifdef __WINDOWS__
+// we need APIs that didn't arrive until Windows Vista.
+#ifdef _WIN32_WINNT
+ #if _WIN32_WINNT < 0x0600
+ #undef _WIN32_WINNT
+ #endif
+#endif
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0600
+#endif
#define WIN32_LEAN_AND_MEAN 1
-#define _WIN32_WINNT 0x0600 /* we need APIs that didn't arrive until Windows Vista. */
#include <winsock2.h>
#include <ws2tcpip.h>
#include <iphlpapi.h>