diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-22 21:12:57 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-22 22:28:52 +0200 |
commit | e18cd9040c7dce4a18acb557dda53f27141bfa66 (patch) | |
tree | a82dd6d096989d16793f9972175760121efea91d /installer/customactions.js | |
parent | manager: don't delay updates by 10 seconds (diff) | |
download | wireguard-windows-e18cd9040c7dce4a18acb557dda53f27141bfa66.tar.xz wireguard-windows-e18cd9040c7dce4a18acb557dda53f27141bfa66.zip |
installer: set sidtype from customaction
Otherwise they'll fail to come up when updating to 0.0.9.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'installer/customactions.js')
-rw-r--r-- | installer/customactions.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/installer/customactions.js b/installer/customactions.js index 8628de54..45095faa 100644 --- a/installer/customactions.js +++ b/installer/customactions.js @@ -97,3 +97,20 @@ function RemoveConfigFolder() { logMessage("Failed to remove configuration on uninstall: " + e.message); } } + +/* TODO: Remove me no later than July 2019. This is so that pre-0.0.9 upgrades go smoothly. */ +function REMOVEME_EnableServiceSidType() { + var serviceKey = "HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services"; + var servicePrefix = "WireGuardTunnel$"; + var serviceKeyPrefix = serviceKey + "\\" + servicePrefix; + var allowedNameFormat = new RegExp("^[a-zA-Z0-9_=+.-]{1,32}$"); + var txt = runWithNoWindowFlash(fso.BuildPath(fso.GetSpecialFolder(1), "reg.exe") + " query \"" + serviceKey + "\""); + var lines = txt.split(new RegExp("\r?\n", "g")); + for (var i = 0; i < lines.length; ++i) { + if (lines[i].length > serviceKeyPrefix.length && lines[i].substring(0, serviceKeyPrefix.length) == serviceKeyPrefix) { + var tunnelName = lines[i].substring(serviceKeyPrefix.length); + if (tunnelName.match(allowedNameFormat) != null) + wsh.Run(fso.BuildPath(fso.GetSpecialFolder(1), "sc.exe") + " sidtype " + servicePrefix + tunnelName + " unrestricted", 0, true); + } + } +} |