mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-23 18:09:53 +03:00
Compare commits
No commits in common. "f6c185f2794a0808fdf3e50e709251412839953b" and "fc7093ed36405b6408cd6943ba40e6fd212fa3cf" have entirely different histories.
f6c185f279
...
fc7093ed36
@ -1161,8 +1161,7 @@ void Win32EthMakeCombinedName(char *dst, UINT dst_size, char *nicname, char *gui
|
|||||||
|
|
||||||
if (IsEmptyStr(guid) == false)
|
if (IsEmptyStr(guid) == false)
|
||||||
{
|
{
|
||||||
// Allow to combine "FriendlyName" consisting of a NULL character and ID.
|
Format(dst, dst_size, "%s (ID=%010u)", nicname, Win32EthGenIdFromGuid(guid));
|
||||||
Format(dst, dst_size, "%s(ID=%010u)", nicname, Win32EthGenIdFromGuid(guid));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1186,19 +1185,18 @@ UINT Win32EthGetNameAndIdFromCombinedName(char *name, UINT name_size, char *str)
|
|||||||
|
|
||||||
len = StrLen(str);
|
len = StrLen(str);
|
||||||
|
|
||||||
// Allow to combine "FriendlyName" consisting of a NULL character and ID beginning with "(ID=".
|
if (len >= 16)
|
||||||
if (len >= 15)
|
|
||||||
{
|
{
|
||||||
StrCpy(id_str, sizeof(id_str), str + len - 15);
|
StrCpy(id_str, sizeof(id_str), str + len - 16);
|
||||||
|
|
||||||
if (StartWith(id_str, "(ID="))
|
if (StartWith(id_str, " (ID="))
|
||||||
{
|
{
|
||||||
if (EndWith(id_str, ")"))
|
if (EndWith(id_str, ")"))
|
||||||
{
|
{
|
||||||
char num[MAX_SIZE];
|
char num[MAX_SIZE];
|
||||||
|
|
||||||
Zero(num, sizeof(num));
|
Zero(num, sizeof(num));
|
||||||
StrCpy(num, sizeof(num), id_str + 4);
|
StrCpy(num, sizeof(num), id_str + 5);
|
||||||
|
|
||||||
num[StrLen(num) - 1] = 0;
|
num[StrLen(num) - 1] = 0;
|
||||||
|
|
||||||
@ -1206,7 +1204,7 @@ UINT Win32EthGetNameAndIdFromCombinedName(char *name, UINT name_size, char *str)
|
|||||||
|
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
name[len - 15] = 0;
|
name[len - 16] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1348,8 +1346,6 @@ TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden, bool enum_normal, boo
|
|||||||
|
|
||||||
Debug("%s - %s\n", a->Guid, a->Title);
|
Debug("%s - %s\n", a->Guid, a->Title);
|
||||||
}
|
}
|
||||||
// Make sure that "FriendlyName" does not cosist a NULL character.
|
|
||||||
Debug("%s,- s=%d, t=%s, %s,\n", a->Guid, show, tmp, a->Title[0] == 0 ? "check=NG FriendlyName(Title) is NULL !" : "check=OK");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*total_num_including_hidden = ret->NumTokens;
|
*total_num_including_hidden = ret->NumTokens;
|
||||||
@ -1409,7 +1405,7 @@ LIST *GetEthAdapterListInternal()
|
|||||||
UINT size;
|
UINT size;
|
||||||
char *buf;
|
char *buf;
|
||||||
UINT i, j;
|
UINT i, j;
|
||||||
char *qos_tag = "(Microsoft's Packet Scheduler)"; // Allow to combine "FriendlyName" consisting of a NULL character and QOS tag.
|
char *qos_tag = " (Microsoft's Packet Scheduler)";
|
||||||
SU *su = NULL;
|
SU *su = NULL;
|
||||||
LIST *su_adapter_list = NULL;
|
LIST *su_adapter_list = NULL;
|
||||||
|
|
||||||
@ -1664,8 +1660,7 @@ ANSI_STR:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Allow to combine "FriendlyName" consisting of a NULL character and SEQ number.
|
Format(tmp, sizeof(tmp), "%s (%u)", a->Title, k + 1);
|
||||||
Format(tmp, sizeof(tmp), "%s(%u)", a->Title, k + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ok = true;
|
ok = true;
|
||||||
|
@ -753,45 +753,11 @@ LIST *SuGetAdapterList(SU *u)
|
|||||||
for (i = 0;i < u->AdapterInfoList.NumAdapters;i++)
|
for (i = 0;i < u->AdapterInfoList.NumAdapters;i++)
|
||||||
{
|
{
|
||||||
SL_ADAPTER_INFO *info = &u->AdapterInfoList.Adapters[i];
|
SL_ADAPTER_INFO *info = &u->AdapterInfoList.Adapters[i];
|
||||||
|
SU_ADAPTER_LIST *a = SuAdapterInfoToAdapterList(info);
|
||||||
|
|
||||||
if (IsEmptyStr(info->FriendlyName))
|
if (a != NULL)
|
||||||
{
|
{
|
||||||
// Some NetAdapterCx drivers doesn't report the FriendlyName in the kernel mode.
|
Add(ret, a);
|
||||||
// So we attempt to obtain the DriverDesc string from NetCfg registry key alternatively.
|
|
||||||
char regkey[MAX_PATH] = {0};
|
|
||||||
char tmp[MAX_PATH] = {0};
|
|
||||||
char adapter_guid[MAX_PATH] = {0};
|
|
||||||
|
|
||||||
UniToStr(adapter_guid, sizeof(adapter_guid), info->AdapterId + StrLen(SL_ADAPTER_ID_PREFIX));
|
|
||||||
|
|
||||||
if (GetClassRegKeyWin32(regkey, sizeof(regkey), tmp, sizeof(tmp), adapter_guid))
|
|
||||||
{
|
|
||||||
char *driver_desc = MsRegReadStrEx2(REG_LOCAL_MACHINE, regkey, "DriverDesc", false, true);
|
|
||||||
|
|
||||||
if (driver_desc != NULL)
|
|
||||||
{
|
|
||||||
StrCpy(info->FriendlyName, sizeof(info->FriendlyName), driver_desc);
|
|
||||||
Free(driver_desc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
SU_ADAPTER_LIST *a = SuAdapterInfoToAdapterList(info);
|
|
||||||
|
|
||||||
char macstr[128] = {0};
|
|
||||||
BinToStr(macstr, sizeof(macstr), info->MacAddress, sizeof(info->MacAddress));
|
|
||||||
|
|
||||||
if (a != NULL)
|
|
||||||
{
|
|
||||||
// Debug("SU: Adapter %u (OK): ID=%S, MAC=%s, FriendlyName=%s\n", i, info->AdapterId, macstr, info->FriendlyName);
|
|
||||||
|
|
||||||
Add(ret, a);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Debug("SU: Adapter %u (NG): ID=%S, MAC=%s, FriendlyName=%s\n", i, info->AdapterId, macstr, info->FriendlyName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -861,8 +827,7 @@ SU_ADAPTER_LIST *SuAdapterInfoToAdapterList(SL_ADAPTER_INFO *info)
|
|||||||
Copy(&t.Info, info, sizeof(SL_ADAPTER_INFO));
|
Copy(&t.Info, info, sizeof(SL_ADAPTER_INFO));
|
||||||
|
|
||||||
UniToStr(tmp, sizeof(tmp), info->AdapterId);
|
UniToStr(tmp, sizeof(tmp), info->AdapterId);
|
||||||
// Make the NIC appear in the "Local Bridge Settings" list regardless of a NULL character consisted in "FriendlyName".
|
if (IsEmptyStr(tmp) || IsEmptyStr(info->FriendlyName) || StartWith(tmp, SL_ADAPTER_ID_PREFIX) == false)
|
||||||
if (IsEmptyStr(tmp) || /* IsEmptyStr(info->FriendlyName) || */ StartWith(tmp, SL_ADAPTER_ID_PREFIX) == false)
|
|
||||||
{
|
{
|
||||||
// Name is invalid
|
// Name is invalid
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user