1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-06-28 11:55:08 +03:00

Delete the old MsUpgradeVLanWithoutLock_old() function.

This commit is contained in:
Daiyuu Nobori 2018-04-23 10:16:10 +09:00
parent 46b235d924
commit d7b30bf143

View File

@ -8462,164 +8462,6 @@ bool MsUpgradeVLanWithoutLock(char *tag_name, char *connection_tag_name, char *i
return ret; return ret;
} }
bool MsUpgradeVLanWithoutLock_old(char *tag_name, char *connection_tag_name, char *instance_name, MS_DRIVER_VER *ver)
{
wchar_t infpath[MAX_PATH];
char hwid[MAX_PATH];
wchar_t hwid_w[MAX_PATH];
bool ret = false;
bool need_reboot;
bool before_status;
UCHAR old_mac_address[6];
UCHAR new_mac_address[6];
char *s;
NO_WARNING *nw;
char neo_sys[MAX_PATH];
char *reg_key;
UINT i;
// Validate arguments
if (instance_name == NULL || tag_name == NULL || connection_tag_name == NULL || ver == NULL)
{
return false;
}
if (MsIsNt() == false)
{
// Can not be upgraded in Windows 9x
return false;
}
if (MsIsInfCatalogRequired())
{
if (MsIsValidVLanInstanceNameForInfCatalog(instance_name) == false)
{
return false;
}
StrUpper(instance_name);
}
Zero(hwid, sizeof(hwid));
Format(hwid, sizeof(hwid), DRIVER_DEVICE_ID_TAG, instance_name);
StrToUni(hwid_w, sizeof(hwid_w), hwid);
// Examine whether the virtual LAN card with the specified name has already registered
if (MsIsVLanExists(tag_name, instance_name) == false)
{
// Not registered
return false;
}
reg_key = MsGetNetCfgRegKeyName(tag_name, instance_name);
if (IsEmptyStr(reg_key) == false)
{
// Add a value to the registry key
MsRegWriteInt(REG_LOCAL_MACHINE, reg_key, "*IfType", 6);
MsRegWriteInt(REG_LOCAL_MACHINE, reg_key, "*MediaType", 0);
MsRegWriteInt(REG_LOCAL_MACHINE, reg_key, "*PhysicalMediaType", 0);
}
Free(reg_key);
// Get the .sys file name that is currently being used
if (MsGetNeoDeiverFilename(neo_sys, sizeof(neo_sys), instance_name) == false)
{
if (MsIsInfCatalogRequired())
{
// Can not be upgraded if getting current .sys file name failed
// in the Windows 8 or later
return false;
}
// Create a new file name because it is unknown
if (MsMakeNewNeoDriverFilename(neo_sys, sizeof(neo_sys)) == false)
{
// Failure
return false;
}
}
// Get the current operating status
before_status = MsIsVLanEnabled(instance_name);
// Get the previous MAC address
s = MsGetMacAddress(tag_name, instance_name);
if (s == NULL)
{
Zero(old_mac_address, 6);
}
else
{
BUF *b;
b = StrToBin(s);
Free(s);
if (b->Size == 6)
{
Copy(old_mac_address, b->Buf, b->Size);
}
else
{
Zero(old_mac_address, 6);
}
FreeBuf(b);
}
// Starting the installation
if (MsStartDriverInstall(instance_name, IsZero(old_mac_address, 6) ? NULL : old_mac_address, neo_sys,
new_mac_address, ver) == false)
{
return false;
}
MsGetDriverPath(instance_name, NULL, NULL, infpath, NULL, NULL, NULL, neo_sys);
nw = NULL;
//if (MsIsVista() == false)
{
nw = MsInitNoWarning();
}
// Do the installation
if (ms->nt->UpdateDriverForPlugAndPlayDevicesW(
NULL, hwid_w, infpath, 1, &need_reboot))
{
ret = true;
}
MsFreeNoWarning(nw);
// Installation complete
MsFinishDriverInstall(instance_name, neo_sys);
for (i = 0;i < 5;i++)
{
MsInitNetworkConfig(tag_name, instance_name, connection_tag_name);
if (MsIsInfCatalogRequired())
{
// Write the MAC address
char mac_address_str[MAX_SIZE];
BinToStr(mac_address_str, sizeof(mac_address_str), new_mac_address, sizeof(new_mac_address));
MsSetMacAddress(VLAN_ADAPTER_NAME_TAG, instance_name, mac_address_str);
}
SleepThread(MsIsVista() ? 1000 : 300);
}
SleepThread(MsIsVista() ? 1000 : 300);
// Restore operation
if (before_status)
{
MsEnableVLan(instance_name);
}
else
{
MsDisableVLan(instance_name);
}
return ret;
}
// Test for Windows 9x // Test for Windows 9x
void MsWin9xTest() void MsWin9xTest()