startup: check the overlay window choice between two guests #1530

Merged
Asimmimx merged 1 commit from upstream-pr/1537 into main 2026-11-24 16:11:30 +00:00
Asimmimx commented 2026-11-24 13:45:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Asimmimx on 2026-11-24T13:45:03Z.


Change

Refs #1149. This extends startup_overlay_window, the check for src/startup_stubs/overlay_window.h. overlay_window() picks the guest window that the fallback overlay (draw_overlay() in d3d12_xs_device.cpp) draws into. It enumerates top-level windows in z-order and stops at the first visible, unowned window of this process that is not the presenter.

The existing check creates only one guest window. So a mutant that keeps enumerating instead of stopping at the first match (return FALSE changed to return TRUE), and therefore picks the lowest guest, left it passing.

The new steps create a second guest window and use SetWindowPos(HWND_TOP) to make the z-order explicit. They raise the first guest and expect it to be chosen (exit 6 otherwise), then raise the second and expect that one (exit 7 otherwise). The second guest is destroyed before the existing teardown.

The change touches only tests/startup_overlay_window.cpp and two sentences in the "Output window and fallback diagnostics" section of docs/startup-runtime.md. There is no new CTest, and nothing changes in src/.

Verification

Commit 309cfede (main) plus this change, dev preset (Debug), Windows 11 Pro build 26300.9974, MSVC 19.51.36260, Windows SDK 10.0.26100.0.

ctest --preset dev --no-tests=error -R '^startup_overlay_window$' -V
#   Passed, 3 of 3 runs with the new steps and again after the mutation sweep

tests/docs_links_check.py, tests/bidi_controls_check.py and git diff --check passed.

Mutation probe

I applied each mutation to the header alone, rebuilt, ran the test, then reverted. None of this is committed.

Mutant Before After
control: never store the candidate killed (exit 3) killed
drop !IsWindowVisible killed killed
drop the GW_OWNER check killed killed
drop the same-process check killed* killed*
presenter comparison == 0 → != 0 killed killed
return FALSE → return TRUE (lowest guest wins) survived killed (exit 6)
class-name buffer 256 → 8 killed killed
GW_OWNER → GW_CHILD killed killed
drop the !GetClassNameW failure check killed killed

* The same-process mutant is killed only because the desktop has visible, unowned windows of other processes. In a session without any, it would survive. Pinning it would need a helper child process that owns a window, which I left out of this change.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6583186662 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1537). Originally posted by [Asimmimx](https://github.com/Asimmimx) on 2026-11-24T13:45:03Z. --- ## Change Refs #1149. This extends `startup_overlay_window`, the check for `src/startup_stubs/overlay_window.h`. `overlay_window()` picks the guest window that the fallback overlay (`draw_overlay()` in `d3d12_xs_device.cpp`) draws into. It enumerates top-level windows in z-order and stops at the first visible, unowned window of this process that is not the presenter. The existing check creates only one guest window. So a mutant that keeps enumerating instead of stopping at the first match (`return FALSE` changed to `return TRUE`), and therefore picks the lowest guest, left it passing. The new steps create a second guest window and use `SetWindowPos(HWND_TOP)` to make the z-order explicit. They raise the first guest and expect it to be chosen (exit 6 otherwise), then raise the second and expect that one (exit 7 otherwise). The second guest is destroyed before the existing teardown. The change touches only `tests/startup_overlay_window.cpp` and two sentences in the "Output window and fallback diagnostics" section of `docs/startup-runtime.md`. There is no new CTest, and nothing changes in `src/`. ## Verification Commit `309cfede` (`main`) plus this change, `dev` preset (Debug), Windows 11 Pro build 26300.9974, MSVC 19.51.36260, Windows SDK 10.0.26100.0. ```powershell ctest --preset dev --no-tests=error -R '^startup_overlay_window$' -V # Passed, 3 of 3 runs with the new steps and again after the mutation sweep ``` `tests/docs_links_check.py`, `tests/bidi_controls_check.py` and `git diff --check` passed. ## Mutation probe I applied each mutation to the header alone, rebuilt, ran the test, then reverted. None of this is committed. | Mutant | Before | After | |---|---|---| | control: never store the candidate | killed (exit 3) | killed | | drop `!IsWindowVisible` | killed | killed | | drop the `GW_OWNER` check | killed | killed | | drop the same-process check | killed* | killed* | | presenter comparison `== 0` → `!= 0` | killed | killed | | `return FALSE` → `return TRUE` (lowest guest wins) | **survived** | killed (exit 6) | | class-name buffer 256 → 8 | killed | killed | | `GW_OWNER` → `GW_CHILD` | killed | killed | | drop the `!GetClassNameW` failure check | killed | killed | \* The same-process mutant is killed only because the desktop has visible, unowned windows of other processes. In a session without any, it would survive. Pinning it would need a helper child process that owns a window, which I left out of this change. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted (Claude Code).
upstream-sync closed this pull request 2026-11-24 17:01:33 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1530
No description provided.