[PATCH] netprofm: Fix connection_GetAdapterId return wrong GUID.

Bernhard Kölbl besentv at gmail.com
Mon Feb 8 16:03:55 CST 2021


The index of a network interface is not a valid GUID.
AdapterName holds the correct GUID and should be used instead.

Signed-off-by: Bernhard Kölbl <besentv at gmail.com>
---
 dlls/netprofm/Makefile.in |  2 +-
 dlls/netprofm/list.c      | 12 ++++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/dlls/netprofm/Makefile.in b/dlls/netprofm/Makefile.in
index d57d1d60c45..3d1d225d3df 100644
--- a/dlls/netprofm/Makefile.in
+++ b/dlls/netprofm/Makefile.in
@@ -1,5 +1,5 @@
 MODULE    = netprofm.dll
-IMPORTS   = iphlpapi
+IMPORTS   = iphlpapi ole32
 
 EXTRADLLFLAGS = -mno-cygwin
 
diff --git a/dlls/netprofm/list.c b/dlls/netprofm/list.c
index f9b9e2ea312..b37d7e2943e 100644
--- a/dlls/netprofm/list.c
+++ b/dlls/netprofm/list.c
@@ -1587,9 +1587,10 @@ static HRESULT WINAPI connection_GetAdapterId(
 {
     struct connection *connection = impl_from_INetworkConnection( iface );
 
-    FIXME( "%p, %p\n", iface, pgdAdapterId );
-
     *pgdAdapterId = connection->id;
+
+    TRACE("Iface: %p, AdapterId %s\n", iface, wine_dbgstr_guid(pgdAdapterId));
+
     return S_OK;
 }
 
@@ -1736,8 +1737,11 @@ static void init_networks( struct list_manager *mgr )
     {
         struct network *network;
         struct connection *connection;
-
-        id.Data1 = aa->u.s.IfIndex;
+        OLECHAR adapter_guid_string[39];
+        
+        /* Convert AdapterName (a GUID string) to a GUID struct */
+        MultiByteToWideChar(CP_ACP, 0, aa->AdapterName, -1, adapter_guid_string, 39);
+        if(CLSIDFromString(adapter_guid_string, &id)) goto done;
 
         /* assume a one-to-one mapping between networks and connections */
         if (!(network = create_network( &id ))) goto done;
-- 
2.30.0




More information about the wine-devel mailing list