Windows service mode: full elevated routing for standard users
Follow-up to #400 and #512.
The next release makes LBM start for standard users (asInvoker manifest + opportunistic elevation for split-token admins). One gap remains for non-admin accounts: UIPI blocks input injection while an elevated window has focus, so routing pauses during that focus. Closing that gap needs the daemon to run at System integrity inside the user's session — a service-based mode.
Why the earlier attempt failed: a Windows service lives in session 0 (isolation since Vista) — from there the interactive desktop is unreachable by design: no low-level hooks, no input injection. Nothing was wrong with the capture code itself.
The viable design (what commercial input remappers do):
- An installer-registered service (LocalSystem) never captures anything itself.
- It watches sessions (
WTSGetActiveConsoleSessionId, logon/unlock/switch notifications viaSERVICE_CONTROL_SESSIONCHANGE). - For the active interactive session it launches the hook daemon inside that session: duplicate its own SYSTEM token,
SetTokenInformation(TokenSessionId, <session>), thenCreateProcessAsUsertargetingWinSta0\Default. - The daemon then runs at System IL in the user's session:
WH_MOUSE_LL+SendInputwork, and UIPI is satisfied even over elevated windows — full routing for standard users, and no UAC anywhere. - UI ↔ daemon keeps the existing local TCP protocol; the service only manages the daemon lifecycle (start per session, kill on logoff, restart on crash).
Scope to figure out: installer service registration, per-session config resolution (the daemon must read the session user's layout, not SYSTEM's), and making this an opt-in install mode so the current task-scheduler path remains the default.
Source: mgth/LittleBigMouse