[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 094eb04: Fix MS-Windows build with mingw.org's MinGW
From: |
Robert Pluim |
Subject: |
Re: master 094eb04: Fix MS-Windows build with mingw.org's MinGW |
Date: |
Wed, 27 Nov 2019 11:57:05 +0100 |
>>>>> On Tue, 26 Nov 2019 21:33:21 +0200, Eli Zaretskii <address@hidden> said:
>> Date: Tue, 26 Nov 2019 20:50:48 +0200
>> From: Eli Zaretskii <address@hidden>
>> Cc: address@hidden
>>
>> > GetAdaptersAddresses returns wchar_t* for the description field, which
>> > means (I hope), that thereʼs some api for converting it appropriately.
>>
>> We can use wcsstr instead.
Eli> Alternatively, convert to ASCII with pWideCharToMultiByte (see
Eli> filename_to_ansi for an example), and then use strstr.
Does the following work for you? I have neither a wireless card
nor a pre-Vista Windows install.
diff --git a/src/w32.c b/src/w32.c
index cb82d51fb9..c5d9a62925 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -9540,8 +9540,23 @@ network_interface_list (bool full, unsigned short match)
switch (adapter->IfType)
{
case IF_TYPE_ETHERNET_CSMACD:
- ifmt_idx = ETHERNET;
- if_num = eth_count++;
+ /* Windows before Vista reports wireless adapters as
+ Ethernet. Work around by looking at the Description
+ string. */
+ {
+ char description[MAX_UTF8_PATH];
+ if (filename_from_utf16 (adapter->Description, description) == 0
+ && strstr (description, "Wireless "))
+ {
+ ifmt_idx = WLAN;
+ if_num = wlan_count++;
+ }
+ else
+ {
+ ifmt_idx = ETHERNET;
+ if_num = eth_count++;
+ }
+ }
break;
case IF_TYPE_ISO88025_TOKENRING:
ifmt_idx = TOKENRING;