Privilege split 8/11: The Kurgan's logon task runs without admin rights

- setup.ps1: the elevated part removes the old tasks ("TT LCD Dashboard" and
  the elevated "The Kurgan"); back in the unelevated part, setup registers
  "The Kurgan" as the user with RunLevel Limited and starts it. Registered
  as the user, the tray's "Start with Windows" can change it without admin
  rights (checked on this machine with a throwaway task). Running setup.ps1
  from an elevated window is refused, since the task must be registered
  unelevated. The hardware service's install follows in stage 9.
- kurgan/tray.py: texts for an unelevated task; a failed toggle suggests
  re-running setup.ps1 (for a task an older setup registered elevated).
- README: the task is unelevated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
paulandClaude Opus 5.5 committed 2026-12-05 19:46:48 +13:00
1 parent e583e25346
commit a7ebf42838
3 files changed
+58 -45

No files matched your search

+7 -7
View File
@@ -5,12 +5,12 @@ The tooltip shows the power draw; the menu shows each capability's status and ha
left button opens the web UI directly. notify() shows a balloon tip when something starts
going wrong (fan failsafes, AI server errors, failing sensors).
"Start with Windows" switches the logon trigger of "The Kurgan" scheduled task (installed by
setup.ps1) on or off. The task itself stays enabled, so it can still be started by hand,
with admin rights and no UAC prompt: Start-ScheduledTask "The Kurgan"
"Start with Windows" switches the logon trigger of "The Kurgan" scheduled task on or off.
setup.ps1 registers that task as you, without admin rights, so changing it needs none. The task
itself stays enabled, so it can still be started by hand: Start-ScheduledTask "The Kurgan"
The Kurgan usually runs elevated while Explorer doesn't, so Windows would drop Explorer's
clicks on the icon; the window explicitly accepts those messages (ChangeWindowMessageFilterEx).
If The Kurgan is ever run elevated (it shouldn't be), Windows would drop Explorer's clicks on
the icon; the window explicitly accepts those messages (ChangeWindowMessageFilterEx).
"""
from __future__ import annotations
@@ -381,8 +381,8 @@ class TrayIcon:
except Exception as e:
log.warning("Couldn't change Start with Windows: %s", e)
hint = "" if _is_admin() else (
"\n\nChanging this needs admin rights. The Kurgan has them when its startup task "
"starts it (Start-ScheduledTask \"The Kurgan\").")
"\n\nIf the task was registered with admin rights (by an older setup.ps1), run "
"setup.ps1 again: it registers the task as you, and then this works.")
_u32.MessageBoxW(self._hwnd, f"Couldn't turn Start with Windows {'on' if want else 'off'}.\n\n{e}{hint}",
self.title, MB_ICONWARNING | MB_SETFOREGROUND)
self._refresh_autostart() # show what the task really says now