From 2cc5834033db61fb7adc242fb15f7d1e13f66c14 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Fri, 16 Jan 2026 09:19:01 +0100 Subject: [PATCH] threads: don't force _WIN32_WINNT to Vista if it's set to a higher value This will prevent Universal Windows Platform (UWP) targeting Windows 10+ to fail. Some UWP API's that are XP/Vista/7 API's are not available in Windows 8 but available in Windows 10. So if Windows 10 is targetting we should not pretend to build for Windows Vista (0x0600). If the user didn't set a _WIN32_WINNT value, the Windows SDK/mingw-w64 have a default value that will be used. We can use sdkddkver.h to get that value. If the default value is Windows 10 we should not lower it either. --- include/private/threads.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/include/private/threads.h b/include/private/threads.h index bb187869c..823e325ee 100644 --- a/include/private/threads.h +++ b/include/private/threads.h @@ -7,9 +7,16 @@ #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #ifdef _WIN32_WINNT - #undef _WIN32_WINNT + #if _WIN32_WINNT < 0x0600 + #undef _WIN32_WINNT + #endif + #else + /* get the default version of the SDK */ + #include + #endif + #ifndef _WIN32_WINNT + #define _WIN32_WINNT 0x0600 #endif - #define _WIN32_WINNT 0x0600 #include #define HAVE_WIN32_THREADS #else