Huw Davies : iphlpapi: Implement if_nametoindex() using the ConvertInterface* functions.

Alexandre Julliard julliard at winehq.org
Fri Jul 2 14:46:40 CDT 2021


Module: wine
Branch: master
Commit: 259f7c7c4771f0e7763a18418bd298884cc29188
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=259f7c7c4771f0e7763a18418bd298884cc29188

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri Jul  2 09:41:34 2021 +0100

iphlpapi: Implement if_nametoindex() using the ConvertInterface* functions.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/iphlpapi/iphlpapi_main.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c
index a774e60c3d9..aaa6a80c19e 100644
--- a/dlls/iphlpapi/iphlpapi_main.c
+++ b/dlls/iphlpapi/iphlpapi_main.c
@@ -3357,13 +3357,18 @@ DWORD WINAPI ConvertLengthToIpv4Mask(ULONG mask_len, ULONG *mask)
  */
 IF_INDEX WINAPI IPHLP_if_nametoindex(const char *name)
 {
-    IF_INDEX idx;
+    IF_INDEX index;
+    NET_LUID luid;
+    DWORD err;
 
-    TRACE("(%s)\n", name);
-    if (getInterfaceIndexByName(name, &idx) == NO_ERROR)
-        return idx;
+    TRACE( "(%s)\n", name );
 
-    return 0;
+    err = ConvertInterfaceNameToLuidA( name, &luid );
+    if (err) return 0;
+
+    err = ConvertInterfaceLuidToIndex( &luid, &index );
+    if (err) index = 0;
+    return index;
 }
 
 /******************************************************************




More information about the wine-cvs mailing list