Session-0 Console Trampoline
Windows Session 0 Isolation causes QueryDisplayConfig, SetDisplayConfig, and Advanced Color / HDR CCD APIs to fail with ERROR_ACCESS_DENIED when invoked directly from a LocalSystem Session 0 service. ZeroVDD splits driver ownership from interactive desktop CCD calls across a controlled session boundary.
Streaming Session Sequence
Section titled “Streaming Session Sequence”sequenceDiagram
participant Sunshine as "sunshine.exe (Session > 0)"
participant CLI as "zerovdd.exe sunshine start"
participant Svc as "zerovdd-svc.exe (Session 0)"
participant Drv as "WUDFHost.exe / zerovdd.dll"
participant Tramp as "zerovdd.exe internal-ccd (Session > 0)"
Sunshine->>CLI: global_prep_cmd Do (SUNSHINE_CLIENT_* env)
CLI->>CLI: Walk ancestors for sunshine.exe (pid, creation_time)
CLI->>Svc: StartSession over \\.\pipe\zerovdd-svc (SY/BA/IU)
Svc->>Tramp: CreateProcessAsUserW (snapshot -> topology-backup.json)
Svc->>Drv: IOCTL_ADD_DISPLAY via \ZeroVddControl (SYSTEM)
Drv-->>Svc: AdapterLuid + TargetId
Svc->>Tramp: CreateProcessAsUserW (apply topology + HDR/24H2)
Svc->>Svc: Watch sunshine.exe (pid, creation_time)
Svc-->>CLI: Session active
Component Responsibilities
Section titled “Component Responsibilities”Privileged Service (zerovdd-svc.exe, Session 0)
Section titled “Privileged Service (zerovdd-svc.exe, Session 0)”- Runs as
LocalSystemin Session 0. - Listens on
\\.\pipe\zerovdd-svcwith strict DACLD:P(A;;GA;;;SY)(A;;GA;;;BA)(A;;GRGW;;;IU). - Owns persistent, headless-standby, and session Control Device handles on
\ZeroVddControl. - Atomically persists physical display layout snapshots to
%ProgramData%\zerovdd\topology-backup.json.
Console CCD Trampoline (console_launcher.rs -> internal-ccd)
Section titled “Console CCD Trampoline (console_launcher.rs -> internal-ccd)”When a topology snapshot, layout apply, or restore is needed:
- Queries the active interactive console session via
WTSGetActiveConsoleSessionId(). - Duplicates the service’s own
LocalSystemprimary token viaOpenProcessToken+DuplicateTokenEx. - Retargets
TokenSessionIdviaSetTokenInformationto the active console session (Session > 0). - Spawns
zerovdd.exe internal-ccd <snapshot|apply|restore>viaCreateProcessAsUserWtargetingwinsta0\default(orwinsta0\winlogonwhen at the Lock Screen / UAC secure desktop).
Because the helper executes inside the active console session with LocalSystem rights, QueryDisplayConfig, SetDisplayConfig, and Windows 11 24H2 SET_HDR_STATE / SET_WCG_STATE calls succeed on logged-in desktops, UAC prompts, and the Lock Screen (Win+L).
Crash & Reboot Recovery (session.rs)
Section titled “Crash & Reboot Recovery (session.rs)”- Process supervision:
zerovdd-svcopens the recordedsunshine.exePID withSYNCHRONIZE | PROCESS_QUERY_LIMITED_INFORMATIONand verifiesGetProcessTimesmatchesowner_creation_timeto prevent PID-reuse races. Ifsunshine.exeexits unexpectedly (crash ortaskkill /F), the watcher immediately departs the virtual display and runsinternal-ccd restore. - Reboot / BSOD recovery: On service startup, if
%ProgramData%\zerovdd\topology-backup.jsonexists on disk,zerovdd-svcrestores physical monitors immediately when a console session is active, or defers restoration untilSERVICE_CONTROL_SESSIONCHANGEdeliversConsoleConnect,SessionLogon, orSessionUnlock. - Fallback restore: If no backup snapshot is present during
zerovdd display restore,restore_streaming_session_with_fallbackenables all attached physical display paths so users are never stranded on a blank monitor.