Skip to content

Commit 311fcc6

Browse files
committed
[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
1 parent c1c1279 commit 311fcc6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

base/applications/network/wlanconf/wlanconf.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
/*
22
* PROJECT: ReactOS WLAN command-line configuration utility
3-
* LICENSE: GPL - See COPYING in the top level directory
4-
* FILE: base/applications/network/wlanconf/wlanconf.c
3+
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
54
* PURPOSE: Allows WLAN configuration via the command prompt
6-
* COPYRIGHT: Copyright 2012 Cameron Gutman ([email protected])
5+
* COPYRIGHT: Copyright 2012 Cameron Gutman <[email protected]>
76
*/
87

98
#include <stdio.h>
@@ -183,8 +182,13 @@ OpenAdapterHandle(DWORD Index, HANDLE *hAdapter, IP_ADAPTER_INDEX_MAP *IpInfo)
183182

184183
for (i = 0; i < InterfaceInfo->NumAdapters; i++)
185184
{
185+
PWCHAR InterfaceGuid = wcschr(InterfaceInfo->Adapter[i].Name, L'{');
186+
187+
if (InterfaceGuid == NULL)
188+
continue;
189+
186190
if (wcsstr((PWCHAR)((PUCHAR)QueryBinding + QueryBinding->DeviceNameOffset),
187-
InterfaceInfo->Adapter[i].Name))
191+
InterfaceGuid))
188192
{
189193
*IpInfo = InterfaceInfo->Adapter[i];
190194
*hAdapter = hDriver;

0 commit comments

Comments
 (0)