From 24f8442e6a9d76bc51ea6e6026b5cc3479050c53 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 20 Jul 2025 23:24:26 +0200 Subject: [PATCH] windows: target version macro tidy-ups - autotools: stop checking for `WINVER` to detect thread-safety. To sync with implementation in `easy_lock.h` and with cmake. - replace numeric version with `_WIN32_WINNT_VISTA`. - `_WIN32_WINNT_VISTA` is always defined via `setup-win32.h`, don't check for it. Closes #17981 --- configure.ac | 2 +- lib/curl_threads.c | 3 +-- lib/curl_threads.h | 3 +-- lib/idn.c | 2 +- lib/rand.c | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 2d04f91051..acf253eadc 100644 --- a/configure.ac +++ b/configure.ac @@ -5382,7 +5382,7 @@ else AC_LANG_PROGRAM([[ #include ]],[[ - #if (WINVER < 0x600) && (_WIN32_WINNT < 0x600) + #if (_WIN32_WINNT < 0x600) #error #endif ]]) diff --git a/lib/curl_threads.c b/lib/curl_threads.c index 24561a6dde..ed1ad30e73 100644 --- a/lib/curl_threads.c +++ b/lib/curl_threads.c @@ -142,8 +142,7 @@ void Curl_thread_destroy(curl_thread_t *hnd) int Curl_thread_join(curl_thread_t *hnd) { -#if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_VISTA) || \ - (_WIN32_WINNT < _WIN32_WINNT_VISTA) +#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < _WIN32_WINNT_VISTA) int ret = (WaitForSingleObject(*hnd, INFINITE) == WAIT_OBJECT_0); #else int ret = (WaitForSingleObjectEx(*hnd, INFINITE, FALSE) == WAIT_OBJECT_0); diff --git a/lib/curl_threads.h b/lib/curl_threads.h index fb74561ffa..3428fcd968 100644 --- a/lib/curl_threads.h +++ b/lib/curl_threads.h @@ -39,8 +39,7 @@ # define curl_mutex_t CRITICAL_SECTION # define curl_thread_t HANDLE # define curl_thread_t_null (HANDLE)0 -# if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_VISTA) || \ - (_WIN32_WINNT < _WIN32_WINNT_VISTA) +# if !defined(_WIN32_WINNT) || (_WIN32_WINNT < _WIN32_WINNT_VISTA) # define Curl_mutex_init(m) InitializeCriticalSection(m) # else # define Curl_mutex_init(m) InitializeCriticalSectionEx(m, 0, 1) diff --git a/lib/idn.c b/lib/idn.c index 798c9aaef1..2d56043293 100644 --- a/lib/idn.c +++ b/lib/idn.c @@ -152,7 +152,7 @@ static CURLcode mac_ascii_to_idn(const char *in, char **out) #ifdef USE_WIN32_IDN /* using Windows kernel32 and normaliz libraries. */ -#if (!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x600) && \ +#if (!defined(_WIN32_WINNT) || _WIN32_WINNT < _WIN32_WINNT_VISTA) && \ (!defined(WINVER) || WINVER < 0x600) WINBASEAPI int WINAPI IdnToAscii(DWORD dwFlags, const WCHAR *lpUnicodeCharStr, diff --git a/lib/rand.c b/lib/rand.c index 72545e0867..4bff30d677 100644 --- a/lib/rand.c +++ b/lib/rand.c @@ -48,7 +48,7 @@ #ifdef _WIN32 -#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600 && \ +#if defined(_WIN32_WINNT) && _WIN32_WINNT >= _WIN32_WINNT_VISTA && \ !defined(CURL_WINDOWS_UWP) # define HAVE_WIN_BCRYPTGENRANDOM # include -- 2.47.2