cURL / Mailing Lists / curl-library / Single Mail

curl-library

MSVC setup.h patch

From: Gisle Vanem <gvanem_at_broadpark.no>
Date: Fri, 26 Mar 2004 14:38:58 +0100

A patch to bypass MS' sillyness with regard to IPv6 and
getaddrinfo().

The CURLDEBUG part is to avoid redefinition warning caused by
memdebug.h. If ENABLE_IPV6 isn't enabled, it doesn't matter since
we never call getaddrinfo(). Allthough we could to support weird protocols
like SOCK_RDM that Win-2K/XP has.

--- CVS-latest/lib/setup.h Sun Mar 21 23:44:52 2004
+++ lib/setup.h Fri Mar 26 14:15:06 2004
@@ -166,6 +166,17 @@
 #define WIN32_LEAN_AND_MEAN /* Prevent including <winsock*.h> in <windows.h> */
 #endif

+#if (defined(ENABLE_IPV6) || defined(CURLDEBUG)) && defined(_MSC_VER) && \
+ (!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0500)
+/*
+ * Needed to pull in the real getaddrinfo() and not the inline version
+ * in <wspiAPI.H> which doesn't support IPv6 (IPv4 only). <wspiAPI.H> is
+ * included from <ws2tcpip.h> for <= 0x0500 SDKs.
+ */
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0600
+#endif
+
 #include <winsock2.h> /* required by telnet.c */

 #if defined(ENABLE_IPV6) || defined(USE_SSLEAY)

--gv
Received on 2004-03-26