Skip to content

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

Merged
R0Y00 merged 23 commits into
R0Y00:mainfrom
triggered02:startup/map-drive
Nov 28, 2026
Merged

R0Y00 merged 23 commits into
R0Y00:mainfrom
triggered02:startup/map-drive

Conversation

@triggered02

Copy link
Copy Markdown
Contributor

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
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.

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

triggered02 added a commit to triggered02/Xbox2Windows that referenced this pull request Nov 24, 2026
Review of R0Y00#1251 found that map_drive() looked for a "] " separator, but oa_name() formats a
root-relative name as "[root 0x...]" + text with no space. So a root-relative open was never
rewritten, and had the separator matched, the synthetic "[root 0x...]" display tag would have been
written into the caller's UNICODE_STRING and corrupted the kernel string.

The tag is now drained by finding "]" and dropped: it is only a label for the log, so it never takes
part in the rewrite.

Three smaller points from the same review:

- The "\\\\?\\" Win32 long-path prefix is matched alongside the "\\??\\" and "\\\\.\\" device
  prefixes.
- Mapping letters are ASCII A-Z. isalpha() alone also accepts non-ASCII letters, which no NT path
  has.
- A replacement longer than 0xFFFF bytes is refused, because a UNICODE_STRING length is a USHORT and
  the name could not be expressed at all.

The root-relative case is not covered by startup_map_drive yet: CreateFileW builds the object name
without a RootDirectory, so the fixture never produces the "[root ...]" form. A direct NtCreateFile
consumer would be needed to exercise it; the separator and the tag handling are the code that
changed.
@triggered02

Copy link
Copy Markdown
Contributor Author

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.

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

triggered02 added a commit to triggered02/Xbox2Windows that referenced this pull request Nov 24, 2026
Review of R0Y00#1251 found that map_drive() looked for a "] " separator, but oa_name() formats a
root-relative name as "[root 0x...]" + text with no space. So a root-relative open was never
rewritten, and had the separator matched, the synthetic "[root 0x...]" display tag would have been
written into the caller's UNICODE_STRING and corrupted the kernel string.

The tag is now drained by finding "]" and dropped: it is only a label for the log, so it never takes
part in the rewrite.

Three smaller points from the same review:

- The "\\\\?\\" Win32 long-path prefix is matched alongside the "\\??\\" and "\\\\.\\" device
  prefixes.
- Mapping letters are ASCII A-Z. isalpha() alone also accepts non-ASCII letters, which no NT path
  has.
- A replacement longer than 0xFFFF bytes is refused, because a UNICODE_STRING length is a USHORT and
  the name could not be expressed at all.

The root-relative case is not covered by startup_map_drive yet: CreateFileW builds the object name
without a RootDirectory, so the fixture never produces the "[root ...]" form. A direct NtCreateFile
consumer would be needed to exercise it; the separator and the tag handling are the code that
changed.
triggered02 added a commit to triggered02/Xbox2Windows that referenced this pull request Nov 24, 2026
Addresses the review of R0Y00#1251. The rewrite changed the caller's name permanently: in the short case
it overwrote the caller's own buffer, and in the long case it repointed the caller's UNICODE_STRING at
a fresh VirtualAllocEx that nothing released, including after a failed write. A caller that opens with
the same UNICODE_STRING twice, or that reads it after the call, saw the rewritten name.

The name is now temporary to the 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, so a failure or a retry sees the name it built. The offline deny path also runs before the
rewrite, so a refused call never borrows the name at all.

The long case writes into one backing allocation that is grown on demand and reused, so the number of
name allocations does not follow the number of opens, and a failed write after growth leaves the
caller's string untouched.

Covered by a new fixture mode: the source-built consumer builds one UNICODE_STRING whose buffer is
exactly the caller's size, calls NtCreateFile through the mapped letter 32 times, and checks its
length, buffer pointer and contents after every return, while the trace must show a single name
allocation.

Measured, 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)

Mutation control: with the restore removed the same case fails at the first open with
"caller name changed after open 0: length=136 maximum=136 buffer_moved=1", so the check does detect a
name that is not given back.
@triggered02

Copy link
Copy Markdown
Contributor Author

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.

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

triggered02 added a commit to triggered02/Xbox2Windows that referenced this pull request Nov 24, 2026
Addresses the second review of R0Y00#1251.

