mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2025-09-20 18:29:19 +03:00
Compare commits
6 Commits
2525c39aac
...
5.02.5182
Author | SHA1 | Date | |
---|---|---|---|
ff37c35cfa | |||
56c12de929 | |||
2789b16c12 | |||
f6c185f279 | |||
44821c7130 | |||
64cb8e1eff |
@ -1162,7 +1162,6 @@ 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.
|
// 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));
|
Format(dst, dst_size, "%s(ID=%010u)", nicname, Win32EthGenIdFromGuid(guid));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1187,7 +1186,7 @@ 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.
|
// Allow to combine "FriendlyName" consisting of a NULL character and ID beginning with "(ID=".
|
||||||
if (len >= 15)
|
if (len >= 15)
|
||||||
{
|
{
|
||||||
StrCpy(id_str, sizeof(id_str), str + len - 15);
|
StrCpy(id_str, sizeof(id_str), str + len - 15);
|
||||||
@ -1410,8 +1409,7 @@ LIST *GetEthAdapterListInternal()
|
|||||||
UINT size;
|
UINT size;
|
||||||
char *buf;
|
char *buf;
|
||||||
UINT i, j;
|
UINT i, j;
|
||||||
//char *qos_tag = " (Microsoft's Packet Scheduler)";
|
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)"; // Allow to combine "FriendlyName" consisting of a NULL character and QOS.
|
|
||||||
SU *su = NULL;
|
SU *su = NULL;
|
||||||
LIST *su_adapter_list = NULL;
|
LIST *su_adapter_list = NULL;
|
||||||
|
|
||||||
@ -1666,8 +1664,7 @@ ANSI_STR:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Allow to combine "FriendlyName" consisting of a NULL character and ID.
|
// 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);
|
Format(tmp, sizeof(tmp), "%s(%u)", a->Title, k + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -753,11 +753,45 @@ 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 (a != NULL)
|
if (IsEmptyStr(info->FriendlyName))
|
||||||
{
|
{
|
||||||
Add(ret, a);
|
// Some NetAdapterCx drivers doesn't report the FriendlyName in the kernel mode.
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -828,8 +862,7 @@ SU_ADAPTER_LIST *SuAdapterInfoToAdapterList(SL_ADAPTER_INFO *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".
|
// 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)
|
||||||
if (IsEmptyStr(tmp) || StartWith(tmp, SL_ADAPTER_ID_PREFIX) == false)
|
|
||||||
{
|
{
|
||||||
// Name is invalid
|
// Name is invalid
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2124,6 +2124,24 @@ IO *FileOpenEx(char *name, bool write_mode, bool read_lock)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Replace the specified character in the string with a new character
|
||||||
|
wchar_t *UniReplaceCharW(wchar_t *src, UINT size, wchar_t c, wchar_t newc) {
|
||||||
|
if (src == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
for (; *src; src++, size -= sizeof(wchar_t)) {
|
||||||
|
if (size < sizeof(wchar_t)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (*src == c) {
|
||||||
|
*src = newc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (wchar_t *)src;
|
||||||
|
}
|
||||||
|
|
||||||
IO *FileOpenExW(wchar_t *name, bool write_mode, bool read_lock)
|
IO *FileOpenExW(wchar_t *name, bool write_mode, bool read_lock)
|
||||||
{
|
{
|
||||||
wchar_t tmp[MAX_SIZE];
|
wchar_t tmp[MAX_SIZE];
|
||||||
@ -2140,9 +2158,12 @@ IO *FileOpenExW(wchar_t *name, bool write_mode, bool read_lock)
|
|||||||
IO *o = ZeroMalloc(sizeof(IO));
|
IO *o = ZeroMalloc(sizeof(IO));
|
||||||
name++;
|
name++;
|
||||||
UniStrCpy(o->NameW, sizeof(o->NameW), name);
|
UniStrCpy(o->NameW, sizeof(o->NameW), name);
|
||||||
|
#ifdef OS_WIN32
|
||||||
|
UniReplaceCharW(o->NameW, sizeof(o->NameW), L'\\', L'/'); // Path separator "/" is used.
|
||||||
|
#endif // OS_WIN32
|
||||||
UniToStr(o->Name, sizeof(o->Name), o->NameW);
|
UniToStr(o->Name, sizeof(o->Name), o->NameW);
|
||||||
o->HamMode = true;
|
o->HamMode = true;
|
||||||
o->HamBuf = ReadHamcoreW(name);
|
o->HamBuf = ReadHamcoreW(o->NameW);
|
||||||
if (o->HamBuf == NULL)
|
if (o->HamBuf == NULL)
|
||||||
{
|
{
|
||||||
Free(o);
|
Free(o);
|
||||||
|
Reference in New Issue
Block a user