fix(windows): launch commands on the interactive desktop

This commit is contained in:
cabbage committed 2026-10-27 18:35:29 +00:00
1 parent 30e7bb8545
commit 8d28925e44
20 files changed
+1036 -28

No files matched your search

+29 -5
View File
@@ -226,6 +226,25 @@ desktop: a display, audio, or other session-scoped command may therefore fail
normally in Session 0. Selection fallback is not a promise that the requested
operation is meaningful in the resulting context.
Active contexts explicitly launch the per-command helper, shell and TERM
helper on `winsta0\default` within the selected token's session. The helper
checks its actual station/desktop and existing access for GUI creation before
preparing user code; it reports that path over the authenticated channel.
Failures become bounded launch diagnostics. Do not broaden desktop ACLs,
switch to Winlogon, or change identity after launch preparation. Session 0
fallbacks retain their noninteractive desktop.
The command shell uses `CREATE_NO_WINDOW` plus `SW_SHOWNORMAL`: console
suppression is independent of GUI startup visibility. The private headless
console retains the verified CTRL_BREAK helper route, subject to native TERM
acceptance. Standard handles, Job containment, suspension and authorization
barriers are unchanged. Desktop placement does not guarantee foreground focus
or force an application to create UI. Locked Default desktops become visible
after unlocking. Use `start "" /wait APP` for supervised GUI apps; a root shell
that exits can close the command's Job and terminate remaining owned children.
Explorer/single-instance handoffs may reach an existing process outside that
Job. See [Windows GUI workflows](../skills/rvbox/references/windows-gui.md).
For normal `active_user`, use the filtered token when Windows supplies one. If
an administrator is logged in with only a full token (for example traditional
UAC is disabled), create and verify a LUA-style restricted medium-integrity
@@ -264,9 +283,9 @@ session ID, and launch generation; a same-user process racing for a pipe cannot
satisfy that complete identity.
The launcher opens only those pipes, creates the selected shell suspended in
its own dedicated console with `CREATE_NEW_CONSOLE`, `CREATE_SUSPENDED`,
its own dedicated headless console with `CREATE_NO_WINDOW`, `CREATE_SUSPENDED`,
`CREATE_UNICODE_ENVIRONMENT`, and `EXTENDED_STARTUPINFO_PRESENT`, and uses
`STARTF_USESHOWWINDOW`/`SW_HIDE`. It inherits only the explicit standard-I/O
`STARTF_USESHOWWINDOW`/`SW_SHOWNORMAL`. It inherits only the explicit standard-I/O
handles through `PROC_THREAD_ATTRIBUTE_HANDLE_LIST`. Non-breakaway Job
membership propagates from the launcher. It reports the suspended shell PID and
creation `FILETIME` and waits for the service's release/watchdog channel.
@@ -290,8 +309,9 @@ or running shell, and descendants. Recovery never kills by persisted PID alone.
Job Object limits enforce requested profiles and `KILL_ON_JOB_CLOSE` protects
against lost supervision.
Do not request `CREATE_NEW_PROCESS_GROUP` with `CREATE_NEW_CONSOLE`; Windows
ignores that combination. TERM instead launches a short-lived private mode of
Each command owns a headless console; no new process-group flag is needed.
Do not combine `CREATE_NO_WINDOW` with `CREATE_NEW_CONSOLE` or
`DETACHED_PROCESS`, which override it. TERM launches a short-lived private mode of
the same `rvbox.exe` under the command's effective token and session. It uses a
separate PID-verified local named-pipe handshake, not inherited cross-session
handles, to receive the target PID/creation-time/generation. It attaches to the
@@ -301,7 +321,11 @@ CTRL_BREAK, and calls
root exit, select and birth-verify a live PID from the Job list. Because each
command owns its console, this does not address an unrelated command. The
helper detaches and reports delivery; it receives neither the Job handle nor
command stdio.
command stdio. Before attaching, detach any helper-owned console. Register an
actual Ctrl+C/Ctrl+Break handler after attachment, since attaching resets handler
state; `SetConsoleCtrlHandler(NULL, TRUE)` ignores only Ctrl+C. Detach before
removing that protection. Serialize the process-wide console-attachment fallback
inside the service so concurrent requests cannot attach to different consoles.
Root-process exit begins the same drain grace period. Completion waits for the
Job Object to reach zero active processes; after the grace period RVBox