The backing buffer is no longer one process-wide allocation. Each hooked call borrows a buffer for the
duration of that call and returns it to a pool when the caller's name is restored, so two calls that
overlap on different threads cannot overwrite or free each other's name, while a serial run still
reuses one buffer (the 32-open case stays at one name allocation).

`restore` is now initialised before the trace-kind dispatch. It was assigned inside the file-name
branch only, and the common "if desc:" below serves every kind, so a count, runtime or bink trace could
see an unbound name or, worse, carry over the previous call's callback and restore a different call's
string.

The two-thread overlap control the review asked for is added, and it found a separate, larger problem
that is not in this change: the launcher's entry hooks are one patched byte per function, so a thread
that enters the same hooked function while another is being stepped over runs untraced. Measured with
the source-built consumer, 32 opens per thread:

  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 pattern is 64/64, so the loss is the hook dropping concurrent hits, not the
consumer or the file system. It affects file tracing and the offline socket deny as well as this
rewrite, so it is filed as R0Y00#1281 rather than worked around here. `startup_map_drive_overlap` holds the
control as an expected failure (CTest WILL_FAIL) so it is visible and documented, and will start
failing the suite once the hook stops dropping calls — which is the signal to make it a normal gate.

Measured, 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: with the buffer forced back to a single shared one the overlap case reports one
name allocation instead of two, and with the restore removed the serial case fails at the first open
with "caller name changed after open 0".
@triggered02

Copy link
Copy Markdown
Contributor Author

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.

triggered02 added a commit to triggered02/Xbox2Windows that referenced this pull request Nov 24, 2026
Review of R0Y00#1251 found that map_drive() looked for a "] " separator, but oa_name() formats a
root-relative name as "[root 0x...]" + text with no space. So a root-relative open was never
rewritten, and had the separator matched, the synthetic "[root 0x...]" display tag would have been
written into the caller's UNICODE_STRING and corrupted the kernel string.

The tag is now drained by finding "]" and dropped: it is only a label for the log, so it never takes
part in the rewrite.

Three smaller points from the same review:

- The "\\\\?\\" Win32 long-path prefix is matched alongside the "\\??\\" and "\\\\.\\" device
  prefixes.
- Mapping letters are ASCII A-Z. isalpha() alone also accepts non-ASCII letters, which no NT path
  has.
- A replacement longer than 0xFFFF bytes is refused, because a UNICODE_STRING length is a USHORT and
  the name could not be expressed at all.

The root-relative case is not covered by startup_map_drive yet: CreateFileW builds the object name
without a RootDirectory, so the fixture never produces the "[root ...]" form. A direct NtCreateFile
consumer would be needed to exercise it; the separator and the tag handling are the code that
changed.
triggered02 added a commit to triggered02/Xbox2Windows that referenced this pull request Nov 24, 2026
Addresses the review of R0Y00#1251. The rewrite changed the caller's name permanently: in the short case
it overwrote the caller's own buffer, and in the long case it repointed the caller's UNICODE_STRING at
a fresh VirtualAllocEx that nothing released, including after a failed write. A caller that opens with
the same UNICODE_STRING twice, or that reads it after the call, saw the rewritten name.

The name is now temporary to the 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, so a failure or a retry sees the name it built. The offline deny path also runs before the
rewrite, so a refused call never borrows the name at all.

The long case writes into one backing allocation that is grown on demand and reused, so the number of
name allocations does not follow the number of opens, and a failed write after growth leaves the
caller's string untouched.

Covered by a new fixture mode: the source-built consumer builds one UNICODE_STRING whose buffer is
exactly the caller's size, calls NtCreateFile through the mapped letter 32 times, and checks its
length, buffer pointer and contents after every return, while the trace must show a single name
allocation.

Measured, 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)

Mutation control: with the restore removed the same case fails at the first open with
"caller name changed after open 0: length=136 maximum=136 buffer_moved=1", so the check does detect a
name that is not given back.
triggered02 added a commit to triggered02/Xbox2Windows that referenced this pull request Nov 24, 2026
Addresses the second review of R0Y00#1251.

The backing buffer is no longer one process-wide allocation. Each hooked call borrows a buffer for the
duration of that call and returns it to a pool when the caller's name is restored, so two calls that
overlap on different threads cannot overwrite or free each other's name, while a serial run still
reuses one buffer (the 32-open case stays at one name allocation).

`restore` is now initialised before the trace-kind dispatch. It was assigned inside the file-name
branch only, and the common "if desc:" below serves every kind, so a count, runtime or bink trace could
see an unbound name or, worse, carry over the previous call's callback and restore a different call's
string.

