api: make adapter name searching more efficient
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
4c131caa7d
commit
af937e52eb
@ -605,13 +605,16 @@ WintunGetAdapter(
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* TODO: is there a better way than comparing ifnames? */
|
/* TODO: is there a better way than comparing ifnames? */
|
||||||
WCHAR Name2[MAX_ADAPTER_NAME], Name3[MAX_ADAPTER_NAME];
|
WCHAR Name2[MAX_ADAPTER_NAME];
|
||||||
if (NciGetConnectionName(&CfgInstanceID, Name2, sizeof(Name2), NULL) != ERROR_SUCCESS)
|
if (NciGetConnectionName(&CfgInstanceID, Name2, sizeof(Name2), NULL) != ERROR_SUCCESS)
|
||||||
continue;
|
continue;
|
||||||
Name2[_countof(Name2) - 1] = 0;
|
Name2[_countof(Name2) - 1] = 0;
|
||||||
RemoveNumberedSuffix(Name2, Name3);
|
if (_wcsicmp_l(Name, Name2, Locale))
|
||||||
if (_wcsicmp_l(Name, Name2, Locale) && _wcsicmp_l(Name, Name3, Locale))
|
{
|
||||||
continue;
|
RemoveNumberedSuffix(Name2, Name2);
|
||||||
|
if (_wcsicmp_l(Name, Name2, Locale))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check the Hardware ID to make sure it's a real Wintun device. This avoids doing slow operations on non-Wintun
|
/* Check the Hardware ID to make sure it's a real Wintun device. This avoids doing slow operations on non-Wintun
|
||||||
* devices. */
|
* devices. */
|
||||||
|
Loading…
Reference in New Issue
Block a user