startup: map a console package drive letter to a real folder #1244

Merged
triggered02 merged 23 commits from upstream-pr/1251 into main 2026-11-28 03:56:25 +00:00
triggered02 commented 2026-11-24 05:31:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T05:31:54Z.


Implements the option proposed here.

A console executable opens its package at a fixed drive letter. --map-drive LETTER=FOLDER[;...] (or run.ps1 -MapDrive) rewrites the path of an open on a mapped letter to the real folder, in the caller's own path structure, inside the file hooks the launcher already installs for tracing. Nothing needs the letter to be free, and a real volume on that letter is not disturbed.

Two things the shape in the issue did not cover, which this had to handle:

  • The replacement is longer than the caller's buffer. A folder path is longer than a single letter, so an in-place write into the caller's UNICODE_STRING does not fit. When it does not, the launcher allocates the name in the target process and repoints the UNICODE_STRING at it, leaving that allocation to the process (the caller may keep the name while its handle is open).
  • Path form. Opens arrive as NT paths with a \??\ device prefix and optionally a [root ...] prefix; the rewrite keeps both. Separators are normalised, because the build directory arrives with forward slashes and NT paths reject those — that one cost me a debugging round.

Coverage — startup_map_drive, using a source-built consumer that opens <letter>:\map_drive_probe.txt:

case result
mapped letter (not a volume) with the option open succeeds, reads mapped ok, trace shows the MAP rewrite
same open without the option fails (open failed: 3)
open on a letter that is not mapped no MAP line; left alone
mapped letter Z: ok ('read 9 bytes: mapped ok')
negative control without the option: ok ('open failed: 3')
unmapped letter C: ok

Measured on Windows 11 build 26200 with the release preset; docs_links_check.py passes and the option is documented in docs/startup-runtime.md under the run instructions, including both limits.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5466702875 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T05:31:54Z. --- Implements the option proposed here. A console executable opens its package at a fixed drive letter. `--map-drive LETTER=FOLDER[;...]` (or `run.ps1 -MapDrive`) rewrites the path of an open on a mapped letter to the real folder, in the caller's own path structure, inside the file hooks the launcher already installs for tracing. Nothing needs the letter to be free, and a real volume on that letter is not disturbed. Two things the shape in the issue did not cover, which this had to handle: - **The replacement is longer than the caller's buffer.** A folder path is longer than a single letter, so an in-place write into the caller's `UNICODE_STRING` does not fit. When it does not, the launcher allocates the name in the target process and repoints the `UNICODE_STRING` at it, leaving that allocation to the process (the caller may keep the name while its handle is open). - **Path form.** Opens arrive as NT paths with a `\??\` device prefix and optionally a `[root ...]` prefix; the rewrite keeps both. Separators are normalised, because the build directory arrives with forward slashes and NT paths reject those — that one cost me a debugging round. **Coverage** — `startup_map_drive`, using a source-built consumer that opens `<letter>:\map_drive_probe.txt`: | case | result | |---|---| | mapped letter (not a volume) with the option | open succeeds, reads `mapped ok`, trace shows the `MAP` rewrite | | same open without the option | fails (`open failed: 3`) | | open on a letter that is not mapped | no `MAP` line; left alone | ``` mapped letter Z: ok ('read 9 bytes: mapped ok') negative control without the option: ok ('open failed: 3') unmapped letter C: ok ``` Measured on Windows 11 build 26200 with the `release` preset; `docs_links_check.py` passes and the option is documented in `docs/startup-runtime.md` under the run instructions, including both limits.
tedin7 commented 2026-11-24 05:38:26 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:38:26Z.

Review: COMMENTED


Dual-platform review of f6184535fdac13761aae61358f8f81cab23e2275 (startup: map a console package drive letter to a real folder).

Linux Checks

  • docs_links_check.py: PASS (16 Markdown files, 280 links)
  • bidi_controls_check.py: PASS (1055 tracked files, no bidirectional controls)
  • git diff --check origin/main...HEAD: PASS
  • AGENTS.md / title-neutrality audit: PASS (all 6 changed files are title-neutral)

Windows Server 2025 (MSVC 14.44 + sccache)

Command: run_pr_test.ps1 -Pr 1251 -Targets startup_map_drive_consumer,startup_stub_consumer -Regex startup_map_drive

  • dev (Debug): configure 1.51s, build 27.77s, ctest (startup_map_drive) 1/1 Passed in 0.44s
  • release (/O2): configure 1.52s, build 39.47s, ctest (startup_map_drive) 1/1 Passed in 0.36s

