DEV9: Use FriendlyName for Pcap adapters on windows

This commit is contained in:
TheLastRar 2021-01-12 10:40:10 +00:00 committed by refractionpcsx2
parent 802c18cb68
commit 33b6cbc2a9
1 changed files with 18 additions and 10 deletions

View File

@ -326,6 +326,13 @@ std::vector<AdapterEntry> PCAPAdapter::GetAdapters()
mbstowcs(wEth, d->name, sizeof(config.Eth) - 1);
entry.guid = std::wstring(wEth);
IP_ADAPTER_ADDRESSES adapterInfo;
if (GetAdapterFromPcapName(d->name, &adapterInfo))
entry.name = std::wstring(adapterInfo.FriendlyName);
else
{
//have to use description
//NPCAP 1.10 is using an version of pcap that dosn't
//allow us to set it to use UTF8
//see https://github.com/nmap/npcap/issues/276
@ -337,6 +344,7 @@ std::vector<AdapterEntry> PCAPAdapter::GetAdapters()
MultiByteToWideChar(CP_ACP, 0, d->description, len_desc, buf, len_buf);
entry.name = std::wstring(buf);
delete[] buf;
}
#else
entry.name = std::string(d->name);
entry.guid = std::string(d->name);