[PATCH] iphlpapi: Implement if_nametoindex.

Stefan Dösinger stefan at codeweavers.com
Wed May 24 05:39:13 CDT 2017


libtorrent (and game patchers based on it) call this function when they
detect an ipv6-capable internet connection.

Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>

---

I have placed the implementation in iphlpapi_main.c instead of ifenum.c
because ifenum.c right now contains no exported function.
---
 dlls/iphlpapi/iphlpapi.spec   |  2 +-
 dlls/iphlpapi/iphlpapi_main.c | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/dlls/iphlpapi/iphlpapi.spec b/dlls/iphlpapi/iphlpapi.spec
index 4e01926617..4e5970c277 100644
--- a/dlls/iphlpapi/iphlpapi.spec
+++ b/dlls/iphlpapi/iphlpapi.spec
@@ -160,7 +160,7 @@
 @ stdcall IcmpSendEcho2(ptr ptr ptr ptr long ptr long ptr ptr long long)
 @ stdcall IcmpSendEcho(ptr long ptr long ptr ptr long long)
 #@ stub if_indextoname
-#@ stub if_nametoindex
+@ stdcall if_nametoindex(str) IPHLP_if_nametoindex
 #@ stub InitializeIpForwardEntry
 #@ stub InitializeIpInterfaceEntry
 #@ stub InitializeUnicastIpAddressEntry
diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c
index 796950e0f9..4cceb65621 100644
--- a/dlls/iphlpapi/iphlpapi_main.c
+++ b/dlls/iphlpapi/iphlpapi_main.c
@@ -36,6 +36,9 @@
 #ifdef HAVE_RESOLV_H
 # include <resolv.h>
 #endif
+#ifdef HAVE_NET_IF_H
+# include <net/if.h>
+#endif
 
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
@@ -3208,3 +3211,12 @@ DWORD WINAPI ConvertInterfaceNameToLuidW(const WCHAR *name, NET_LUID *luid)
     luid->Info.IfType       = row.dwType;
     return NO_ERROR;
 }
+
+/******************************************************************
+ *    if_nametoindex (IPHLPAPI.@)
+ */
+IF_INDEX WINAPI IPHLP_if_nametoindex(const char *name)
+{
+    TRACE("(%s)\n", name);
+    return if_nametoindex(name);
+}
-- 
2.11.0 (Apple Git-81)




More information about the wine-patches mailing list