Skip to content

curl_setup.h: move UWP detection after config-win32.h (revert)#18014

Closed
vszakats wants to merge 1 commit intocurl:masterfrom
vszakats:w-rev
Closed

curl_setup.h: move UWP detection after config-win32.h (revert)#18014
vszakats wants to merge 1 commit intocurl:masterfrom
vszakats:w-rev

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Jul 24, 2025

This change wasn't good because config-win32.h does rely on the UWP
detection result to set USE_WIN32_CRYPTO and LDAP macros. While it
fixed one issue, it created another.

It seems better to revert, and focus on reducing and/or eventually
dropping the logic within config-win32.h that alters _WIN32_WINNT.
It may not be necessary anymore with a minimum of VS2008 (soon VS2010).
The logic is also absent from cmake builds, without causing issues.

Could affect UWP winbuild/project-file builds. These are theoretical
builds because neither build method is prepared to target UWP.

Reverts 792a61e #17980
Ref: #17980 (comment)

This change wasn't good because `config-win32.h` does rely on the UWP
detection result to set `USE_WIN32_CRYPTO` and LDAP macros. While it
fixed one issue, it created another.

It seems better to revert, and focus on reducing and/or eventually
dropping the logic within `config-win32.h` that alters `_WIN32_WINNT`.
It may not be necessary anymore with a minimum of VS2008 (soon VS2010).
The logic is also absent from cmake builds, without causing issues.

Builds affected winbuild/project-file for UWP. These are theoretical
builds because neither build method is prepared to target UWP.

Reverts 792a61e curl#17980
@vszakats vszakats added Windows Windows-specific build labels Jul 24, 2025
@vszakats vszakats marked this pull request as draft July 24, 2025 19:26
@vszakats
Copy link
Member Author

Another way of fixing the UWP/_WIN32_WINNT order conflict:

--- a/lib/config-win32.h
+++ b/lib/config-win32.h
@@ -422,17 +422,12 @@
 #ifdef CURL_HAS_OPENLDAP_LDAPSDK
 #undef USE_WIN32_LDAP
 #define HAVE_LDAP_URL_PARSE 1
-#elif !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE)
+#else
 #undef HAVE_LDAP_URL_PARSE
 #define HAVE_LDAP_SSL 1
 #define USE_WIN32_LDAP 1
 #endif
 
-/* Define to use the Windows crypto library. */
-#ifndef CURL_WINDOWS_UWP
-#define USE_WIN32_CRYPTO
-#endif
-
 /* Define to use Unix sockets. */
 #ifndef UNDER_CE
 #define USE_UNIX_SOCKETS
--- a/lib/curl_setup.h
+++ b/lib/curl_setup.h
@@ -162,6 +162,20 @@
 #      define CURL_WINDOWS_UWP
 #    endif
 #  endif
+
+/* Disable LDAP if not supported by Windows */
+#  if defined(USE_WIN32_LDAP) && \
+     (defined(CURL_WINDOWS_UWP) || defined(UNDER_CE))
+#    undef USE_WIN32_LDAP
+#    undef HAVE_LDAP_SSL
+#  endif
+
+/* Always use Windows crypto in non-UWP builds */
+#  ifndef CURL_WINDOWS_UWP
+#    ifndef USE_WIN32_CRYPTO
+#    define USE_WIN32_CRYPTO
+#    endif
+#  endif
 #endif
 
 /* ================================================================ */

I like it less because it makes this logic also apply to cmake/autotools builds,
doing double work there (with a potential to mess them up if going out of sync
with them), and adding confusion.

@vszakats vszakats marked this pull request as ready for review July 24, 2025 20:23
@vszakats vszakats closed this in 043da5a Jul 24, 2025
@vszakats vszakats deleted the w-rev branch July 24, 2025 21:50
@jay
Copy link
Member

jay commented Jul 25, 2025

It seems better to revert, and focus on reducing and/or eventually
dropping the logic within config-win32.h that alters _WIN32_WINNT.
It may not be necessary anymore with a minimum of VS2008 (soon VS2010).
The logic is also absent from cmake builds, without causing issues.

Sounds reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Windows Windows-specific

Development

Successfully merging this pull request may close these issues.

2 participants