mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
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
This commit is contained in:
parent
b444ae0de2
commit
6abdc06da6
@ -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
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user