The two-thread overlap control the review asked for is added, and it found a separate, larger problem
that is not in this change: the launcher's entry hooks are one patched byte per function, so a thread
that enters the same hooked function while another is being stepped over runs untraced. Measured with
the source-built consumer, 32 opens per thread:

  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 pattern is 64/64, so the loss is the hook dropping concurrent hits, not the
consumer or the file system. It affects file tracing and the offline socket deny as well as this
rewrite, so it is filed as R0Y00#1281 rather than worked around here. `startup_map_drive_overlap` holds the
control as an expected failure (CTest WILL_FAIL) so it is visible and documented, and will start
failing the suite once the hook stops dropping calls — which is the signal to make it a normal gate.

Measured, 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: with the buffer forced back to a single shared one the overlap case reports one
name allocation instead of two, and with the restore removed the serial case fails at the first open
with "caller name changed after open 0".
@triggered02

Copy link
Copy Markdown
Contributor Author

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.

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@lambirou

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

Independent local integration result: main 8f43802 + #1251 ad94c95 + #1408 ecbbf3e + UTF-8 storage #1551, integration branch SuperCraft3M/Xbox2Windows runtime/startup-null-diagnosis at 3098828.

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: #1408 (comment) .

AI-assisted (Codex).

@lambirou

Copy link
Copy Markdown
Contributor

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.

A console executable opens its package at a fixed drive letter, so a package on another volume never
mounts: the first open returns "not found", nothing is mounted, and the run stops within a second on
a table sized from data that was never loaded. subst does not help when the letter is already a real
volume.

tools/startup/debug_launch.py --map-drive LETTER=FOLDER[;...], exposed as run.ps1 -MapDrive, rewrites
the path of an open on a mapped letter to the real folder, in the caller's own path structure and
inside the file hooks the launcher already installs for tracing. The rewrite keeps the device prefix,
and because the replacement is usually longer than the buffer the caller allocated (a folder path
against a single letter), the new name is allocated in the process and the UNICODE_STRING is
repointed at it. Each rewrite is logged as a MAP line and appears in files.txt.

Covered by startup_map_drive (tests/startup_map_drive_check.py with a source-built consumer): the
rewrite makes an open on a letter that is not a volume succeed and read its content, the same open
fails without the option, and an open on a letter that is not mapped is left alone. Measured on
Windows 11 build 26200, where the mapped letter does not exist as a volume.

Documented in docs/startup-runtime.md under the run instructions, including the two limits (only
opens through the installed file hooks are rewritten, and the replacement allocation is left to the
process).
Review of R0Y00#1251 found that map_drive() looked for a "] " separator, but oa_name() formats a
root-relative name as "[root 0x...]" + text with no space. So a root-relative open was never
rewritten, and had the separator matched, the synthetic "[root 0x...]" display tag would have been
written into the caller's UNICODE_STRING and corrupted the kernel string.

The tag is now drained by finding "]" and dropped: it is only a label for the log, so it never takes
part in the rewrite.

Three smaller points from the same review:

- The "\\\\?\\" Win32 long-path prefix is matched alongside the "\\??\\" and "\\\\.\\" device
  prefixes.
- Mapping letters are ASCII A-Z. isalpha() alone also accepts non-ASCII letters, which no NT path
  has.
- A replacement longer than 0xFFFF bytes is refused, because a UNICODE_STRING length is a USHORT and
  the name could not be expressed at all.

The root-relative case is not covered by startup_map_drive yet: CreateFileW builds the object name
without a RootDirectory, so the fixture never produces the "[root ...]" form. A direct NtCreateFile
consumer would be needed to exercise it; the separator and the tag handling are the code that
changed.
Addresses the review of R0Y00#1251. The rewrite changed the caller's name permanently: in the short case
it overwrote the caller's own buffer, and in the long case it repointed the caller's UNICODE_STRING at
a fresh VirtualAllocEx that nothing released, including after a failed write. A caller that opens with
the same UNICODE_STRING twice, or that reads it after the call, saw the rewritten name.

The name is now temporary to the 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, so a failure or a retry sees the name it built. The offline deny path also runs before the
rewrite, so a refused call never borrows the name at all.

The long case writes into one backing allocation that is grown on demand and reused, so the number of
name allocations does not follow the number of opens, and a failed write after growth leaves the
caller's string untouched.

Covered by a new fixture mode: the source-built consumer builds one UNICODE_STRING whose buffer is
exactly the caller's size, calls NtCreateFile through the mapped letter 32 times, and checks its
length, buffer pointer and contents after every return, while the trace must show a single name
allocation.

