From 6abdc06da66707fbf25b88a44e4b5340089ae9a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?= =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= Date: Fri, 29 Sep 2017 10:12:55 +0000 Subject: [PATCH] W32: Bump target NT version to 0x601 (7 or newer) Also remove now-unnecessary if_nametoindex() implementation (the HAVE_IF_NAMETOINDEX configure check didn't work correctly, it turned out), which prevents glib from building. if_nametoindex() is available in lphlpapi since Vista[1], so we don't need a compatibility function for it anymore, as Windows 7 is the new minimally-required version. [1] https://msdn.microsoft.com/en-us/library/windows/desktop/bb408409(v=vs.85).aspx https://bugzilla.gnome.org/show_bug.cgi?id=788180 --- configure.ac | 2 +- gio/gsocket.c | 57 --------------------------------------------------- 2 files changed, 1 insertion(+), 58 deletions(-) diff --git a/configure.ac b/configure.ac index 21be55b36..c0825d7f0 100644 --- a/configure.ac +++ b/configure.ac @@ -144,7 +144,7 @@ case "$host" in ;; esac - AC_DEFINE([_WIN32_WINNT], [0x0501], [Target the Windows XP API]) + AC_DEFINE([_WIN32_WINNT], [0x0601], [Target the Windows 7 API]) ;; *) glib_native_win32=no diff --git a/gio/gsocket.c b/gio/gsocket.c index 85859bea3..2d4669be0 100644 --- a/gio/gsocket.c +++ b/gio/gsocket.c @@ -2155,63 +2155,6 @@ g_socket_bind (GSocket *socket, return TRUE; } -#if !defined(HAVE_IF_NAMETOINDEX) && defined(G_OS_WIN32) -static guint -if_nametoindex (const gchar *iface) -{ - PIP_ADAPTER_ADDRESSES addresses = NULL, p; - gulong addresses_len = 0; - guint idx = 0; - DWORD res; - - if (ws2funcs.pIfNameToIndex != NULL) - return ws2funcs.pIfNameToIndex (iface); - - res = GetAdaptersAddresses (AF_UNSPEC, 0, NULL, NULL, &addresses_len); - if (res != NO_ERROR && res != ERROR_BUFFER_OVERFLOW) - { - if (res == ERROR_NO_DATA) - errno = ENXIO; - else - errno = EINVAL; - return 0; - } - - addresses = g_malloc (addresses_len); - res = GetAdaptersAddresses (AF_UNSPEC, 0, NULL, addresses, &addresses_len); - - if (res != NO_ERROR) - { - g_free (addresses); - if (res == ERROR_NO_DATA) - errno = ENXIO; - else - errno = EINVAL; - return 0; - } - - p = addresses; - while (p) - { - if (strcmp (p->AdapterName, iface) == 0) - { - idx = p->IfIndex; - break; - } - p = p->Next; - } - - if (p == NULL) - errno = ENXIO; - - g_free (addresses); - - return idx; -} - -#define HAVE_IF_NAMETOINDEX 1 -#endif - static gboolean g_socket_multicast_group_operation (GSocket *socket, GInetAddress *group,