[glib] W32: Bump target NT version to 0x601 (7 or newer)



commit 6abdc06da66707fbf25b88a44e4b5340089ae9a5
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date:   Fri Sep 29 10:12:55 2017 +0000

    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 insertions(+), 58 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 21be55b..c0825d7 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 85859be..2d4669b 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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]