aboutsummaryrefslogtreecommitdiff
path: root/libssh/connect.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-08-20 11:30:38 +0200
committerAndreas Schneider <mail@cynapses.org>2009-08-20 11:43:37 +0200
commit461e46b814a5b49ffaebd308ddb6ed886f2913fd (patch)
treeb15fe91fcb6d5613fc1956aa91b70ad2611f599f /libssh/connect.c
parent4f951461517f3c5430fa87c1594c5f8e6756662c (diff)
downloadlibssh-461e46b814a5b49ffaebd308ddb6ed886f2913fd.tar.gz
libssh-461e46b814a5b49ffaebd308ddb6ed886f2913fd.tar.xz
libssh-461e46b814a5b49ffaebd308ddb6ed886f2913fd.zip
Improve checks for Windows version and wspiapi.h.
Diffstat (limited to 'libssh/connect.c')
-rw-r--r--libssh/connect.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/libssh/connect.c b/libssh/connect.c
index e08cd16c..d8898ef6 100644
--- a/libssh/connect.c
+++ b/libssh/connect.c
@@ -28,13 +28,25 @@
#include <string.h>
#ifdef _WIN32
-/* getaddrinfo, freeaddrinfo, getnameinfo */
-#define _WIN32_WINNT 0x0501
+/*
+ * Only use Windows API functions available on Windows 2000 SP4 or later.
+ * The available constants are in <sdkddkver.h>.
+ * http://msdn.microsoft.com/en-us/library/aa383745.aspx
+ * http://blogs.msdn.com/oldnewthing/archive/2007/04/11/2079137.aspx
+ */
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0500 /* _WIN32_WINNT_WIN2K */
+#undef NTDDI_VERSION
+#define NTDDI_VERSION 0x05000400 /* NTDDI_WIN2KSP4 */
#include <winsock2.h>
#include <ws2tcpip.h>
-#include "wspiapi.h" /* Workaround for w2k systems */
+/* <wspiapi.h> is necessary for getaddrinfo before Windows XP, but it isn't
+ * available on some platforms like MinGW. */
+#ifdef HAVE_WSPIAPI_H
+#include <wspiapi.h>
+#endif
#else /* _WIN32 */