https://git.reactos.org/?p=reactos.git;a=commitdiff;h=311fcc612e6acbc10fed0e388468df8bddb3201a

commit 311fcc612e6acbc10fed0e388468df8bddb3201a
Author:     Stanislav Motylkov <[email protected]>
AuthorDate: Sat Oct 1 14:56:01 2022 +0300
Commit:     Stanislav Motylkov <[email protected]>
CommitDate: Sun Oct 2 15:36:45 2022 +0300

    [WLANCONF] Fix getting the interface GUID value
    
    GetInterfaceInfo returns interface name in Windows XP and 2003
    in this format: `\DEVICE\TCPIP_{GUID}`.
    
    MSDN says that the `Name` member of the `IP_ADAPTER_INDEX_MAP`
    may start with '{' character on Windows Vista and later.
    
https://docs.microsoft.com/en-us/windows/win32/api/ipexport/ns-ipexport-ip_adapter_index_map
    
    Change the code to support both cases. CORE-18032
---
 base/applications/network/wlanconf/wlanconf.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/base/applications/network/wlanconf/wlanconf.c 
b/base/applications/network/wlanconf/wlanconf.c
index 15a4de177f5..2cfb2887351 100644
--- a/base/applications/network/wlanconf/wlanconf.c
+++ b/base/applications/network/wlanconf/wlanconf.c
@@ -1,9 +1,8 @@
 /*
  * PROJECT:     ReactOS WLAN command-line configuration utility
- * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        base/applications/network/wlanconf/wlanconf.c
+ * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
  * PURPOSE:     Allows WLAN configuration via the command prompt
- * COPYRIGHT:   Copyright 2012 Cameron Gutman ([email protected])
+ * COPYRIGHT:   Copyright 2012 Cameron Gutman <[email protected]>
  */
 
 #include <stdio.h>
@@ -183,8 +182,13 @@ OpenAdapterHandle(DWORD Index, HANDLE *hAdapter, 
IP_ADAPTER_INDEX_MAP *IpInfo)
 
     for (i = 0; i < InterfaceInfo->NumAdapters; i++)
     {
+        PWCHAR InterfaceGuid = wcschr(InterfaceInfo->Adapter[i].Name, L'{');
+
+        if (InterfaceGuid == NULL)
+            continue;
+
         if (wcsstr((PWCHAR)((PUCHAR)QueryBinding + 
QueryBinding->DeviceNameOffset),
-                   InterfaceInfo->Adapter[i].Name))
+                   InterfaceGuid))
         {
             *IpInfo = InterfaceInfo->Adapter[i];
             *hAdapter = hDriver;

Reply via email to