Code Audit & Edge Cases (tools/startup/debug_launch.py)

  1. [root ...] prefix mismatch in map_drive():
    • oa_name() formats root-relative paths without a space: f"[root {root:#x}]" + text (e.g. [root 0x123]\??\G:\foo).
    • map_drive() checks if body.startswith("[root ") and "] " in body: (looking for "] ", with a space), so when OBJECT_ATTRIBUTES.RootDirectory is non-zero, "] " is not matched, body[1] != ":" fails, and the path is never mapped.
    • Furthermore, even if "] " were present, replacement = root + prefix + ... prepends the synthetic [root 0x...] display tag into encoded before writing it back into the target process's UNICODE_STRING buffer, which would corrupt the kernel UNICODE_STRING if root were non-empty. root should only be kept in the log/display string, not written into UNICODE_STRING.
  2. Minor edge cases:
    • drive_map accepts letter.isalpha() (which includes non-ASCII Unicode letters in Python 3) rather than ASCII A–Z.
    • \\?\ (Win32 long-path prefix) is not in ("\\??\\", "\\\\.\\") (Win32 CreateFileW normalizes \\?\ to \??\ before NtCreateFile, so NT hooks see \??\, though direct callers passing \\?\ wouldn't match).
    • .. path traversal in body[2:] is preserved verbatim (expected for a launcher diagnostic rewrite).
    • struct.pack("<HH4xQ", len(encoded), len(encoded), fresh) assumes len(encoded) <= 65535 (USHORT limit of UNICODE_STRING).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6034238497 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#pullrequestreview-6034238497). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T05:38:26Z. **Review:** COMMENTED --- Dual-platform review of `f6184535fdac13761aae61358f8f81cab23e2275` (`startup: map a console package drive letter to a real folder`). ### Linux Checks - `docs_links_check.py`: **PASS** (16 Markdown files, 280 links) - `bidi_controls_check.py`: **PASS** (1055 tracked files, no bidirectional controls) - `git diff --check origin/main...HEAD`: **PASS** - `AGENTS.md` / title-neutrality audit: **PASS** (all 6 changed files are title-neutral) ### Windows Server 2025 (MSVC 14.44 + sccache) Command: `run_pr_test.ps1 -Pr 1251 -Targets startup_map_drive_consumer,startup_stub_consumer -Regex startup_map_drive` - `dev` (Debug): configure 1.51s, build 27.77s, `ctest` (`startup_map_drive`) **1/1 Passed** in 0.44s - `release` (`/O2`): configure 1.52s, build 39.47s, `ctest` (`startup_map_drive`) **1/1 Passed** in 0.36s ### Code Audit & Edge Cases (`tools/startup/debug_launch.py`) 1. **`[root ...]` prefix mismatch in `map_drive()`**: - `oa_name()` formats root-relative paths without a space: `f"[root {root:#x}]" + text` (e.g. `[root 0x123]\??\G:\foo`). - `map_drive()` checks `if body.startswith("[root ") and "] " in body:` (looking for `"] "`, with a space), so when `OBJECT_ATTRIBUTES.RootDirectory` is non-zero, `"] "` is not matched, `body[1] != ":"` fails, and the path is never mapped. - Furthermore, even if `"] "` were present, `replacement = root + prefix + ...` prepends the synthetic `[root 0x...]` display tag into `encoded` before writing it back into the target process's `UNICODE_STRING` buffer, which would corrupt the kernel `UNICODE_STRING` if `root` were non-empty. `root` should only be kept in the log/display string, not written into `UNICODE_STRING`. 2. **Minor edge cases**: - `drive_map` accepts `letter.isalpha()` (which includes non-ASCII Unicode letters in Python 3) rather than ASCII `A`–`Z`. - `\\?\` (Win32 long-path prefix) is not in `("\\??\\", "\\\\.\\")` (Win32 `CreateFileW` normalizes `\\?\` to `\??\` before `NtCreateFile`, so NT hooks see `\??\`, though direct callers passing `\\?\` wouldn't match). - `..` path traversal in `body[2:]` is preserved verbatim (expected for a launcher diagnostic rewrite). - `struct.pack("<HH4xQ", len(encoded), len(encoded), fresh)` assumes `len(encoded) <= 65535` (`USHORT` limit of `UNICODE_STRING`).
R0Y00 commented 2026-11-24 05:52:38 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T05:52:38Z.

Review: CHANGES_REQUESTED


Please make the mapped name temporary to the hooked NT call. The current path overwrites the caller's original name even in the short case. In the long case, every fresh name does a VirtualAllocEx and no path releases it, including a failed write after allocation. The test's single open cannot detect either problem.

Use the existing entry/return tracing boundary so the caller's name is restored, and release or reuse the temporary backing after the call. Please add a source-built case that reuses one caller-owned UNICODE_STRING across multiple opens and checks its length, buffer pointer, and contents after each return. Repeated opens on the mapped letter should still succeed and the number of live name allocations should not grow with the number of opens. The current disabled and unmapped controls still apply.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6034349936 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#pullrequestreview-6034349936). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T05:52:38Z. **Review:** CHANGES_REQUESTED --- Please make the mapped name temporary to the hooked NT call. The current path overwrites the caller's original name even in the short case. In the long case, every fresh name does a VirtualAllocEx and no path releases it, including a failed write after allocation. The test's single open cannot detect either problem. Use the existing entry/return tracing boundary so the caller's name is restored, and release or reuse the temporary backing after the call. Please add a source-built case that reuses one caller-owned UNICODE_STRING across multiple opens and checks its length, buffer pointer, and contents after each return. Repeated opens on the mapped letter should still succeed and the number of live name allocations should not grow with the number of opens. The current disabled and unmapped controls still apply.
tedin7 commented 2026-11-24 06:00:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T06:00:25Z.

Review: COMMENTED


Dual-platform retest of 78c8796d104a46e6c030392b1b82e428ecf6fa33 (delta from f6184535: 78c8796d startup: fix the drive rewrite for root-relative opens).

Delta Since f6184535 (tools/startup/debug_launch.py)

  • Restricts drive_map keys to ASCII A–Z (letter.isascii()).
  • Drops the synthetic [root 0x...] log tag from body instead of prepending it into replacement.
  • Adds \\?\ alongside \??\ and \\.\ prefix matching.
  • Guards len(encoded) against 0 < len(encoded) <= 0xFFFF before writing UNICODE_STRING.Length.

Linux Checks

  • git diff --check origin/main...HEAD: PASS
  • docs_links_check.py: PASS (16 Markdown files, 280 links)
  • bidi_controls_check.py: PASS (1055 tracked files, no bidirectional controls)

Windows Server 2025 (Build 26100, MSVC 14.44)

Command: C:\OEM\run_pr_test.ps1 -Pr 1251 -Targets 'startup_map_drive_consumer,startup_stub_consumer' -Regex '^startup_map_drive$' -Jobs 6 -Parallel 4

  • dev (Debug): ctest (startup_map_drive) 1/1 Passed (0.39s)
  • release (/O2): ctest (startup_map_drive) 1/1 Passed (0.37s)

Status Note

  • The CHANGES_REQUESTED items from @R0Y00 (restoring the caller's UNICODE_STRING after the hooked NT call, releasing/reusing VirtualAllocEx backing, and adding a multi-open reuse test) remain open as of 78c8796d.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6034418005 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#pullrequestreview-6034418005). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T06:00:25Z. **Review:** COMMENTED --- Dual-platform retest of `78c8796d104a46e6c030392b1b82e428ecf6fa33` (delta from `f6184535`: `78c8796d` *startup: fix the drive rewrite for root-relative opens*). ### Delta Since `f6184535` (`tools/startup/debug_launch.py`) - Restricts `drive_map` keys to ASCII `A`–`Z` (`letter.isascii()`). - Drops the synthetic `[root 0x...]` log tag from `body` instead of prepending it into `replacement`. - Adds `\\?\` alongside `\??\` and `\\.\` prefix matching. - Guards `len(encoded)` against `0 < len(encoded) <= 0xFFFF` before writing `UNICODE_STRING.Length`. ### Linux Checks - `git diff --check origin/main...HEAD`: **PASS** - `docs_links_check.py`: **PASS** (16 Markdown files, 280 links) - `bidi_controls_check.py`: **PASS** (1055 tracked files, no bidirectional controls) ### Windows Server 2025 (Build 26100, MSVC 14.44) Command: `C:\OEM\run_pr_test.ps1 -Pr 1251 -Targets 'startup_map_drive_consumer,startup_stub_consumer' -Regex '^startup_map_drive$' -Jobs 6 -Parallel 4` - **`dev` (Debug)**: `ctest` (`startup_map_drive`) **1/1 Passed** (0.39s) - **`release` (`/O2`)**: `ctest` (`startup_map_drive`) **1/1 Passed** (0.37s) ### Status Note - The `CHANGES_REQUESTED` items from `@R0Y00` (restoring the caller's `UNICODE_STRING` after the hooked NT call, releasing/reusing `VirtualAllocEx` backing, and adding a multi-open reuse test) remain open as of `78c8796d`.
R0Y00 commented 2026-11-24 06:32:10 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T06:32:10Z.

Review: CHANGES_REQUESTED


The 32-open fixture now checks restoration on the serial long-name path. Two cases still fail by inspection in db912372.

  • The one process-wide scratch allocation can still be in use when a second thread enters a hooked call. The second rewrite can overwrite it, or free it when growing the buffer, before the first call has consumed its name. Please keep the backing valid per in-flight call and add a deterministic overlap control, or use separate temporary allocations tied to each return.
  • restore is assigned only in the file-name branch, but the common if desc: also handles the other trace kinds. Initialise it before the dispatch so those traces cannot see an unbound or earlier callback.

The serial restoration check should stay. A two-call overlap test should verify both observed names and both restored caller strings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6034703372 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#pullrequestreview-6034703372). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T06:32:10Z. **Review:** CHANGES_REQUESTED --- The 32-open fixture now checks restoration on the serial long-name path. Two cases still fail by inspection in `db912372`. - The one process-wide scratch allocation can still be in use when a second thread enters a hooked call. The second rewrite can overwrite it, or free it when growing the buffer, before the first call has consumed its name. Please keep the backing valid per in-flight call and add a deterministic overlap control, or use separate temporary allocations tied to each return. - `restore` is assigned only in the file-name branch, but the common `if desc:` also handles the other trace kinds. Initialise it before the dispatch so those traces cannot see an unbound or earlier callback. The serial restoration check should stay. A two-call overlap test should verify both observed names and both restored caller strings.
chatgpt-codex-connector[bot commented 2026-11-24 06:50:27 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T05:32:03Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T05:36:01.293558Z f618453 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7123037333 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#issuecomment-7123037333). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T05:32:03Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"f6184535fdac13761aae61358f8f81cab23e2275","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T05:36:01.293558Z">2026-11-24T05:36:01.293558Z</relative-time> | `f618453` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
triggered02 commented 2026-11-24 06:50:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T05:41:36Z.


Fixed in 78c8796d. The root-relative case was a real bug, and worse than a missed mapping: had the separator matched, the synthetic [root 0x...] tag would have gone into the kernel UNICODE_STRING. The tag is now drained by finding ] and dropped entirely, since it is only a log label and never part of the name.

Also taken from the review: \\\\\\\\?\\\\\\\\ is matched alongside \\\\\\\\??\\\\\\\\ and \\\\\\\\.\\\\\\\\; mapping letters are ASCII A-Z rather than anything isalpha() accepts; and a replacement over 0xFFFF bytes is refused, because a UNICODE_STRING length is a USHORT.

startup_map_drive still passes (mapped letter reads its content, negative control fails, unmapped letter untouched). The root-relative path is not covered by that fixture, because CreateFileW builds the object name without a RootDirectory — a direct NtCreateFile consumer would be needed to exercise it. Say if you want that added before merge.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7123185215 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#issuecomment-7123185215). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T05:41:36Z. --- Fixed in `78c8796d`. The root-relative case was a real bug, and worse than a missed mapping: had the separator matched, the synthetic `[root 0x...]` tag would have gone into the kernel `UNICODE_STRING`. The tag is now drained by finding `]` and dropped entirely, since it is only a log label and never part of the name. Also taken from the review: `\\\\\\\\?\\\\\\\\` is matched alongside `\\\\\\\\??\\\\\\\\` and `\\\\\\\\.\\\\\\\\`; mapping letters are ASCII A-Z rather than anything `isalpha()` accepts; and a replacement over 0xFFFF bytes is refused, because a `UNICODE_STRING` length is a USHORT. `startup_map_drive` still passes (mapped letter reads its content, negative control fails, unmapped letter untouched). The root-relative path is not covered by that fixture, because `CreateFileW` builds the object name without a `RootDirectory` — a direct `NtCreateFile` consumer would be needed to exercise it. Say if you want that added before merge.
triggered02 commented 2026-11-24 06:50:30 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T06:10:07Z.


All three points are addressed in db912372.

The name is now temporary to the hooked call. The entry trace records what the caller's UNICODE_STRING held, and the existing return boundary restores it — length, buffer pointer and contents — before anything else runs. Both cases you called out are covered: the short case restores the caller's own buffer contents as well as the header, and the long case restores the pointed-to name. I also moved the offline deny check ahead of the rewrite, so a refused call never borrows the name at all.

The backing is one reusable allocation, not one per open. It is grown on demand and the previous block released; a failed write after growth leaves the caller's string untouched (the previous code leaked in that path too).

New fixture mode (X2W_PROBE_MODE=reuse), as asked: the source-built consumer builds one caller-owned UNICODE_STRING whose buffer is exactly its own size, calls NtCreateFile through the mapped letter 32 times, and after every return checks Length, MaximumLength, Buffer identity and contents. The check also requires the trace to show one name allocation for those 32 opens, so allocation growth fails it.

mapped letter Z: ok ('read 9 bytes: mapped ok')
negative control without the option: ok ('open failed: 3')
unmapped letter C: ok
reused caller name over 32 opens: ok (name allocations=1, rewrites=32)

Mutation control, so the new case is known to bite: with the restore removed it fails at the first open with caller name changed after open 0: length=136 maximum=136 buffer_moved=1, and with per-open allocation it fails on the allocation count.

The disabled and unmapped controls still apply and still pass. docs_links_check.py passes and docs/startup-runtime.md now describes the temporary-name and reuse behaviour instead of the old "allocation left to the process" limit.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7123654122 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#issuecomment-7123654122). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T06:10:07Z. --- All three points are addressed in `db912372`. **The name is now temporary to the hooked call.** The entry trace records what the caller's `UNICODE_STRING` held, and the existing return boundary restores it — length, buffer pointer and contents — before anything else runs. Both cases you called out are covered: the short case restores the caller's own buffer contents as well as the header, and the long case restores the pointed-to name. I also moved the offline deny check ahead of the rewrite, so a refused call never borrows the name at all. **The backing is one reusable allocation, not one per open.** It is grown on demand and the previous block released; a failed write after growth leaves the caller's string untouched (the previous code leaked in that path too). **New fixture mode** (`X2W_PROBE_MODE=reuse`), as asked: the source-built consumer builds one caller-owned `UNICODE_STRING` whose buffer is exactly its own size, calls `NtCreateFile` through the mapped letter **32 times**, and after every return checks `Length`, `MaximumLength`, `Buffer` identity and contents. The check also requires the trace to show **one** name allocation for those 32 opens, so allocation growth fails it. ``` mapped letter Z: ok ('read 9 bytes: mapped ok') negative control without the option: ok ('open failed: 3') unmapped letter C: ok reused caller name over 32 opens: ok (name allocations=1, rewrites=32) ``` **Mutation control**, so the new case is known to bite: with the restore removed it fails at the first open with `caller name changed after open 0: length=136 maximum=136 buffer_moved=1`, and with per-open allocation it fails on the allocation count. The disabled and unmapped controls still apply and still pass. `docs_links_check.py` passes and `docs/startup-runtime.md` now describes the temporary-name and reuse behaviour instead of the old "allocation left to the process" limit.
triggered02 commented 2026-11-24 06:50:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T06:39:09Z.


Both points are fixed in a6c20e2b, and the overlap control you asked for is added — it also found a separate problem worth its own issue.

Per-call backing. The single scratch allocation is gone. Each hooked call borrows a buffer for the duration of that call and returns it to a pool when its name is restored, so overlapping calls cannot overwrite or free each other's name, while a serial run still reuses one buffer — the 32-open case still reports one name allocation.

restore initialisation. It is now set before the trace-kind dispatch. You were right that the common if desc: serves every kind: a count, runtime or bink trace would either see an unbound name or, worse, carry over the previous call's callback and restore another call's string.

The overlap control, and what it exposed. Two threads, 32 opens each, source-built consumer:

case result
two threads, no mapping, real file through its own letter 64/64 opens succeed
two threads, --map-drive 40/64 opens traced and rewritten (46/64 on a repeat)

Without mapping the same two-thread pattern is 64/64, so this is not the consumer, the file system or general tracing — it is the launcher's entry hook: one patched byte per function, so a thread entering while another is being stepped over runs untraced and keeps its unmapped name. That misses file-tracing lines and, worse, can let an offline-denied socket through, so I filed it as #1281 instead of papering over it here.

startup_map_drive_overlap holds your control in the tree as an expected failure (WILL_FAIL), so it runs on every CI job, is documented, and will start failing the suite once the hook stops dropping concurrent calls — that failure is the signal to promote it to a normal gate. If you would rather it were a hard gate now, the fix belongs in the hook (per-thread hardware breakpoints or suspending during the step) and I can take that as #1281.

Verification at a6c20e2b (Windows 11 build 26200, release preset):

mapped letter Z: ok ('read 9 bytes: mapped ok')
negative control without the option: ok ('open failed: 3')
unmapped letter C: ok
reused caller name over 32 opens: ok (name allocations=1, rewrites=32)
startup_map_drive .......... Passed
startup_map_drive_overlap .. Passed (expected failure: traced 46 of 64)

Mutation controls: forcing the buffer back to one shared allocation makes the overlap case report one name allocation instead of two; removing the restore makes the serial case fail at the first open with "caller name changed after open 0". The serial restoration check stays, as you asked.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7124152745 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#issuecomment-7124152745). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T06:39:09Z. --- Both points are fixed in `a6c20e2b`, and the overlap control you asked for is added — it also found a separate problem worth its own issue. **Per-call backing.** The single scratch allocation is gone. Each hooked call borrows a buffer for the duration of that call and returns it to a pool when its name is restored, so overlapping calls cannot overwrite or free each other's name, while a serial run still reuses one buffer — the 32-open case still reports one name allocation. **`restore` initialisation.** It is now set before the trace-kind dispatch. You were right that the common `if desc:` serves every kind: a count, runtime or bink trace would either see an unbound name or, worse, carry over the previous call's callback and restore another call's string. **The overlap control, and what it exposed.** Two threads, 32 opens each, source-built consumer: | case | result | |---|---| | two threads, no mapping, real file through its own letter | **64/64 opens succeed** | | two threads, `--map-drive` | **40/64 opens traced and rewritten** (46/64 on a repeat) | Without mapping the same two-thread pattern is 64/64, so this is not the consumer, the file system or general tracing — it is the launcher's entry hook: one patched byte per function, so a thread entering while another is being stepped over runs untraced and keeps its unmapped name. That misses file-tracing lines and, worse, can let an offline-denied socket through, so I filed it as #1281 instead of papering over it here. `startup_map_drive_overlap` holds your control in the tree as an expected failure (`WILL_FAIL`), so it runs on every CI job, is documented, and will start failing the suite once the hook stops dropping concurrent calls — that failure is the signal to promote it to a normal gate. If you would rather it were a hard gate now, the fix belongs in the hook (per-thread hardware breakpoints or suspending during the step) and I can take that as #1281. Verification at `a6c20e2b` (Windows 11 build 26200, release preset): ``` mapped letter Z: ok ('read 9 bytes: mapped ok') negative control without the option: ok ('open failed: 3') unmapped letter C: ok reused caller name over 32 opens: ok (name allocations=1, rewrites=32) startup_map_drive .......... Passed startup_map_drive_overlap .. Passed (expected failure: traced 46 of 64) ``` Mutation controls: forcing the buffer back to one shared allocation makes the overlap case report one name allocation instead of two; removing the restore makes the serial case fail at the first open with "caller name changed after open 0". The serial restoration check stays, as you asked.
R0Y00 commented 2026-11-24 10:51:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T10:51:36Z.

Review: CHANGES_REQUESTED


The rebase keeps the valloc trace and initializes the restore callback before dispatch. The serial 32-open control is useful. The overlap case still permits a mapped open to miss the rewrite, and WILL_FAIL can accept unrelated failures. Please keep this waiting on #1281, then make the overlap case pass only when both opens see the mapped names and both caller strings are restored. Keep the serial reuse and disabled controls.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6037884091 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#pullrequestreview-6037884091). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T10:51:36Z. **Review:** CHANGES_REQUESTED --- The rebase keeps the valloc trace and initializes the restore callback before dispatch. The serial 32-open control is useful. The overlap case still permits a mapped open to miss the rewrite, and WILL_FAIL can accept unrelated failures. Please keep this waiting on #1281, then make the overlap case pass only when both opens see the mapped names and both caller strings are restored. Keep the serial reuse and disabled controls.
triggered02 commented 2026-11-24 11:03:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T10:40:36Z.


Conflict fixed. The branch is rebased onto current main (a8946ec0) and force-pushed as ad94c950; it is 0 commits behind.

The conflict was in tools/startup/debug_launch.py, in the frame-hook dispatch, and it was a real one — both sides edited the same block for different reasons:

  • main added the valloc trace branch (NtAllocateVirtualMemory/Ex requested base, size, type, protect and the caller chain);
  • this branch added restore = None initialisation so every trace kind starts with a clean restore callback, plus a return-address read that tolerates a short read.

I kept both: the valloc branch is preserved verbatim, restore = None is initialised before the dispatch so a non-name trace cannot see an unbound name or carry over the previous call's callback, and the return-address read uses the short-read-tolerant form. Nothing from either side was dropped.

Verified after the rebase:

  • startup_map_drive and startup_map_drive_overlap pass (2/2);
  • debug_launch.py parses, and a live 75 s launcher run with -MapDrive worked: 374 mapped-name log lines, no trace-related errors.

startup_map_drive_overlap is still registered WILL_FAIL on purpose — it documents the launcher dropping concurrent hits (#1281) rather than asserting correct behaviour.

The earlier CHANGES_REQUESTED from 06:32 predates the previous head, so it may not reflect this state; happy to address anything that still applies.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7129096937 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#issuecomment-7129096937). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T10:40:36Z. --- Conflict fixed. The branch is rebased onto current `main` (`a8946ec0`) and force-pushed as `ad94c950`; it is 0 commits behind. The conflict was in `tools/startup/debug_launch.py`, in the frame-hook dispatch, and it was a real one — both sides edited the same block for different reasons: - `main` added the **`valloc` trace** branch (`NtAllocateVirtualMemory`/`Ex` requested base, size, type, protect and the caller chain); - this branch added `restore = None` initialisation so every trace kind starts with a clean restore callback, plus a return-address read that tolerates a short read. I kept both: the `valloc` branch is preserved verbatim, `restore = None` is initialised before the dispatch so a non-name trace cannot see an unbound name or carry over the previous call's callback, and the return-address read uses the short-read-tolerant form. Nothing from either side was dropped. Verified after the rebase: - `startup_map_drive` and `startup_map_drive_overlap` pass (2/2); - `debug_launch.py` parses, and a live 75 s launcher run with `-MapDrive` worked: 374 mapped-name log lines, no trace-related errors. `startup_map_drive_overlap` is still registered `WILL_FAIL` on purpose — it documents the launcher dropping concurrent hits (#1281) rather than asserting correct behaviour. The earlier `CHANGES_REQUESTED` from 06:32 predates the previous head, so it may not reflect this state; happy to address anything that still applies.
lambirou commented 2026-11-24 14:03:27 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-24T13:52:47Z.


I tested this branch against the failure in #1158 with a local package stored on another volume, with no G: volume present.

-MapDrive G=F:\... does rewrite the NT opens. files.txt shows MAP \??\G:\appdata0.rpf -> \??\F:\...\appdata0.rpf for both NtQueryAttributesFile and NtCreateFile, and common.rpf follows the same path. Those opens succeed.

The run still stops at 0.36 s in vcruntime140.dll+0x1989 (access violation, write to null, size 0x7ffffe0f0). stderr.txt shows:

x2w-dstorage Factory::OpenFile path="G:\appdata0.rpf" ... -> ok (err 0)

The DirectStorage stand-in's own Factory::OpenFile path is not rewritten by the file hook, so the package data is still not read from the real folder. With subst G: F:\... (a real drive mapping), the same run passes this point, reaches D3D12 and reaches about 29 fps in a 240 s run; a 25 s run rewrites CLZERO and presents frames.

So the NT path rewrite works, but it does not cover the DirectStorage stand-in. If that is outside this PR's scope, the documented limit should state that a title using DirectStorage still needs the drive letter mounted. Otherwise the stand-in's OpenFile needs to resolve the mapped letter too.

Measured on Windows 11 26H2 build 26300 with a Radeon RX 9060 XT (driver 32.0.32029.2010).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7133473128 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#issuecomment-7133473128). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-24T13:52:47Z. --- I tested this branch against the failure in #1158 with a local package stored on another volume, with no `G:` volume present. `-MapDrive G=F:\...` does rewrite the NT opens. `files.txt` shows `MAP \??\G:\appdata0.rpf -> \??\F:\...\appdata0.rpf` for both `NtQueryAttributesFile` and `NtCreateFile`, and `common.rpf` follows the same path. Those opens succeed. The run still stops at 0.36 s in `vcruntime140.dll+0x1989` (access violation, write to null, size `0x7ffffe0f0`). `stderr.txt` shows: ``` x2w-dstorage Factory::OpenFile path="G:\appdata0.rpf" ... -> ok (err 0) ``` The DirectStorage stand-in's own `Factory::OpenFile` path is not rewritten by the file hook, so the package data is still not read from the real folder. With `subst G: F:\...` (a real drive mapping), the same run passes this point, reaches D3D12 and reaches about 29 fps in a 240 s run; a 25 s run rewrites `CLZERO` and presents frames. So the NT path rewrite works, but it does not cover the DirectStorage stand-in. If that is outside this PR's scope, the documented limit should state that a title using DirectStorage still needs the drive letter mounted. Otherwise the stand-in's `OpenFile` needs to resolve the mapped letter too. Measured on Windows 11 26H2 build 26300 with a Radeon RX 9060 XT (driver `32.0.32029.2010`).
SuperCraft3M commented 2026-11-24 15:02:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by SuperCraft3M on 2026-11-24T14:09:32Z.


Independent local integration result: main 8f438025 + #1251 ad94c950 + #1408 ecbbf3e2 + UTF-8 storage #1551, integration branch SuperCraft3M/Xbox2Windows runtime/startup-null-diagnosis at 30988289.

On Windows 11 build 26300.9711 / RTX 4070 driver 32.0.16.2114, Debug stand-ins, offline debugger, the same isolated local executable stopped on an early null write without the package-drive mapping. Mapping its expected package letter to the actual package directory passed that point. With #1251 alone one repeat still stopped early. With #1408's protected step windows integrated, the final mapped run reached its 150-second timeout and displayed a profile-selection prompt. The debugger reported 12,330 hook entries, 24,651 step windows, 0 unprotected windows, 143 deferred hits and 0 timeouts; 4 network opens were refused. Six translated pipelines were available, none missing at the last render summary.

This used the documented diagnostic runtime with --continue-asserts 1000, a 14 GiB job cap and a local shader cache. It is not evidence of gameplay or original-executable startup without diagnostic assertion continuation. No executable bytes were patched on disk; raw logs and screenshots stay local.

The combined source-built checks (startup_map_drive, startup_map_drive_overlap, startup_hook_window, startup_hook_overlap) passed 4/4, no skips. The overlap fixture now reports 64/64 opens, traces and rewrites with both caller-owned names intact. Merge-resolution details are on #1408: https://github.com/R0Y00/Xbox2Windows/pull/1408#issuecomment-7133877247 .

AI-assisted (Codex).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7133930521 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#issuecomment-7133930521). Originally posted by [SuperCraft3M](https://github.com/SuperCraft3M) on 2026-11-24T14:09:32Z. --- Independent local integration result: main 8f438025 + #1251 ad94c950 + #1408 ecbbf3e2 + UTF-8 storage #1551, integration branch SuperCraft3M/Xbox2Windows runtime/startup-null-diagnosis at 30988289. On Windows 11 build 26300.9711 / RTX 4070 driver 32.0.16.2114, Debug stand-ins, offline debugger, the same isolated local executable stopped on an early null write without the package-drive mapping. Mapping its expected package letter to the actual package directory passed that point. With #1251 alone one repeat still stopped early. With #1408's protected step windows integrated, the final mapped run reached its 150-second timeout and displayed a profile-selection prompt. The debugger reported 12,330 hook entries, 24,651 step windows, 0 unprotected windows, 143 deferred hits and 0 timeouts; 4 network opens were refused. Six translated pipelines were available, none missing at the last render summary. This used the documented diagnostic runtime with --continue-asserts 1000, a 14 GiB job cap and a local shader cache. It is not evidence of gameplay or original-executable startup without diagnostic assertion continuation. No executable bytes were patched on disk; raw logs and screenshots stay local. The combined source-built checks (startup_map_drive, startup_map_drive_overlap, startup_hook_window, startup_hook_overlap) passed 4/4, no skips. The overlap fixture now reports 64/64 opens, traces and rewrites with both caller-owned names intact. Merge-resolution details are on #1408: https://github.com/R0Y00/Xbox2Windows/pull/1408#issuecomment-7133877247 . AI-assisted (Codex).
lambirou commented 2026-11-24 15:02:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-24T14:56:12Z.


Correction to my comment above: the 0.36 s failure came from testing the PR head before current main was merged, not from a DirectStorage gap.

I merged current main into the branch locally (the conflicts were in CMakeLists.txt and run.ps1; both were mechanical), rebuilt the stand-ins, and reran the same 30 s startup with no G: volume. It now reaches the 30 s timeout with:

host-cpu sites rewritten: clzero x5, monitorx x1, mwaitx x1

Factory::OpenFile returns ok for G:\appdata0.rpf, common.rpf, movies.rpf, shaders.rpf, anim.rpf, data.rpf, levels.rpf, navmeshes.rpf, packs.rpf, textures.rpf, audio.rpf and script.rpf, and files.txt shows the corresponding MAP lines. So the option does cover the DirectStorage opens; no stand-in change is needed.

The PR just needs a rebase onto current main. Sorry for the noise in the previous comment.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7135190370 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#issuecomment-7135190370). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-24T14:56:12Z. --- Correction to my comment above: the 0.36 s failure came from testing the PR head before current `main` was merged, not from a DirectStorage gap. I merged current `main` into the branch locally (the conflicts were in `CMakeLists.txt` and `run.ps1`; both were mechanical), rebuilt the stand-ins, and reran the same 30 s startup with no `G:` volume. It now reaches the 30 s timeout with: ``` host-cpu sites rewritten: clzero x5, monitorx x1, mwaitx x1 ``` `Factory::OpenFile` returns ok for `G:\appdata0.rpf`, `common.rpf`, `movies.rpf`, `shaders.rpf`, `anim.rpf`, `data.rpf`, `levels.rpf`, `navmeshes.rpf`, `packs.rpf`, `textures.rpf`, `audio.rpf` and `script.rpf`, and `files.txt` shows the corresponding `MAP` lines. So the option does cover the DirectStorage opens; no stand-in change is needed. The PR just needs a rebase onto current `main`. Sorry for the noise in the previous comment.
tedin7 commented 2026-11-24 18:06:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T18:06:48Z.

Review: COMMENTED


Re-review of head ad94c95065 (comment only, not an approval). My earlier reviews were at f6184535 and 78c8796d.

Verdict: 0 P1 / 1 P2, plus nits.

P2: startup_map_drive_overlap can pass for the wrong reason (CMakeLists.txt; the open point from the 10:51 review)

  • The test is WILL_FAIL TRUE, so any exit 1 counts as the expected result: a consumer crash, a thread timeout or a wrong caller name all turn into a pass. The documented cause (dropped hook hits, #1281) is not checked.
  • startup_map_drive_check.py overlap exits 0 only if "overlap ok" in stdout and allocations >= 2; the allocation count is an internal pool detail, not something the caller sees.
  • Once #1281 or #1408 lands (64/64 is reported), the suite goes red unless someone removes WILL_FAIL. The test should instead pass only when all 64 opens are rewritten and both caller strings are restored. This is from reading the code; the launcher needs Windows.

Earlier points

  • Fixed: the [root ...] tag mismatch (the tag is dropped, not written into the name); restoring the caller's UNICODE_STRING with a 32-open serial test; a per-call buffer pool instead of one shared scratch allocation; restore = None set before the dispatch; the ASCII A-Z letter check, the \\?\ prefix and the 0xFFFF length guard.
  • Open: the 10:51 request (the P2), overlap still losing concurrent hits (#1281, now documented), and no test for root-relative opens (the author says so).

Path handling (a small harness running the real map_drive code on Linux)

  • \??\G:\a\b maps to \??\D:\pkg\a\b; lower-case g: works; \\.\ and \\?\ prefixes are kept; trailing separators on the folder are trimmed for both / and \; H:, GG: and \??\UNC\srv\G:\a are left alone.
  • Nit: G:\..\..\Windows\x becomes D:\pkg\..\..\Windows\x; .. is passed through, not resolved. NT opens do not resolve .. so I do not think it escapes the folder, but I could not test that on Windows. Resolving .. before the join would be a cheap guard.
  • Nit: G:foo becomes D:\pkgfoo; a UNC or relative folder is not validated (the open then fails visibly); root-relative opens keep RootDirectory while the name becomes absolute, untested.

Other checks

  • No assertion is weakened; no source-text tests; title-neutral.
  • Nit: debug_launch.py has the "Offline mode" deny block twice (about lines 503 and 520); the second can never run because the first already returns, so the old copy should have been deleted.
  • Nit: the name_buffers <= 1 check asserts pool internals. The docs contain an em dash.

Run

  • git diff --check origin/main...HEAD, docs_links_check (16 files, 319 links), bidi_controls_check, ast.parse of debug_launch.py and startup_map_drive_check.py, and x86_64-w64-mingw32-g++ -std=c++17 -fsyntax-only tests/startup_map_drive_consumer.cpp: pass.
  • The PR's own tests need Windows, so I mutated tools/startup/debug_launch.py and ran a fake-memory harness around the real map_drive (restored with git checkout -- each time). Caught: no restore of the caller name (short case), pool-free path skipped (long case not restored), case-sensitive letter lookup, root tag kept in the name. By inspection NOT covered by the PR's tests: the case-sensitive lookup (only upper-case Z is used), root-relative opens, the 0xFFFF guard, the \\.\ and \\?\ prefixes, and a pool that never reuses a buffer (only name_buffers <= 1 on Windows would see it).

Not run: startup_map_drive, startup_map_drive_overlap and the consumer (Windows).

Linux limits: no Windows, WARP or GPU here; LLVM 19 only (CI pins LLVM 15). Anything that needs them was not run.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6044735135 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#pullrequestreview-6044735135). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T18:06:48Z. **Review:** COMMENTED --- Re-review of head ad94c95065ef2ad58924221a72c814261c0c56d1 (comment only, not an approval). My earlier reviews were at f6184535 and 78c8796d. Verdict: 0 P1 / 1 P2, plus nits. P2: `startup_map_drive_overlap` can pass for the wrong reason (CMakeLists.txt; the open point from the 10:51 review) - The test is `WILL_FAIL TRUE`, so any exit 1 counts as the expected result: a consumer crash, a thread timeout or a wrong caller name all turn into a pass. The documented cause (dropped hook hits, #1281) is not checked. - `startup_map_drive_check.py overlap` exits 0 only if `"overlap ok" in stdout` and `allocations >= 2`; the allocation count is an internal pool detail, not something the caller sees. - Once #1281 or #1408 lands (64/64 is reported), the suite goes red unless someone removes `WILL_FAIL`. The test should instead pass only when all 64 opens are rewritten and both caller strings are restored. This is from reading the code; the launcher needs Windows. Earlier points - Fixed: the `[root ...]` tag mismatch (the tag is dropped, not written into the name); restoring the caller's `UNICODE_STRING` with a 32-open serial test; a per-call buffer pool instead of one shared scratch allocation; `restore = None` set before the dispatch; the ASCII A-Z letter check, the `\\?\` prefix and the 0xFFFF length guard. - Open: the 10:51 request (the P2), overlap still losing concurrent hits (#1281, now documented), and no test for root-relative opens (the author says so). Path handling (a small harness running the real `map_drive` code on Linux) - `\??\G:\a\b` maps to `\??\D:\pkg\a\b`; lower-case `g:` works; `\\.\` and `\\?\` prefixes are kept; trailing separators on the folder are trimmed for both `/` and `\`; `H:`, `GG:` and `\??\UNC\srv\G:\a` are left alone. - Nit: `G:\..\..\Windows\x` becomes `D:\pkg\..\..\Windows\x`; `..` is passed through, not resolved. NT opens do not resolve `..` so I do not think it escapes the folder, but I could not test that on Windows. Resolving `..` before the join would be a cheap guard. - Nit: `G:foo` becomes `D:\pkgfoo`; a UNC or relative folder is not validated (the open then fails visibly); root-relative opens keep `RootDirectory` while the name becomes absolute, untested. Other checks - No assertion is weakened; no source-text tests; title-neutral. - Nit: debug_launch.py has the "Offline mode" deny block twice (about lines 503 and 520); the second can never run because the first already returns, so the old copy should have been deleted. - Nit: the `name_buffers <= 1` check asserts pool internals. The docs contain an em dash. Run - `git diff --check origin/main...HEAD`, docs_links_check (16 files, 319 links), bidi_controls_check, `ast.parse` of debug_launch.py and startup_map_drive_check.py, and `x86_64-w64-mingw32-g++ -std=c++17 -fsyntax-only tests/startup_map_drive_consumer.cpp`: pass. - The PR's own tests need Windows, so I mutated tools/startup/debug_launch.py and ran a fake-memory harness around the real `map_drive` (restored with `git checkout --` each time). Caught: no restore of the caller name (short case), pool-free path skipped (long case not restored), case-sensitive letter lookup, root tag kept in the name. By inspection NOT covered by the PR's tests: the case-sensitive lookup (only upper-case Z is used), root-relative opens, the 0xFFFF guard, the `\\.\` and `\\?\` prefixes, and a pool that never reuses a buffer (only `name_buffers <= 1` on Windows would see it). Not run: `startup_map_drive`, `startup_map_drive_overlap` and the consumer (Windows). Linux limits: no Windows, WARP or GPU here; LLVM 19 only (CI pins LLVM 15). Anything that needs them was not run. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 13:01:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:53:45Z.


@triggered02 could you rebase this branch onto current main and force-push?

GitHub reports head ad94c950 as conflicting with main, so it cannot be merged as is.

Files that conflict with current main (cf97bee1):

  • CMakeLists.txt
  • docs/startup-runtime.md
  • tools/startup/run.ps1

Commands run locally:

git fetch origin main pull/1251/head
git merge-tree --write-tree --name-only origin/main FETCH_HEAD
gh pr view 1251 --json mergeable   # CONFLICTING

Once it is rebased and CI is green it will be re-checked right away.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7163005616 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#issuecomment-7163005616). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T12:53:45Z. --- @triggered02 could you rebase this branch onto current `main` and force-push? GitHub reports head `ad94c950` as conflicting with `main`, so it cannot be merged as is. Files that conflict with current `main` (`cf97bee1`): - `CMakeLists.txt` - `docs/startup-runtime.md` - `tools/startup/run.ps1` Commands run locally: ``` git fetch origin main pull/1251/head git merge-tree --write-tree --name-only origin/main FETCH_HEAD gh pr view 1251 --json mergeable # CONFLICTING ``` Once it is rebased and CI is green it will be re-checked right away. AI-assisted; commands listed were executed locally.
triggered02 commented 2026-11-25 19:04:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-25T18:07:50Z.


Rebased onto current main and force-pushed: head is now 83a7023d on startup/map-drive (was ad94c950, based on cf97bee1).

83a7023d startup: keep the mapped name per call and report a dropped-hook limit
86fcb9d4 startup: borrow the mapped name only for the hooked call
73d617f5 startup: fix the drive rewrite for root-relative opens
7a7473a1 startup: map a console package drive letter to a real folder

All four commits replayed; none became empty and the messages are unchanged. git diff --stat origin/main..HEAD is the PR's six files and nothing else: CMakeLists.txt +19, docs/startup-runtime.md +30, tests/startup_map_drive_check.py +112, tests/startup_map_drive_consumer.cpp +202, tools/startup/debug_launch.py +128, tools/startup/run.ps1 +5.

Conflict resolutions (all three files, keeping main's newer text and re-applying only the PR's own lines):

  • CMakeLists.txt — main has moved and grown the launcher/debugger block. The startup_map_drive_consumer executable and its cxx_std_17 are now defined with the other debugger inputs after startup_debug_probe/startup_debug_calls (:1114-1117), and startup_map_drive (:3460) plus startup_map_drive_overlap (:3468, WILL_FAIL) are registered right after startup_debug inside the if(EXISTS "${INTAKE_PYTHON}") guard. main's storage/inflate/refusal tests are verbatim.
  • docs/startup-runtime.md — the ### Package on another volume section sits after the "It writes:" log-file table (:692) and before ### Translating shaders during a run; main's expanded run.ps1 paragraph and new log-table prose are kept.
  • tools/startup/run.ps1 — -MapDrive is added before $StoragePath (:23) with main's trailing-backslash note intact, $mapArgs at :76-77, fed as @mapArgs @traceArgs into main's $python/try-finally invocation (:80).

Verification on 83a7023d (from F:\x2w-wt-1251, out/pe-env Python 3.12.10):

command exit result
git diff --check (and origin/main..HEAD) 0 clean
tools/startup/debug_launch.py argv harness with -MapDrive 0 forwarded as --map-drive G=D:\package, no problems
tests/docs_links_check.py 0 19 Markdown files, 466 links
tests/bidi_controls_check.py 0 1728 tracked files
tests/startup_tools_lint_check.py tools/startup 0 9 files parse, control rejected
tests/startup_run_ps1_check.py 0 0 failed (Windows PowerShell 5.1)
tests/startup_run_sh_check.py 77 skip: POSIX launcher, as intended on Windows
tests/startup_translator_check.py 0 0 failed

Not verified locally, CI must: the new startup_map_drive_consumer C++ target, startup_map_drive and startup_map_drive_overlap (Windows-only; they launch the consumer through debug_launch.py). I did not configure a build tree in this worktree. Selection is ctest --preset dev --no-tests=error -R '^startup_map_drive' -V.

The mergeable flag was stale UNKNOWN right after the push; it should settle to MERGEABLE on GitHub's next check. If CI goes red on the consumer, I will fix it here rather than drop the target.

One pre-existing thing I left alone because it is in the PR head and not a conflict: tools/startup/debug_launch.py has the offline-deny block twice (:606 and :623), and the second repeat is unreachable because it tests the same target condition. Say the word if you want it removed in this PR rather than a follow-up.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7170481257 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#issuecomment-7170481257). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-25T18:07:50Z. --- Rebased onto current `main` and force-pushed: head is now `83a7023d` on `startup/map-drive` (was `ad94c950`, based on `cf97bee1`). ``` 83a7023d startup: keep the mapped name per call and report a dropped-hook limit 86fcb9d4 startup: borrow the mapped name only for the hooked call 73d617f5 startup: fix the drive rewrite for root-relative opens 7a7473a1 startup: map a console package drive letter to a real folder ``` All four commits replayed; none became empty and the messages are unchanged. `git diff --stat origin/main..HEAD` is the PR's six files and nothing else: `CMakeLists.txt` +19, `docs/startup-runtime.md` +30, `tests/startup_map_drive_check.py` +112, `tests/startup_map_drive_consumer.cpp` +202, `tools/startup/debug_launch.py` +128, `tools/startup/run.ps1` +5. **Conflict resolutions** (all three files, keeping `main`'s newer text and re-applying only the PR's own lines): - `CMakeLists.txt` — `main` has moved and grown the launcher/debugger block. The `startup_map_drive_consumer` executable and its `cxx_std_17` are now defined with the other debugger inputs after `startup_debug_probe`/`startup_debug_calls` (`:1114-1117`), and `startup_map_drive` (`:3460`) plus `startup_map_drive_overlap` (`:3468`, `WILL_FAIL`) are registered right after `startup_debug` inside the `if(EXISTS "${INTAKE_PYTHON}")` guard. `main`'s storage/inflate/refusal tests are verbatim. - `docs/startup-runtime.md` — the `### Package on another volume` section sits after the "It writes:" log-file table (`:692`) and before `### Translating shaders during a run`; `main`'s expanded `run.ps1` paragraph and new log-table prose are kept. - `tools/startup/run.ps1` — `-MapDrive` is added before `$StoragePath` (`:23`) with `main`'s trailing-backslash note intact, `$mapArgs` at `:76-77`, fed as `@mapArgs @traceArgs` into `main`'s `$python`/`try-finally` invocation (`:80`). **Verification on `83a7023d`** (from `F:\x2w-wt-1251`, `out/pe-env` Python 3.12.10): | command | exit | result | |---|---|---| | `git diff --check` (and `origin/main..HEAD`) | 0 | clean | | `tools/startup/debug_launch.py` argv harness with `-MapDrive` | 0 | forwarded as `--map-drive G=D:\package`, no problems | | `tests/docs_links_check.py` | 0 | 19 Markdown files, 466 links | | `tests/bidi_controls_check.py` | 0 | 1728 tracked files | | `tests/startup_tools_lint_check.py tools/startup` | 0 | 9 files parse, control rejected | | `tests/startup_run_ps1_check.py` | 0 | 0 failed (Windows PowerShell 5.1) | | `tests/startup_run_sh_check.py` | 77 | skip: POSIX launcher, as intended on Windows | | `tests/startup_translator_check.py` | 0 | 0 failed | **Not verified locally, CI must:** the new `startup_map_drive_consumer` C++ target, `startup_map_drive` and `startup_map_drive_overlap` (Windows-only; they launch the consumer through `debug_launch.py`). I did not configure a build tree in this worktree. Selection is `ctest --preset dev --no-tests=error -R '^startup_map_drive' -V`. The `mergeable` flag was stale `UNKNOWN` right after the push; it should settle to `MERGEABLE` on GitHub's next check. If CI goes red on the consumer, I will fix it here rather than drop the target. One pre-existing thing I left alone because it is in the PR head and not a conflict: `tools/startup/debug_launch.py` has the offline-deny block twice (`:606` and `:623`), and the second repeat is unreachable because it tests the same `target` condition. Say the word if you want it removed in this PR rather than a follow-up.
triggered02 commented 2026-11-26 04:04:38 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-26T03:30:46Z.


Rebased onto current main (e46d336c); head is now 14a7a184 (was 83a7023d). Replay clean, no conflict markers.

Verified on 14a7a184: startup_translator_check 0 failed; startup_run_ps1_check exit 0; docs_links_check 523 links; idi_controls_check 1974 files; startup_tools_lint_check 11 files; git diff --check clean. New files ests/startup_map_drive_check.py / startup_map_drive_consumer.cpp, both CTests (incl. the WILL_FAIL overlap test), the ### Package on another volume docs section, and -MapDrive/$mapArgs/--map-drive all survived; main's added lines in the overlapping files are intact.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7181783610 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#issuecomment-7181783610). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-26T03:30:46Z. --- Rebased onto current main (e46d336c); head is now 14a7a184 (was 83a7023d). Replay clean, no conflict markers. Verified on 14a7a184: startup_translator_check 0 failed; startup_run_ps1_check exit 0; docs_links_check 523 links; idi_controls_check 1974 files; startup_tools_lint_check 11 files; git diff --check clean. New files ests/startup_map_drive_check.py / startup_map_drive_consumer.cpp, both CTests (incl. the WILL_FAIL overlap test), the ### Package on another volume docs section, and -MapDrive/$mapArgs/--map-drive all survived; main's added lines in the overlapping files are intact.
tedin7 commented 2026-11-26 10:54:32 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T10:54:32Z.

Review: COMMENTED


Independent review of head f9535017c (comment only, not an approval). Supersedes my review of 0ffbbde8d; only the overlap test changed since.

Code (tools/startup/debug_launch.py, map_drive()), unchanged and sound: a name that does not fit the caller's buffer is written into a buffer popped from name_pool["free"] for that call only and pushed back by that call's restore() at its return, so a second thread's rewrite cannot overwrite or free the first call's name. restore = None is set before the dispatch; a re-trap keeps the first restore (#1408 at 08f0f4e9f); the offline deny runs before map_drive().

Tests: startup_map_drive_overlap has no WILL_FAIL. The two threads now open different files of different lengths (map_drive_probe.txt, map_drive_probe_second_longer_name.txt), each checks with GetFinalPathNameByHandleW that it opened its own, both caller strings are verified after every return, and the launcher script requires 32 mapped successful opens per file, 64 rewrites and unprotected=0, three times. The serial 32-open reuse, disabled and unmapped controls are kept.

The P2 of my previous review is closed. Control I ran: replacing the pool with one process-wide scratch buffer (grown, never freed, shared by calls in flight; a change to a local copy of debug_launch.py, same CTests) makes startup_map_drive_overlap fail (33, 32 and 35 of 64 opens succeeded in the three runs; startup_map_drive still passes). A pool that only partitions by size does not fail it, which is expected since those calls never share a buffer.

Verification (Win2025, proxmox only), head f9535017c, x2w_pipe.py win2025 1251 --host proxmox --force --keep-release --regex '^(startup_map_drive|startup_hook|startup_launch|startup_debug)': dev 9/9 and release 9/9 passed. Linux: tests/startup_hook_check.py, py_compile, git diff --check origin/main...HEAD clean.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6072862198 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#pullrequestreview-6072862198). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T10:54:32Z. **Review:** COMMENTED --- Independent review of head f9535017c (comment only, not an approval). Supersedes my review of 0ffbbde8d; only the overlap test changed since. Code (`tools/startup/debug_launch.py`, `map_drive()`), unchanged and sound: a name that does not fit the caller's buffer is written into a buffer popped from `name_pool["free"]` for that call only and pushed back by that call's `restore()` at its return, so a second thread's rewrite cannot overwrite or free the first call's name. `restore = None` is set before the dispatch; a re-trap keeps the first restore (#1408 at 08f0f4e9f); the offline deny runs before `map_drive()`. Tests: `startup_map_drive_overlap` has no `WILL_FAIL`. The two threads now open different files of different lengths (`map_drive_probe.txt`, `map_drive_probe_second_longer_name.txt`), each checks with `GetFinalPathNameByHandleW` that it opened its own, both caller strings are verified after every return, and the launcher script requires 32 mapped successful opens per file, 64 rewrites and `unprotected=0`, three times. The serial 32-open reuse, disabled and unmapped controls are kept. The P2 of my previous review is closed. Control I ran: replacing the pool with one process-wide scratch buffer (grown, never freed, shared by calls in flight; a change to a local copy of `debug_launch.py`, same CTests) makes `startup_map_drive_overlap` fail (33, 32 and 35 of 64 opens succeeded in the three runs; `startup_map_drive` still passes). A pool that only partitions by size does not fail it, which is expected since those calls never share a buffer. Verification (Win2025, proxmox only), head f9535017c, `x2w_pipe.py win2025 1251 --host proxmox --force --keep-release --regex '^(startup_map_drive|startup_hook|startup_launch|startup_debug)'`: dev 9/9 and release 9/9 passed. Linux: `tests/startup_hook_check.py`, `py_compile`, `git diff --check origin/main...HEAD` clean. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-26 11:03:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T10:50:16Z.


@triggered02 @R0Y00 I pushed a fast-forward to startup/map-drive (14a7a184 -> 0ffbbde8, no force push, maintainer edit). What it does and why:

What changed

  • Merged current main (clean) and the step window from #1408 (the debugger holds every other thread while it steps one over a hooked byte), so a thread that enters the same hooked function is no longer dropped.
  • ReturnBook (from #1408) now carries an optional restore callback per call and runs it once when that call returns. The mapped-name restore uses it, so the caller's UNICODE_STRING is back before anything else runs and the borrowed name buffer is tied to the call that is in flight (each overlapping call gets its own buffer from the pool, as in your pool change).
  • startup_map_drive_overlap is no longer WILL_FAIL. It passes only when all 64 opens (two threads, 32 each, caller-owned names) are traced as mapped and succeed, all 64 MAP lines are present, the consumer reports both caller strings intact, and the debugger reports unprotected=0; three times. Its control runs the same case with --suspend-others 0 (other threads not held, the broken behaviour): it must lose at least one open in 8 runs and report unprotected above 0, otherwise the control fails because the overlap was not exercised.
  • The serial 32-open reuse check and the disabled/unmapped controls are unchanged.
  • The two CTests now own separate package and log folders. While preparing this I saw startup_map_drive_overlap fail with 0 of 64 and 0xc000003a even though the rewritten path was correct: the two tests shared one map_drive_pkg folder and each removed it at its end, so under ctest --parallel one deleted the folder under the other. With --parallel 1 it passed, with separate folders it passes in parallel.
  • docs/startup-runtime.md: the "two limits" paragraph now describes the remaining limit only (memory-mapped reads) and the overlap test.

Verification (Windows Server 2025 build 26100, MSVC 14.44, head 0ffbbde8, default parallel):

python x2w_pipe.py win2025 1251 --regex '^(startup_map_drive|startup_hook_window|startup_hook_overlap|startup_launch|startup_debug)' --keep-release

Debug 9/9 and release 9/9 passed: startup_map_drive, startup_map_drive_overlap, startup_hook_window, startup_hook_overlap, startup_launch, startup_launch_cli_check, startup_debug, startup_debug_log, startup_debug_hooks. Linux: python3 -B tests/startup_hook_check.py PASS, tests/docs_links_check.py clean.

Note: the branch now contains the #1408 commits. Once #1408 merges, this PR's diff shrinks to the map-drive files.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7189903471 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#issuecomment-7189903471). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T10:50:16Z. --- @triggered02 @R0Y00 I pushed a fast-forward to `startup/map-drive` (14a7a184 -> 0ffbbde8, no force push, maintainer edit). What it does and why: **What changed** - Merged current `main` (clean) and the step window from #1408 (the debugger holds every other thread while it steps one over a hooked byte), so a thread that enters the same hooked function is no longer dropped. - `ReturnBook` (from #1408) now carries an optional restore callback per call and runs it once when that call returns. The mapped-name restore uses it, so the caller's `UNICODE_STRING` is back before anything else runs and the borrowed name buffer is tied to the call that is in flight (each overlapping call gets its own buffer from the pool, as in your pool change). - `startup_map_drive_overlap` is no longer `WILL_FAIL`. It passes only when all 64 opens (two threads, 32 each, caller-owned names) are traced as mapped and succeed, all 64 `MAP` lines are present, the consumer reports both caller strings intact, and the debugger reports `unprotected=0`; three times. Its control runs the same case with `--suspend-others 0` (other threads not held, the broken behaviour): it must lose at least one open in 8 runs and report `unprotected` above 0, otherwise the control fails because the overlap was not exercised. - The serial 32-open reuse check and the disabled/unmapped controls are unchanged. - The two CTests now own separate package and log folders. While preparing this I saw `startup_map_drive_overlap` fail with 0 of 64 and `0xc000003a` even though the rewritten path was correct: the two tests shared one `map_drive_pkg` folder and each removed it at its end, so under `ctest --parallel` one deleted the folder under the other. With `--parallel 1` it passed, with separate folders it passes in parallel. - `docs/startup-runtime.md`: the "two limits" paragraph now describes the remaining limit only (memory-mapped reads) and the overlap test. **Verification** (Windows Server 2025 build 26100, MSVC 14.44, head 0ffbbde8, default parallel): ``` python x2w_pipe.py win2025 1251 --regex '^(startup_map_drive|startup_hook_window|startup_hook_overlap|startup_launch|startup_debug)' --keep-release ``` Debug 9/9 and release 9/9 passed: startup_map_drive, startup_map_drive_overlap, startup_hook_window, startup_hook_overlap, startup_launch, startup_launch_cli_check, startup_debug, startup_debug_log, startup_debug_hooks. Linux: `python3 -B tests/startup_hook_check.py` PASS, `tests/docs_links_check.py` clean. Note: the branch now contains the #1408 commits. Once #1408 merges, this PR's diff shrinks to the map-drive files. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-26 11:03:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T10:56:27Z.


Follow-up push on startup/map-drive: f9535017 (fast-forward, no force). The overlap case could not tell per-call name buffers from one shared scratch buffer, because both threads opened the same file. Now the two threads open different mapped files of different lengths (map_drive_probe.txt and map_drive_probe_second_longer_name.txt). The consumer checks which file each open really reached (GetFinalPathNameByHandleW), and the check requires 32 mapped opens per file plus the 64 MAP lines, the intact caller strings and unprotected=0.

Win2025 (build 26100) on f9535017: startup_map_drive, startup_map_drive_overlap, startup_hook_overlap pass in debug and release (3/3 each).

Control for the buffer: with the pool replaced by one process-wide scratch buffer that is never taken out while a call is in flight (the shared-scratch behaviour from the review), startup_map_drive_overlap fails in all three held attempts (33 and 34 of 64 opens succeed, the other thread's opens do not see their own mapped name) while the serial startup_map_drive still passes. The mutant was applied as a patch on the Windows node only and is not part of the branch.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7190041861 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#issuecomment-7190041861). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T10:56:27Z. --- Follow-up push on startup/map-drive: f9535017 (fast-forward, no force). The overlap case could not tell per-call name buffers from one shared scratch buffer, because both threads opened the same file. Now the two threads open different mapped files of different lengths (map_drive_probe.txt and map_drive_probe_second_longer_name.txt). The consumer checks which file each open really reached (GetFinalPathNameByHandleW), and the check requires 32 mapped opens per file plus the 64 MAP lines, the intact caller strings and unprotected=0. Win2025 (build 26100) on f9535017: startup_map_drive, startup_map_drive_overlap, startup_hook_overlap pass in debug and release (3/3 each). Control for the buffer: with the pool replaced by one process-wide scratch buffer that is never taken out while a call is in flight (the shared-scratch behaviour from the review), startup_map_drive_overlap fails in all three held attempts (33 and 34 of 64 opens succeed, the other thread's opens do not see their own mapped name) while the serial startup_map_drive still passes. The mutant was applied as a patch on the Windows node only and is not part of the branch. AI-assisted; commands listed were executed locally.
phantrieu2006-blip commented 2026-11-26 18:13:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by phantrieu2006-blip on 2026-11-26T18:13:09Z.


Independent retest of -MapDrive on RTX 3060 Laptop (6 GB), original executable.

This replaces the subst G: workaround from https://github.com/R0Y00/Xbox2Windows/issues/870#issuecomment-7200064776 on the same machine and package.

  • Launcher: this PR's head f9535017 (tools/startup/run.ps1, debug_launch.py), run from a separate worktree.
  • Stand-ins: a release build of main @ 6ee878d8, passed with -BuildDir. The PR conflicts with current main, so the launcher and the stand-ins come from different revisions.
  • Windows 11 build 26200.9974, NVIDIA GeForce RTX 3060 Laptop GPU, driver 32.0.16.2101. No drive G: existed during the run.
.\tools\startup\run.ps1 -Exe <run folder>\<title>.exe -DataDir <package root> -MapDrive "G=<package root>" `
    -StoragePath <existing writable folder> -BuildDir <main release build> -ShaderCache <warm cache> `
    -LogDir <log> -Seconds 180 -MemoryGiB 20 -Render -FakeUser -GpuMirror -ContinueAsserts 1000 -InputScript 4@70
main launcher, -DataDir <package root> main launcher, subst G: this PR, -MapDrive
End memset fault at 0.49 s timeout, 180 s timeout, 180 s
Distinct archive opens none 60 60, the same set, reported as G:\…
Network opens refused 0 2 2

The -MapDrive run also reported hook windows: entries=13365 windows=26725 unprotected=0 deferred=401 timeouts=0 protection=on. It continued two asserts.

The -MapDrive run did not pass -Translate, so three pipelines stayed missing. Its frame rate (25.9 fps) and draw counts are not comparable with the subst runs. The comparison only shows that -MapDrive gets past the same early fault without a drive letter and reaches the same archive set.


Prepared with AI assistance (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7200193967 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#issuecomment-7200193967). Originally posted by [phantrieu2006-blip](https://github.com/phantrieu2006-blip) on 2026-11-26T18:13:09Z. --- **Independent retest of `-MapDrive` on RTX 3060 Laptop (6 GB), original executable.** This replaces the `subst G:` workaround from https://github.com/R0Y00/Xbox2Windows/issues/870#issuecomment-7200064776 on the same machine and package. - Launcher: this PR's head `f9535017` (`tools/startup/run.ps1`, `debug_launch.py`), run from a separate worktree. - Stand-ins: a `release` build of `main` @ `6ee878d8`, passed with `-BuildDir`. The PR conflicts with current `main`, so the launcher and the stand-ins come from different revisions. - Windows 11 build 26200.9974, NVIDIA GeForce RTX 3060 Laptop GPU, driver 32.0.16.2101. No drive `G:` existed during the run. ```powershell .\tools\startup\run.ps1 -Exe <run folder>\<title>.exe -DataDir <package root> -MapDrive "G=<package root>" ` -StoragePath <existing writable folder> -BuildDir <main release build> -ShaderCache <warm cache> ` -LogDir <log> -Seconds 180 -MemoryGiB 20 -Render -FakeUser -GpuMirror -ContinueAsserts 1000 -InputScript 4@70 ``` | | `main` launcher, `-DataDir <package root>` | `main` launcher, `subst G:` | this PR, `-MapDrive` | |---|---|---|---| | End | `memset` fault at 0.49 s | timeout, 180 s | timeout, 180 s | | Distinct archive opens | none | 60 | 60, the same set, reported as `G:\…` | | Network opens refused | 0 | 2 | 2 | The `-MapDrive` run also reported `hook windows: entries=13365 windows=26725 unprotected=0 deferred=401 timeouts=0 protection=on`. It continued two asserts. The `-MapDrive` run did not pass `-Translate`, so three pipelines stayed missing. Its frame rate (25.9 fps) and draw counts are not comparable with the `subst` runs. The comparison only shows that `-MapDrive` gets past the same early fault without a drive letter and reaches the same archive set. --- Prepared with AI assistance (Claude Code).
pigalot commented 2026-11-28 01:01:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T01:01:19Z.


I merged main b1e92256 into this branch as 756ff53b (a merge commit on top of 9a257877; no rebase and no force-push). It also merges cleanly with the current main 86beae95.

Conflicts and how I resolved them.

  • CMakeLists.txt: both sides are additions. I kept this branch's map-drive consumer and tests, and main's window probe and capture tests.
  • tools/startup/debug_launch.py:
    • I kept main's usage text and window_capture import.
    • I kept this branch's restore callback on returns.add.
    • window.open stays where main puts it, after the retire check.
  • tools/startup/run.ps1: both argument lists are passed, @mapArgs @traceArgs @captureArgs, so -MapDrive and -CaptureEvery work together.

What I ran. I built the whole tree in dev and release (cmake --build --preset <preset>), then ran:

ctest --test-dir out/build/<preset> --no-tests=error -j 4 --output-on-failure -R '^(startup_debug.*|startup_map_drive.*|startup_hook.*|startup_run_ps1.*|startup_run_sh.*|startup_host_cpu_debug.*|startup_window_capture.*|startup_launch.*|startup_runtime_target.*)$'

15 of 16 pass in Debug and in Release /O2. startup_run_sh reports a capability skip (77), as it does on every Windows host; the Ubuntu job runs it. git diff --check origin/main...HEAD is clean.

This needs a review from someone other than me before it can be merged.

Environment: Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7231360987 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#issuecomment-7231360987). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-28T01:01:19Z. --- I merged `main` `b1e92256` into this branch as `756ff53b` (a merge commit on top of `9a257877`; no rebase and no force-push). It also merges cleanly with the current `main` `86beae95`. **Conflicts and how I resolved them.** - `CMakeLists.txt`: both sides are additions. I kept this branch's map-drive consumer and tests, and `main`'s window probe and capture tests. - `tools/startup/debug_launch.py`: - I kept `main`'s usage text and `window_capture` import. - I kept this branch's `restore` callback on `returns.add`. - `window.open` stays where `main` puts it, after the retire check. - `tools/startup/run.ps1`: both argument lists are passed, `@mapArgs @traceArgs @captureArgs`, so `-MapDrive` and `-CaptureEvery` work together. **What I ran.** I built the whole tree in `dev` and `release` (`cmake --build --preset <preset>`), then ran: ```powershell ctest --test-dir out/build/<preset> --no-tests=error -j 4 --output-on-failure -R '^(startup_debug.*|startup_map_drive.*|startup_hook.*|startup_run_ps1.*|startup_run_sh.*|startup_host_cpu_debug.*|startup_window_capture.*|startup_launch.*|startup_runtime_target.*)$' ``` 15 of 16 pass in Debug and in Release `/O2`. `startup_run_sh` reports a capability skip (77), as it does on every Windows host; the Ubuntu job runs it. `git diff --check origin/main...HEAD` is clean. This needs a review from someone other than me before it can be merged. Environment: Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10. This reply was AI-assisted.
pigalot commented 2026-11-28 02:50:26 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T02:50:26Z.

Review: COMMENTED


Retested 756ff53b, the merge of main into 9a257877.

The merge commit's resolutions look right to me. git show --remerge-diff 756ff53b shows only the conflicted files differ from a plain merge:

  • CMakeLists.txt keeps both sides' test registrations.
  • tools/startup/debug_launch.py keeps main's usage text and window_capture import. It also keeps this branch's returns.add(..., restore), and window.open stays where main has it.
  • tools/startup/run.ps1 passes @mapArgs @traceArgs @captureArgs.

What I ran. I did a full build of 756ff53b in dev and release, then ran

ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(startup_debug.*|startup_map_drive.*|startup_hook.*|startup_run_ps1.*|startup_run_sh.*|startup_host_cpu_debug.*|startup_window_capture.*|startup_launch.*|startup_runtime_target.*)$'

In each preset, 15 tests pass and startup_run_sh skips (exit 77, no POSIX shell). The 15 are startup_run_ps1, startup_debug, startup_debug_hooks, startup_debug_log, startup_host_cpu_debug, startup_launch, startup_debug_launch_args, startup_hook_overlap, startup_launch_cli_check, startup_window_capture_check, startup_hook_window, startup_debug_window, startup_map_drive, startup_map_drive_overlap and startup_runtime_target.

Mutants on the resolved lines:

  • Dropping restore from returns.add fails both startup_map_drive and startup_map_drive_overlap.
  • Dropping @mapArgs from the run.ps1 call fails nothing. This gap isn't new with the merge: startup_map_drive_check.py drives debug_launch.py directly, so no test reaches -MapDrive in run.ps1. It's non-blocking; a run.ps1 -MapDrive case in startup_run_ps1 would cover it.

The branch conflicts with main again. main 4d7265c0 (#2867) wraps the debug_launch.py call in run.ps1 in a & { $ErrorActionPreference = "Continue"; ... } block. I'm pushing a merge of main that keeps that wrapper and passes @mapArgs through it, and I'll comment with the details. Because I made that merge, another reviewer should check it.

R0Y00's changes-requested review on ad94c950 still stands, and only R0Y00 can clear it.

Environment: AMD Ryzen 7 9800X3D, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10. No GPU tests in this set.
CI: Build and test on Windows, Assemble and translate gfx1013 fixtures and Run platform-independent Python checks on Linux pass on 756ff53b.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6095267456 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#pullrequestreview-6095267456). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-28T02:50:26Z. **Review:** COMMENTED --- Retested `756ff53b`, the merge of `main` into `9a257877`. **The merge commit's resolutions look right to me.** `git show --remerge-diff 756ff53b` shows only the conflicted files differ from a plain merge: - `CMakeLists.txt` keeps both sides' test registrations. - `tools/startup/debug_launch.py` keeps `main`'s usage text and `window_capture` import. It also keeps this branch's `returns.add(..., restore)`, and `window.open` stays where `main` has it. - `tools/startup/run.ps1` passes `@mapArgs @traceArgs @captureArgs`. **What I ran.** I did a full build of `756ff53b` in `dev` and `release`, then ran ```powershell ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(startup_debug.*|startup_map_drive.*|startup_hook.*|startup_run_ps1.*|startup_run_sh.*|startup_host_cpu_debug.*|startup_window_capture.*|startup_launch.*|startup_runtime_target.*)$' ``` In each preset, 15 tests pass and `startup_run_sh` skips (exit 77, no POSIX shell). The 15 are `startup_run_ps1`, `startup_debug`, `startup_debug_hooks`, `startup_debug_log`, `startup_host_cpu_debug`, `startup_launch`, `startup_debug_launch_args`, `startup_hook_overlap`, `startup_launch_cli_check`, `startup_window_capture_check`, `startup_hook_window`, `startup_debug_window`, `startup_map_drive`, `startup_map_drive_overlap` and `startup_runtime_target`. **Mutants on the resolved lines:** - Dropping `restore` from `returns.add` fails both `startup_map_drive` and `startup_map_drive_overlap`. - Dropping `@mapArgs` from the `run.ps1` call fails nothing. This gap isn't new with the merge: `startup_map_drive_check.py` drives `debug_launch.py` directly, so no test reaches `-MapDrive` in `run.ps1`. It's non-blocking; a `run.ps1 -MapDrive` case in `startup_run_ps1` would cover it. **The branch conflicts with `main` again.** `main` `4d7265c0` (#2867) wraps the `debug_launch.py` call in `run.ps1` in a `& { $ErrorActionPreference = "Continue"; ... }` block. I'm pushing a merge of `main` that keeps that wrapper and passes `@mapArgs` through it, and I'll comment with the details. Because I made that merge, another reviewer should check it. R0Y00's changes-requested review on `ad94c950` still stands, and only R0Y00 can clear it. Environment: AMD Ryzen 7 9800X3D, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10. No GPU tests in this set. CI: `Build and test on Windows`, `Assemble and translate gfx1013 fixtures` and `Run platform-independent Python checks on Linux` pass on `756ff53b`. This reply was AI-assisted.
lambirou commented 2026-11-28 03:10:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-28T03:10:28Z.


Independent check of the current head and the next main merge.

I reproduced a merge of main c827d8ba into 756ff53b locally as e90a5f4c. Only tools/startup/run.ps1 conflicted. The resolution keeps main's & { $ErrorActionPreference = "Continue"; ... } wrapper and passes @mapArgs @traceArgs @captureArgs inside it:

& {
    $ErrorActionPreference = "Continue"
    & $python -B (Join-Path $PSScriptRoot "debug_launch.py") $Exe $DataDir $LogDir --timeout $Seconds --memory-gib $MemoryGiB `
        --trace-files 1 --continue-asserts $ContinueAsserts @mapArgs @traceArgs @captureArgs
    $script:debuggerExit = $LASTEXITCODE
} *> "$LogDir.out"

git diff origin/main...HEAD on that merge is exactly the six PR files. Debug and Release, with the same regex as your review, each gave 15 passed and startup_run_sh skipped (77). startup_map_drive and startup_map_drive_overlap pass in both presets.

I also confirmed the @mapArgs gap: removing it from run.ps1 leaves startup_run_ps1, startup_map_drive and startup_map_drive_overlap all passing. A -MapDrive argv assertion in startup_run_ps1 would close it; the stub already records debugger.json.

The local merge is not pushed; the one-line resolution above is the complete run.ps1 delta. R0Y00's CHANGES_REQUESTED still stands. The overlap test now requires all 64 mapped opens, both caller strings intact and unprotected=0, without WILL_FAIL, so a re-review by R0Y00 is the remaining gate.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7232852858 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#issuecomment-7232852858). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-28T03:10:28Z. --- Independent check of the current head and the next `main` merge. I reproduced a merge of `main` `c827d8ba` into `756ff53b` locally as `e90a5f4c`. Only `tools/startup/run.ps1` conflicted. The resolution keeps main's `& { $ErrorActionPreference = "Continue"; ... }` wrapper and passes `@mapArgs @traceArgs @captureArgs` inside it: ```powershell & { $ErrorActionPreference = "Continue" & $python -B (Join-Path $PSScriptRoot "debug_launch.py") $Exe $DataDir $LogDir --timeout $Seconds --memory-gib $MemoryGiB ` --trace-files 1 --continue-asserts $ContinueAsserts @mapArgs @traceArgs @captureArgs $script:debuggerExit = $LASTEXITCODE } *> "$LogDir.out" ``` `git diff origin/main...HEAD` on that merge is exactly the six PR files. Debug and Release, with the same regex as your review, each gave 15 passed and `startup_run_sh` skipped (77). `startup_map_drive` and `startup_map_drive_overlap` pass in both presets. I also confirmed the `@mapArgs` gap: removing it from `run.ps1` leaves `startup_run_ps1`, `startup_map_drive` and `startup_map_drive_overlap` all passing. A `-MapDrive` argv assertion in `startup_run_ps1` would close it; the stub already records `debugger.json`. The local merge is not pushed; the one-line resolution above is the complete `run.ps1` delta. R0Y00's `CHANGES_REQUESTED` still stands. The overlap test now requires all 64 mapped opens, both caller strings intact and `unprotected=0`, without `WILL_FAIL`, so a re-review by R0Y00 is the remaining gate.
pigalot commented 2026-11-28 03:34:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T03:34:21Z.


I pushed 76925ab0, which merges main 4d7265c0 into 756ff53b. There's no rebase and no force-push.

Conflict: tools/startup/run.ps1. main (#2867) wraps the debug_launch.py call in & { $ErrorActionPreference = "Continue"; ...; $script:debuggerExit = $LASTEXITCODE } *> "$LogDir.out", while this branch added @mapArgs to the bare call. I kept main's wrapper and passed @mapArgs @traceArgs @captureArgs inside it. The script block reads $mapArgs from the script scope, just as it already reads $traceArgs. No other file conflicted, and git diff --check origin/main...HEAD is clean.

Tests on 76925ab0:

  • In dev, the full suite except _hardware and startup_audio_* tests: 2001 of 2001 pass.

  • In release, I ran

    ctest --test-dir out/build/release --no-tests=error -j 4 -R '^(startup_debug.*|startup_map_drive.*|startup_hook.*|startup_run_ps1.*|startup_run_sh.*|startup_host_cpu_debug.*|startup_window_capture.*|startup_launch.*|startup_runtime_target.*)$'
    

    16 of 16 pass. startup_run_sh skips with exit 77 because there's no POSIX shell here, so it isn't counted as a pass.

  • None of these tests has a _hardware variant.

I made this merge, so another reviewer should check it.

Environment: AMD Ryzen 7 9800X3D, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10. No GPU tests ran.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7233183777 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#issuecomment-7233183777). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-28T03:34:21Z. --- I pushed `76925ab0`, which merges `main` `4d7265c0` into `756ff53b`. There's no rebase and no force-push. **Conflict:** `tools/startup/run.ps1`. `main` (#2867) wraps the `debug_launch.py` call in `& { $ErrorActionPreference = "Continue"; ...; $script:debuggerExit = $LASTEXITCODE } *> "$LogDir.out"`, while this branch added `@mapArgs` to the bare call. I kept `main`'s wrapper and passed `@mapArgs @traceArgs @captureArgs` inside it. The script block reads `$mapArgs` from the script scope, just as it already reads `$traceArgs`. No other file conflicted, and `git diff --check origin/main...HEAD` is clean. **Tests on `76925ab0`:** - In `dev`, the full suite except `_hardware` and `startup_audio_*` tests: 2001 of 2001 pass. - In `release`, I ran ```powershell ctest --test-dir out/build/release --no-tests=error -j 4 -R '^(startup_debug.*|startup_map_drive.*|startup_hook.*|startup_run_ps1.*|startup_run_sh.*|startup_host_cpu_debug.*|startup_window_capture.*|startup_launch.*|startup_runtime_target.*)$' ``` 16 of 16 pass. `startup_run_sh` skips with exit 77 because there's no POSIX shell here, so it isn't counted as a pass. - None of these tests has a `_hardware` variant. I made this merge, so another reviewer should check it. Environment: AMD Ryzen 7 9800X3D, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10. No GPU tests ran. This reply was AI-assisted.
R0Y00 commented 2026-11-28 03:56:15 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T03:56:15Z.

Review: APPROVED


#1281 was addressed by #1408. At 76925ab0 plus main fdba6e15, the ten Release /O2 launcher, overlap and debugger tests passed. On main e8dd89ed (integration tree f883c301), both Debug and Release re-ran four focused tests, 4/4 each, zero skips:

ctest --preset <dev-or-release> --no-tests=error -j 1 --output-on-failure -R '^(startup_map_drive(_overlap)?|startup_hook_overlap|startup_run_ps1)$'

The two-thread fixture requires all 64 opens and both caller names intact. I used the existing launcher stub separately on PowerShell 5.1 and 7 with -MapDrive, -TraceCalls and -CaptureEvery. It receives all three argument pairs in order, including spaces in the mapped path. Removing @mapArgs fails the recorded-argv check on both versions. Windows 11 26200.9974, MSVC x64 19.51. No GPU involved.

The subsequent cube-shader PR does not change the tested launcher/test files in the candidate.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6095605687 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1251#pullrequestreview-6095605687). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-28T03:56:15Z. **Review:** APPROVED --- #1281 was addressed by #1408. At `76925ab0` plus main `fdba6e15`, the ten Release /O2 launcher, overlap and debugger tests passed. On main `e8dd89ed` (integration tree `f883c301`), both Debug and Release re-ran four focused tests, 4/4 each, zero skips: ```powershell ctest --preset <dev-or-release> --no-tests=error -j 1 --output-on-failure -R '^(startup_map_drive(_overlap)?|startup_hook_overlap|startup_run_ps1)$' ``` The two-thread fixture requires all 64 opens and both caller names intact. I used the existing launcher stub separately on PowerShell 5.1 and 7 with `-MapDrive`, `-TraceCalls` and `-CaptureEvery`. It receives all three argument pairs in order, including spaces in the mapped path. Removing `@mapArgs` fails the recorded-argv check on both versions. Windows 11 26200.9974, MSVC x64 19.51. No GPU involved. The subsequent cube-shader PR does not change the tested launcher/test files in the candidate.
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!1244
No description provided.