[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 61/264: curl_setup: define _WIN32_WINNT_[OS] symbols
From: |
gnunet |
Subject: |
[gnurl] 61/264: curl_setup: define _WIN32_WINNT_[OS] symbols |
Date: |
Thu, 30 Apr 2020 16:06:04 +0200 |
This is an automated email from the git hooks/post-receive script.
nikita pushed a commit to branch master
in repository gnurl.
commit d820224b8b3621c312bd85e0951f470eab6df66a
Author: Jay Satiro <address@hidden>
AuthorDate: Sat Mar 7 03:21:33 2020 -0500
curl_setup: define _WIN32_WINNT_[OS] symbols
.. because not all Windows build systems have those symbols, and even
those that do may be missing newer symbols (eg the Windows 7 SDK does
not define _WIN32_WINNT_WIN10).
Those symbols are used in build-time logic to decide which API to use
and prior to this change if the symbols were missing it would have
resulted in deprecated API being used when more recent functions were
available (eg GetVersionEx used instead of VerifyVersionInfo).
Reported-by: address@hidden
Probably fixes https://github.com/curl/curl/issues/4995
Closes https://github.com/curl/curl/pull/5057
---
lib/curl_setup.h | 58 ++++---------------------
lib/setup-win32.h | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 130 insertions(+), 51 deletions(-)
diff --git a/lib/curl_setup.h b/lib/curl_setup.h
index 4ecda6a9b..5d72403a0 100644
--- a/lib/curl_setup.h
+++ b/lib/curl_setup.h
@@ -231,64 +231,20 @@
#endif
/*
- * Use getaddrinfo to resolve the IPv4 address literal. If the current network
- * interface doesn't support IPv4, but supports IPv6, NAT64, and DNS64,
- * performing this task will result in a synthesized IPv6 address.
- */
-#ifdef __APPLE__
-#define USE_RESOLVE_ON_IPS 1
-#endif
-
-/*
- * Include header files for windows builds before redefining anything.
- * Use this preprocessor block only to include or exclude windows.h,
- * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
- * to any other further and independent block. Under Cygwin things work
- * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
- * never be included when __CYGWIN__ is defined. configure script takes
- * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
- * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
+ * Windows setup file includes some system headers.
*/
#ifdef HAVE_WINDOWS_H
-# if defined(UNICODE) && !defined(_UNICODE)
-# define _UNICODE
-# endif
-# if defined(_UNICODE) && !defined(UNICODE)
-# define UNICODE
-# endif
-# include <winerror.h>
-# include <windows.h>
-# ifdef HAVE_WINSOCK2_H
-# include <winsock2.h>
-# ifdef HAVE_WS2TCPIP_H
-# include <ws2tcpip.h>
-# endif
-# else
-# ifdef HAVE_WINSOCK_H
-# include <winsock.h>
-# endif
-# endif
-# include <tchar.h>
-# ifdef UNICODE
- typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str);
-# endif
+# include "setup-win32.h"
#endif
/*
- * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
- * define USE_WINSOCK to 1 if we have and use WINSOCK API, else
- * undefine USE_WINSOCK.
+ * Use getaddrinfo to resolve the IPv4 address literal. If the current network
+ * interface doesn't support IPv4, but supports IPv6, NAT64, and DNS64,
+ * performing this task will result in a synthesized IPv6 address.
*/
-
-#undef USE_WINSOCK
-
-#ifdef HAVE_WINSOCK2_H
-# define USE_WINSOCK 2
-#else
-# ifdef HAVE_WINSOCK_H
-# define USE_WINSOCK 1
-# endif
+#ifdef __APPLE__
+#define USE_RESOLVE_ON_IPS 1
#endif
#ifdef USE_LWIPSOCK
diff --git a/lib/setup-win32.h b/lib/setup-win32.h
new file mode 100644
index 000000000..45b584766
--- /dev/null
+++ b/lib/setup-win32.h
@@ -0,0 +1,123 @@
+#ifndef HEADER_CURL_SETUP_WIN32_H
+#define HEADER_CURL_SETUP_WIN32_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <address@hidden>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+/*
+ * Include header files for windows builds before redefining anything.
+ * Use this preprocessor block only to include or exclude windows.h,
+ * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
+ * to any other further and independent block. Under Cygwin things work
+ * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
+ * never be included when __CYGWIN__ is defined. configure script takes
+ * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
+ * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
+ */
+
+#ifdef HAVE_WINDOWS_H
+# if defined(UNICODE) && !defined(_UNICODE)
+# define _UNICODE
+# endif
+# if defined(_UNICODE) && !defined(UNICODE)
+# define UNICODE
+# endif
+# include <winerror.h>
+# include <windows.h>
+# ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+# ifdef HAVE_WS2TCPIP_H
+# include <ws2tcpip.h>
+# endif
+# else
+# ifdef HAVE_WINSOCK_H
+# include <winsock.h>
+# endif
+# endif
+# include <tchar.h>
+# ifdef UNICODE
+ typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str);
+# endif
+#endif
+
+/*
+ * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
+ * define USE_WINSOCK to 1 if we have and use WINSOCK API, else
+ * undefine USE_WINSOCK.
+ */
+
+#undef USE_WINSOCK
+
+#ifdef HAVE_WINSOCK2_H
+# define USE_WINSOCK 2
+#else
+# ifdef HAVE_WINSOCK_H
+# define USE_WINSOCK 1
+# endif
+#endif
+
+/*
+ * Define _WIN32_WINNT_[OS] symbols because not all Windows build systems have
+ * those symbols to compare against, and even those that do may be missing
+ * newer symbols.
+ */
+
+#ifndef _WIN32_WINNT_NT4
+#define _WIN32_WINNT_NT4 0x0400 /* Windows NT 4.0 */
+#endif
+#ifndef _WIN32_WINNT_WIN2K
+#define _WIN32_WINNT_WIN2K 0x0500 /* Windows 2000 */
+#endif
+#ifndef _WIN32_WINNT_WINXP
+#define _WIN32_WINNT_WINXP 0x0501 /* Windows XP */
+#endif
+#ifndef _WIN32_WINNT_WS03
+#define _WIN32_WINNT_WS03 0x0502 /* Windows Server 2003 */
+#endif
+#ifndef _WIN32_WINNT_WIN6
+#define _WIN32_WINNT_WIN6 0x0600 /* Windows Vista */
+#endif
+#ifndef _WIN32_WINNT_VISTA
+#define _WIN32_WINNT_VISTA 0x0600 /* Windows Vista */
+#endif
+#ifndef _WIN32_WINNT_WS08
+#define _WIN32_WINNT_WS08 0x0600 /* Windows Server 2008 */
+#endif
+#ifndef _WIN32_WINNT_LONGHORN
+#define _WIN32_WINNT_LONGHORN 0x0600 /* Windows Vista */
+#endif
+#ifndef _WIN32_WINNT_WIN7
+#define _WIN32_WINNT_WIN7 0x0601 /* Windows 7 */
+#endif
+#ifndef _WIN32_WINNT_WIN8
+#define _WIN32_WINNT_WIN8 0x0602 /* Windows 8 */
+#endif
+#ifndef _WIN32_WINNT_WINBLUE
+#define _WIN32_WINNT_WINBLUE 0x0603 /* Windows 8.1 */
+#endif
+#ifndef _WIN32_WINNT_WINTHRESHOLD
+#define _WIN32_WINNT_WINTHRESHOLD 0x0A00 /* Windows 10 */
+#endif
+#ifndef _WIN32_WINNT_WIN10
+#define _WIN32_WINNT_WIN10 0x0A00 /* Windows 10 */
+#endif
+
+#endif /* HEADER_CURL_SETUP_WIN32_H */
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnurl] 116/264: sockfilt: fix race-condition of waiting threads and event handling, (continued)
- [gnurl] 116/264: sockfilt: fix race-condition of waiting threads and event handling, gnunet, 2020/04/30
- [gnurl] 128/264: appveyor: use random test server ports based upon APPVEYOR_API_URL, gnunet, 2020/04/30
- [gnurl] 115/264: CI-fuzz: increase fuzz time to 40 minutes, gnunet, 2020/04/30
- [gnurl] 126/264: appveyor: show failed tests in log even if test is ignored, gnunet, 2020/04/30
- [gnurl] 101/264: checksrc: warn on obvious conditional blocks on the same line as if(), gnunet, 2020/04/30
- [gnurl] 133/264: scripts/release-notes.pl: add helper script for RELEASE-NOTES maintenance, gnunet, 2020/04/30
- [gnurl] 132/264: configure: don't check for Security.framework when cross-compiling, gnunet, 2020/04/30
- [gnurl] 74/264: copyright: fix out-of-date copyright ranges and missing headers, gnunet, 2020/04/30
- [gnurl] 39/264: windows: suppress UI in all CryptAcquireContext() calls, gnunet, 2020/04/30
- [gnurl] 53/264: mbedtls: remove the BACKEND define kludge, gnunet, 2020/04/30
- [gnurl] 61/264: curl_setup: define _WIN32_WINNT_[OS] symbols,
gnunet <=
- [gnurl] 55/264: test970: fix static ip:port instead of dynamic values being used, gnunet, 2020/04/30
- [gnurl] 84/264: SSLCERTS.md: Fix example code for setting CA cert file, gnunet, 2020/04/30
- [gnurl] 88/264: writeout_json: Fix data type issues, gnunet, 2020/04/30
- [gnurl] 93/264: KNOWN_BUGS: DoH doesn't inherit all transfer options, gnunet, 2020/04/30
- [gnurl] 179/264: cmake: add aliases so exported target names are available in tree, gnunet, 2020/04/30
- [gnurl] 46/264: writeout_json: use curl_off_t printf() option for the time output, gnunet, 2020/04/30
- [gnurl] 58/264: tests: add test 430, 431 and 432 to verify the --config fix, gnunet, 2020/04/30
- [gnurl] 60/264: curl-functions.m4: remove inappropriate AC_REQUIRE, gnunet, 2020/04/30
- [gnurl] 119/264: KNOWN_BUGS: Store TLS context per transfer instead of per connection, gnunet, 2020/04/30
- [gnurl] 92/264: KNOWN_BUGS: DoH leaks memory after followlocation, gnunet, 2020/04/30