Measured, 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)

Mutation control: with the restore removed the same case fails at the first open with
"caller name changed after open 0: length=136 maximum=136 buffer_moved=1", so the check does detect a
name that is not given back.
Addresses the second review of R0Y00#1251.

The backing buffer is no longer one process-wide allocation. Each hooked call borrows a buffer for the
duration of that call and returns it to a pool when the caller's name is restored, so two calls that
overlap on different threads cannot overwrite or free each other's name, while a serial run still
reuses one buffer (the 32-open case stays at one name allocation).

`restore` is now initialised before the trace-kind dispatch. It was assigned inside the file-name
branch only, and the common "if desc:" below serves every kind, so a count, runtime or bink trace could
see an unbound name or, worse, carry over the previous call's callback and restore a different call's
string.

The two-thread overlap control the review asked for is added, and it found a separate, larger problem
that is not in this change: the launcher's entry hooks are one patched byte per function, so a thread
that enters the same hooked function while another is being stepped over runs untraced. Measured with
the source-built consumer, 32 opens per thread:

  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 pattern is 64/64, so the loss is the hook dropping concurrent hits, not the
consumer or the file system. It affects file tracing and the offline socket deny as well as this
rewrite, so it is filed as R0Y00#1281 rather than worked around here. `startup_map_drive_overlap` holds the
control as an expected failure (CTest WILL_FAIL) so it is visible and documented, and will start
failing the suite once the hook stops dropping calls — which is the signal to make it a normal gate.

Measured, 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: with the buffer forced back to a single shared one the overlap case reports one
name allocation instead of two, and with the restore removed the serial case fails at the first open
with "caller name changed after open 0".
@triggered02

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (e46d336); head is now 14a7a18 (was 83a7023). Replay clean, no conflict markers.

Verified on 14a7a18: 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.

c1 added 6 commits November 26, 2026 11:34
The hook window replaced the returns dict with ReturnBook; the hit-limit release still called returns.get(addr), which the class does not have.
The merge left a second file_log assignment that opened files.txt only when tracing, overriding the main definition that also opens it for X2W_LOG_AT. startup_debug_log then failed with a None log.
A hooked call may change its arguments for the call only (a mapped drive name). The book now keeps an optional restore per call and runs it once on the return, so the caller's state is back before anything else runs; a re-trap of the same call keeps the first restore.
@tedin7

tedin7 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

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

What changed

  • Merged current main (clean) and the step window from startup: hold other threads while a hook steps over its byte #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 startup: hold other threads while a hook steps over its byte #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 0ffbbde, 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 tedin7 left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent review of head f953501 (comment only, not an approval). Supersedes my review of 0ffbbde; 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 08f0f4e); 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 f953501, 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.

…t lengths

A name buffer shared between calls in flight now hands one thread the other's name or a cut-off one, so the case fails for it: each thread checks the file it actually opened (GetFinalPathNameByHandleW) and the check counts 32 mapped opens per file.
@tedin7

tedin7 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Follow-up push on startup/map-drive: f953501 (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 f953501: 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

Copy link
Copy Markdown

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

This replaces the subst G: workaround from #870 (comment) 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).

sm5 and others added 2 commits November 27, 2026 10:34
# Conflicts:
#	tools/startup/run.ps1
Resolved conflicts:
- CMakeLists.txt: kept both the map-drive consumer and tests and main's window probe and capture tests.
- tools/startup/debug_launch.py: kept main's usage text and window_capture import, the branch's restore callback on returns.add, and main's placement of window.open after the retire check.
- tools/startup/run.ps1: pass both --map-drive and --capture-every arguments.
@pigalot

pigalot commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

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.

@pigalot pigalot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Resolved tools/startup/run.ps1: keep main's ErrorActionPreference
wrapper around the debug_launch.py call and pass @mapArgs through it.
@lambirou

Copy link
Copy Markdown
Contributor

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.

@pigalot

pigalot commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

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.

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#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.

@R0Y00
R0Y00 merged commit 6c5f4ed into R0Y00:main Nov 28, 2026
5 checks passed
pigalot added a commit to pigalot/Xbox2Windows that referenced this pull request Nov 28, 2026
Conflict resolved in tools/startup/run.ps1: main's --map-drive
arguments (R0Y00#1251) and this branch's --assert-sites argument both
pass through the launcher call.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants