Files
EasyTier/easytier-gui/src-tauri/windows
KKRainbow 8c2f67e13e fix(windows): stop running GUI and services during installer updates (#2717)
* fix(gui): stop Windows processes before installing updates

Keep the NSIS installer in the current user context. Detect the target
GUI and service before updating, and elevate a temporary helper only
when stopping them requires administrator access.

Stop services through SCM and wait for their processes to exit before
closing the GUI. Retain the helper until installation completes so it
can restore a previously running service without another UAC prompt.
Restore the service on cancellation when its executable still exists.

Prepare before Tauri launches an old uninstaller, and cover passive,
silent, and direct uninstall paths. Add Windows service lifecycle tests
with isolated executable fixtures.

* fix(windows): report stopped before normal service exit

Report SERVICE_STOPPED with no accepted controls before exiting after
an explicit stop or successful completion. Reporting Running at exit
makes SCM treat a normal stop as a failure and schedule a restart.

This fixes the service lifecycle independently of installer changes.

* fix(gui): prevent old services restarting during Windows updates

Temporarily disable service startup before requesting a stop, then
restore the original startup mode when the update finishes or exits.
Released services can exit without reporting Stopped, causing SCM to
queue a recovery restart even after an explicit stop request.

Extend the Windows fixture to reproduce that exit behavior with failure
recovery enabled and check that startup settings are restored. Record
the minor directory-change and GUI-relaunch limitation from review.

* docs(windows): record installer short-path matching limitation

Record the 8.3 path alias mismatch found while testing the installer
helper without administrator privileges. Document how to run the fixture
with a full temporary-directory path and retain the issue as a minor
follow-up without expanding the installer implementation.
2026-10-17 02:15:57 +08:00
..

Windows installer process handling

NSIS remains a current-user installer. Its helper requests elevation only when a running service or GUI requires it, and restores service startup and running state after installation. During an update it temporarily disables service startup because released EasyTier versions can trigger SCM recovery even after an explicit stop.

Run test-installer-processes.ps1 with Windows PowerShell as administrator on a test machine without an existing easytier-gui service. The test uses isolated executables and a service that reproduces the old exit behavior with failure recovery enabled. Run it with -GuiOnly from an unelevated shell to check the path that needs no elevation.

Known limitations

If preparation on the welcome page has already started a helper, it is reused at installation time. Changing to another directory containing a running GUI, or relaunching the GUI between those pages, may still cause Tauri's default process check to fail. Rechecking those processes is a separate follow-up; it was recorded as a minor finding in the final review.

Executable matching does not expand Windows 8.3 short-path aliases. An installation directory expressed using a short alias may not match the process image's full path. This was reproduced with LocalService's short temporary-directory path; the unprivileged GUI test passes when its temporary directory uses the full path. This is recorded as a minor follow-up. Use a full temporary-directory path when running the fixture.