Skip to content

Fix native .NET startup and reject stale Mac foreground drivers - #4

Closed
jx-grxf wants to merge 2 commits into
virtual-67:mainfrom
jx-grxf:fix/seb-keyboard-layout-metadata
Closed

jx-grxf wants to merge 2 commits into
virtual-67:mainfrom
jx-grxf:fix/seb-keyboard-layout-metadata

Conversation

@jx-grxf

@jx-grxf jx-grxf commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

SEB 3.10.3 failed during shell initialization with System.NullReferenceException in System.Windows.Forms.InputLanguage.get_LayoutName(). The room had a working Mac keyboard but no HKLM\SYSTEM\CurrentControlSet\Control\Keyboard Layouts metadata. SEB had already switched to a private desktop, leaving the normal room windows hidden when startup failed.

Room preparation now adds missing US and German Layout Text values and verifies they can be read. Existing descriptions and the selected keyboard layout are preserved. The changed setup script participates in the existing baseline fingerprint, so prepared bases are refreshed. A WinForms probe exercises the actual current/installed layout getters.

Validation:

  • bash -n scripts/init-prefix.sh and git diff --check passed.
  • uv run --with pyyaml python -m unittest discover -s scripts/tests -v: 33 tests passed.
  • Native .NET Framework probe reproduced the exception before the local registry repair and completed with exit code 0 afterward. The added C# probe also compiled and completed with exit code 0 in the repaired room.
  • SEB initialized its client/session and reached the Moodle login and quiz landing page with the original configuration. The user subsequently completed an ungraded Moodle demo attempt in a separate local test app combining the 0.9.4 authentication helper and the rebuilt Mac driver. No real exam was exercised. One Wine layout is still labeled Unknown layout; this change prevents the missing-metadata crash and does not claim complete layout-name mapping.

The packaging gate now rejects a Mac driver without the normal NtUserSetForegroundWindow import. A build-only run can leave runtime/wine-build stale while the source patch is already present; packaging copies that installed runtime. This is a necessary check for the known artifact mismatch, not a substitute for runtime focus tests.

The Win32 foreground/desktop probe covers native macOS deactivation observations and server input-desktop restoration after graceful and abrupt process exit. It runs in disposable prefixes with stay-active disabled. Its documentation separates Win32 assertions from native Mac-window visibility checks.

Observed runtime comparison:

  • The shipped driver reproduced a foreground transition to Explorer's desktop on a private desktop.
  • A rebuilt matching Mac driver recorded three real deactivation events, foreground cleared to zero, and no desktop-foreground samples in the same custom-desktop scenario.
  • Graceful and abrupt lifecycle probes completed with exit code 0, input desktop restored to Default, and the intentionally hidden Win32 sentinel still hidden. Native Mac-window restoration, minimize/restore, macOS Spaces, and a full SEB exam are not certified by these results.

Release 0.9.4 still needs these changes: its published engine adds the computer-name/local-authentication helper correction but does not include the keyboard metadata setup. Its winemac.so is byte-for-byte identical to the installed 0.9.3 driver (SHA-256 2807bd5f7a91f366c8d735c5ca98aaf8adf396487d146c506196e84a57deeefe) and still uses the internal foreground setter in macdrv_app_deactivated. The new packaging check rejects that driver and accepts the rebuilt one. The source foreground fix already exists in 0034-Virtual-0035-clear-foreground-on-mac-focus-loss.patch; rebuild/install the engine before packaging.

SEB configuration, process monitoring, and focus-loss notifications remain unchanged. This PR does not certify SEB suitable for a real exam.

Local demo follow-up: SEB client and runtime logs recorded zero ERROR entries, successful recurring integrity checks, and no unexpected client exit, Explorer-desktop close, or SystemShutdown during the completed demo and screenshots. WindowGuard still warns that windows could not be excluded from capture (WindowGuard.Guard -> ExcludeFromCapture in SEB v3.10.3). Functional demo success does not establish capture protection under Wine. Long-duration, sleep/resume, network changes, minimize/restore and macOS Spaces acceptance remain open.

@jx-grxf jx-grxf changed the title Fix native .NET keyboard layout lookup during room startup Fix native .NET startup and reject stale Mac foreground drivers Nov 15, 2026
nyra-grz added a commit that referenced this pull request Nov 15, 2026
@jx-grxf

jx-grxf commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #5, based on v0.9.7. The generalized keyboard-layout initialization is already in main. #5 carries forward the packaged-driver gate and foreground probe, adds complete candidate installation and engine-asset validation, and includes the current regression coverage.

@jx-grxf jx-grxf closed this Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant