diff options
author | Simon Rozman <simon@rozman.si> | 2020-11-18 12:12:40 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-11-18 14:30:02 +0100 |
commit | 6c8d1d99704211ce841809c69a4581c67cf0c5fb (patch) | |
tree | 8c174cdbcbc4ed90261962ea3dfea7841aa3e1e7 /installer | |
parent | installer: ignore remove failures (diff) | |
download | wireguard-windows-6c8d1d99704211ce841809c69a4581c67cf0c5fb.tar.xz wireguard-windows-6c8d1d99704211ce841809c69a4581c67cf0c5fb.zip |
installer: prevent the process killing on upgrade cleanup
When MSI is upgrading previous version, the RemoveExistingProducts
shouldn't kill our processes we just installed and started.
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'installer')
-rw-r--r-- | installer/customactions.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/installer/customactions.c b/installer/customactions.c index b7aee8c1..78ac62d4 100644 --- a/installer/customactions.c +++ b/installer/customactions.c @@ -303,17 +303,21 @@ __declspec(dllexport) UINT __stdcall EvaluateWireGuardComponents(MSIHANDLE insta log_errorf(installer, LOG_LEVEL_ERR, ret, TEXT("MsiGetProperty(\"WireGuardFolder\") failed")); goto out; } - ret = MsiSetProperty(installer, TEXT("KillWireGuardProcesses"), path); - if (ret != ERROR_SUCCESS) { - log_errorf(installer, LOG_LEVEL_ERR, ret, TEXT("MsiSetProperty(\"KillWireGuardProcesses\") failed")); - goto out; - } if (component_action >= INSTALLSTATE_LOCAL) { - /* WireGuardExecutable component shall be installed or updated. */ + /* WireGuardExecutable component shall be installed. */ + ret = MsiSetProperty(installer, TEXT("KillWireGuardProcesses"), path); + if (ret != ERROR_SUCCESS) { + log_errorf(installer, LOG_LEVEL_ERR, ret, TEXT("MsiSetProperty(\"KillWireGuardProcesses\") failed")); + goto out; + } } else if (component_action >= INSTALLSTATE_REMOVED) { /* WireGuardExecutable component shall be uninstalled. */ - log_messagef(installer, LOG_LEVEL_INFO, TEXT("WireGuardExecutable removal scheduled")); + ret = MsiSetProperty(installer, TEXT("KillWireGuardProcesses"), path); + if (ret != ERROR_SUCCESS) { + log_errorf(installer, LOG_LEVEL_ERR, ret, TEXT("MsiSetProperty(\"KillWireGuardProcesses\") failed")); + goto out; + } ret = MsiSetProperty(installer, TEXT("RemoveConfigFolder"), path); if (ret != ERROR_SUCCESS) { log_errorf(installer, LOG_LEVEL_ERR, ret, TEXT("MsiSetProperty(\"RemoveConfigFolder\") failed")); @@ -394,6 +398,8 @@ __declspec(dllexport) UINT __stdcall KillWireGuardProcesses(MSIHANDLE installer) if (!process_path[0]) goto out; + log_messagef(installer, LOG_LEVEL_INFO, TEXT("Detecting running processes")); + if (PathCombine(executable, process_path, TEXT("wg.exe")) && calculate_file_id(executable, &file_ids[file_ids_len])) ++file_ids_len; if (PathCombine(executable, process_path, TEXT("wireguard.exe")) && calculate_file_id(executable, &file_ids[file_ids_len])) |