From f96ac3644a946bb3ecc65b47c55f4bb4d581971c Mon Sep 17 00:00:00 2001 From: Daiyuu Nobori Date: Fri, 25 May 2018 05:57:54 +0900 Subject: [PATCH] Improvements on the behavior of the reinstall command of Windows Virtual Network Adapters. (#509) * Improvements on the behavior of the reinstall command of Windows Virtual Network Adapters. When reinstalling the device driver of the Virtual Network Driver card, we changed the behavior as to cleanup the older driver before installing the newer driver. * Improvement of the senetence. Add the same sentence to the Taiwan language file. * Delete the old MsUpgradeVLanWithoutLock_old() function. --- src/Cedar/CM.c | 6 +++ src/Mayaqua/Microsoft.c | 92 +-------------------------------- src/bin/hamcore/strtable_cn.stb | 1 + src/bin/hamcore/strtable_en.stb | 1 + src/bin/hamcore/strtable_ja.stb | 1 + src/bin/hamcore/strtable_tw.stb | 1 + 6 files changed, 12 insertions(+), 90 deletions(-) diff --git a/src/Cedar/CM.c b/src/Cedar/CM.c index 673bda69..199e01bb 100644 --- a/src/Cedar/CM.c +++ b/src/Cedar/CM.c @@ -5718,6 +5718,12 @@ void CmMainWindowOnCommandEx(HWND hWnd, WPARAM wParam, LPARAM lParam, bool easy) // Installation is prohibited break; } + // Warning message + if (MsgBox(hWnd, MB_ICONINFORMATION | MB_OKCANCEL, _UU("CM_VLAN_REINSTALL_MSG")) == IDCANCEL) + { + // Cancel + break; + } index = LvGetSelected(hWnd, L_VLAN); if (index != INFINITE) { diff --git a/src/Mayaqua/Microsoft.c b/src/Mayaqua/Microsoft.c index c5dab20e..c557016c 100644 --- a/src/Mayaqua/Microsoft.c +++ b/src/Mayaqua/Microsoft.c @@ -8431,19 +8431,11 @@ bool MsUpgradeVLan(char *tag_name, char *connection_tag_name, char *instance_nam } bool MsUpgradeVLanWithoutLock(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) { @@ -8477,38 +8469,6 @@ bool MsUpgradeVLanWithoutLock(char *tag_name, char *connection_tag_name, char *i 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 (MsGetNeoDriverFilename(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) @@ -8533,57 +8493,9 @@ bool MsUpgradeVLanWithoutLock(char *tag_name, char *connection_tag_name, char *i 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); + ret = MsUninstallVLanWithoutLock(instance_name); - 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); - } + ret = MsInstallVLanWithoutLock(tag_name, connection_tag_name, instance_name, ver); return ret; } diff --git a/src/bin/hamcore/strtable_cn.stb b/src/bin/hamcore/strtable_cn.stb index 0695db65..d415f134 100644 --- a/src/bin/hamcore/strtable_cn.stb +++ b/src/bin/hamcore/strtable_cn.stb @@ -1004,6 +1004,7 @@ CM_WOULDYOULOAD_IE_PROXY 目前,这台计算机的 Internet Explorer 配置使 CM_MSG_TITLE VPN Server "%S" (虚拟 HUB: "%S") CM_JUMPLIST_RCCONNECT 最近使用的连接设置 CM_VPNGATE_MESSAGE 在 VPN Gate 学术项目网站上有一个公共 VPN 中继服务器列表。\r\n互联网上的任何人都可以建立 VPN 连接至任一列表上的 VPN 服务器。无需用户注册。\r\n\r\nVPN Gate 不是 SoftEther VPN 的一部分。\r\n此图标只提供了一个超链接到 http://www.vpngate.net/。\r\n\r\n安装带有 SoftEther VPN Client 的 VPN Gate Client 插件。它可用简单的配置连接到 VPN Gate 的一个公共 VPN 中继服务器。\r\n\r\n你想访问 http://www.vpngate.net/ (设在日本筑波大学) ? +CM_VLAN_REINSTALL_MSG After reinstalling the Virtual Network Adapter driver, the current Virtual Network Adapter's MAC address will change. Also, all TCP/IP settings within the Virtual Network Adapter will reset.\r\n\r\nIn case the reinstalled Virtual Network Adapter fails to work, delete it and create a new one. If it still doesn't work properly, please create a new Virtual Network Adapter with a different name. # VPN Gate Service diff --git a/src/bin/hamcore/strtable_en.stb b/src/bin/hamcore/strtable_en.stb index e4f37a0d..1e64549f 100644 --- a/src/bin/hamcore/strtable_en.stb +++ b/src/bin/hamcore/strtable_en.stb @@ -995,6 +995,7 @@ CM_WOULDYOULOAD_IE_PROXY Currently the Internet Explorer on this computer is con CM_MSG_TITLE VPN Server "%S" (Virtual Hub: "%S") CM_JUMPLIST_RCCONNECT Recent VPN Servers CM_VPNGATE_MESSAGE There is the list of Public VPN Relay Servers on the VPN Gate Academic Project Web Site.\r\nAnyone on the Internet can connect a VPN connection to any VPN servers on the list.\r\n\r\nVPN Gate Academic Project is not a part of SoftEther VPN.\r\nThis icon provides just a link to http://www.vpngate.net/.\r\nYou need to install VPN Gate Plugin to connect VPN Gate.\r\n\r\nDo you want to visit http://www.vpngate.net/ (provided by University of Tsukuba) ? +CM_VLAN_REINSTALL_MSG After reinstalling the Virtual Network Adapter driver, the current Virtual Network Adapter's MAC address will change. Also, all TCP/IP settings within the Virtual Network Adapter will reset.\r\n\r\nIn case the reinstalled Virtual Network Adapter fails to work, delete it and create a new one. If it still doesn't work properly, please create a new Virtual Network Adapter with a different name. VGC_COLUMN_0 DDNS Hostname diff --git a/src/bin/hamcore/strtable_ja.stb b/src/bin/hamcore/strtable_ja.stb index 9cf97b39..20265106 100644 --- a/src/bin/hamcore/strtable_ja.stb +++ b/src/bin/hamcore/strtable_ja.stb @@ -998,6 +998,7 @@ CM_WOULDYOULOAD_IE_PROXY 現在、このコンピュータは Internet Explorer CM_MSG_TITLE VPN サーバー "%S" (仮想 HUB: "%S") CM_JUMPLIST_RCCONNECT 最近の接続先 CM_VPNGATE_MESSAGE VPN Gate 学術実験プロジェクトの Web サイトには、公開 VPN 中継サーバーの一覧が公開されています。\r\nこれらの VPN サーバーには、誰でもユーザー登録なしで VPN 接続することができます。\r\n\r\nVPN Gate 学術実験プロジェクトは SoftEther VPN の一部ではありません。\r\nこのアイコンは http://www.vpngate.net/ へのリンクを提供しているに過ぎません。\r\nVPN Gate に接続するためには、VPN Gate Plugin をインストールする必要があります。\r\n\r\nhttp://www.vpngate.net/ (筑波大学における学術実験サイト) を開きますか? +CM_VLAN_REINSTALL_MSG 仮想 LAN カードのドライバを再インストールすると、MAC アドレスが変更になります。また、仮想 LAN カードに関する TCP/IP などのネットワーク設定は初期化されます。続行しますか?\r\n\r\nなお、仮想 LAN カードのドライバを再インストールしても正常に動作しない場合は、新たに別の名前で仮想 LAN カードを作成してください。 # VPN Gate Service 関係 diff --git a/src/bin/hamcore/strtable_tw.stb b/src/bin/hamcore/strtable_tw.stb index cc695091..6bbd8760 100644 --- a/src/bin/hamcore/strtable_tw.stb +++ b/src/bin/hamcore/strtable_tw.stb @@ -1006,6 +1006,7 @@ CM_WOULDYOULOAD_IE_PROXY 目前,這台電腦的 Internet Explorer 配置使用 CM_MSG_TITLE VPN Server "%S" (虛擬 HUB: "%S") CM_JUMPLIST_RCCONNECT 最近使用的連接設置 CM_VPNGATE_MESSAGE 在 VPN Gate 學術項目網站上有一個公共 VPN 中繼伺服器列表。\r\n網際網路上的任何人都可以建立 VPN 連接至任一列表上的 VPN 伺服器。無需用戶註冊。\r\n\r\nVPN Gate 不是 SoftEther VPN 的一部分。\r\n此圖示只提供了一個超連結到 http://www.vpngate.net/。\r\n\r\n安裝帶有 SoftEther VPN Client 的 VPN Gate Client 外掛程式。它可用簡單的配置連接到 VPN Gate 的一個公共 VPN 中繼伺服器。\r\n\r\n你想訪問 http://www.vpngate.net/ (設在日本筑波大學) ? +CM_VLAN_REINSTALL_MSG After reinstalling the Virtual Network Adapter driver, the current Virtual Network Adapter's MAC address will change. Also, all TCP/IP settings within the Virtual Network Adapter will reset.\r\n\r\nIn case the reinstalled Virtual Network Adapter fails to work, delete it and create a new one. If it still doesn't work properly, please create a new Virtual Network Adapter with a different name. # VPN Gate Service