2 Commits

Author SHA256 Message Date
Alphaeus Mote b3716e3f38 perf(banner): plain Win32 and Native AOT, 47 MB to 1.6 MB
The Being Viewed banner was WinForms published as a self-contained single
file (49.3 MB, ~320 ms just to start and exit). It is now plain Win32 through
source-generated LibraryImport (runtime marshalling disabled, no reflection)
published with Native AOT: 1.6 MB for win-x64 and win-arm64, ~33 ms to start
and exit (the OS process floor), on screen in ~0.1 s.

- BannerWindow: a WS_EX_TOPMOST | TOOLWINDOW | NOACTIVATE popup, a STATIC per
  caption (read by screen readers, clicks fall through to drag) and an
  owner-drawn BUTTON per Stop, named for its session; the mouse is handled in
  a subclass and BM_CLICK invokes directly, so clicking or assistive-tech
  invoke never activates the banner. GDI drawing, comctl32 6 tooltips,
  PerMonitorV2 manifest with WM_DPICHANGED, AppsUseLightTheme and high
  contrast on WM_SETTINGCHANGE, DWM rounded corners and dark frame.
- Same metrics, colours and wording as the WinForms banner (checked against
  screenshots at 125%), now in window-free Logic/ (layout, palette, rows)
  that Agent.Tests compiles and tests.
- The protocol moves to src/Shared.Banner (compiled into agent and banner),
  with the exit codes; DLL hardening, pipe checks and protocol unchanged.
- Package-Agent publishes the banner with AOT when vswhere finds the MSVC
  tools for the RID (and puts vswhere on PATH for newer VS vcvarsall),
  otherwise warns and publishes a trimmed single file (~11 MB).
- README: Build Tools "Desktop development with C++" (plus ARM64 tools) as a
  prerequisite, also for the CI windows-host runner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 16:33:17 -05:00
Alphaeus Mote 5eb4edf900 feat(screen): Being Viewed banner in the signed-in user's session, with Stop
- New src/Agent.Banner (ExecuteR-Banner.exe): a WinForms tool window at the
  top centre, always on top, never activated, draggable, per-monitor DPI,
  light/dark/high contrast, embedded icon (assets/icons/banner.ico: the
  product tile with an eye). "Being Viewed by <operator> · View Only|Control"
  and Stop, one row per session. Hardens DLL search first thing; talks only
  to a pipe owned by SYSTEM and served from session 0, at Identification.
- Agent: ScreenBanner follows the open sessions and the console and decides
  (ScreenBannerPolicy) when the banner runs: policy off, Windows PE, nothing
  open, nobody signed in -> never; console switch, sign-out, another user ->
  end (and launch for whoever is there); a banner that went away -> end,
  retry after 30 s. WindowsScreenBannerLauncher starts it with
  WTSQueryUserToken (the filtered token, never SYSTEM), the user's
  environment, winsta0\default, no inherited handles, image-load
  mitigations, a kill-on-close job, from the protected agent folder.
- IPC (ScreenBannerProtocol, ScreenBannerConnection): a per-launch nonce pipe
  created first (first instance, one instance, SYSTEM owner, SYSTEM full +
  the user's SID read/write, network denied); the client must be the
  launched PID in its session (GetNamedPipeClientProcessId /
  GetNamedPipeClientSessionId). Service -> banner: display data only.
  Banner -> service: exactly "stop <id>", 64-byte lines, honoured only for a
  session it shows in its console session; anything else ends it.
- Stop: the agent sends a final StoppedAtDevice state and ends the streams,
  and refuses a reconnect of that session (status "stopped"). The server ends
  the session with its own reason "Stopped by the user at the device." and
  audits it as ended. The open request now carries the operator's display
  name for the banner.
- RemoteViewBanner (default off) is read like the other Remote View policy
  values and reported in the inventory policy (on only where the banner can
  run).
- Tests: protocol (only a valid stop of a shown session, garbage, overlong
  and non-UTF-8 lines, wrong client PID or session refused), launcher
  decisions, the banner manager with a fake launcher, the agent's display
  data and stop path, the pipe ACL, the protected-folder check, the
  server's handling and audit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 14:44:59 -05:00