startup: map a console package drive letter to a real folder #1244
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1251"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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[;...](orrun.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:
UNICODE_STRINGdoes not fit. When it does not, the launcher allocates the name in the target process and repoints theUNICODE_STRINGat it, leaving that allocation to the process (the caller may keep the name while its handle is open).\??\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:mapped ok, trace shows theMAPrewriteopen failed: 3)MAPline; left aloneMeasured on Windows 11 build 26200 with the
releasepreset;docs_links_check.pypasses and the option is documented indocs/startup-runtime.mdunder the run instructions, including both limits.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: PASSAGENTS.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_drivedev(Debug): configure 1.51s, build 27.77s,ctest(startup_map_drive) 1/1 Passed in 0.44srelease(/O2): configure 1.52s, build 39.47s,ctest(startup_map_drive) 1/1 Passed in 0.36sCode Audit & Edge Cases (
tools/startup/debug_launch.py)[root ...]prefix mismatch inmap_drive():oa_name()formats root-relative paths without a space:f"[root {root:#x}]" + text(e.g.[root 0x123]\??\G:\foo).map_drive()checksif body.startswith("[root ") and "] " in body:(looking for"] ", with a space), so whenOBJECT_ATTRIBUTES.RootDirectoryis non-zero,"] "is not matched,body[1] != ":"fails, and the path is never mapped."] "were present,replacement = root + prefix + ...prepends the synthetic[root 0x...]display tag intoencodedbefore writing it back into the target process'sUNICODE_STRINGbuffer, which would corrupt the kernelUNICODE_STRINGifrootwere non-empty.rootshould only be kept in the log/display string, not written intoUNICODE_STRING.drive_mapacceptsletter.isalpha()(which includes non-ASCII Unicode letters in Python 3) rather than ASCIIA–Z.\\?\(Win32 long-path prefix) is not in("\\??\\", "\\\\.\\")(Win32CreateFileWnormalizes\\?\to\??\beforeNtCreateFile, so NT hooks see\??\, though direct callers passing\\?\wouldn't match)...path traversal inbody[2:]is preserved verbatim (expected for a launcher diagnostic rewrite).struct.pack("<HH4xQ", len(encoded), len(encoded), fresh)assumeslen(encoded) <= 65535(USHORTlimit ofUNICODE_STRING).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.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T06:00:25Z.
Review: COMMENTED
Dual-platform retest of
78c8796d104a46e6c030392b1b82e428ecf6fa33(delta fromf6184535:78c8796dstartup: fix the drive rewrite for root-relative opens).Delta Since
f6184535(tools/startup/debug_launch.py)drive_mapkeys to ASCIIA–Z(letter.isascii()).[root 0x...]log tag frombodyinstead of prepending it intoreplacement.\\?\alongside\??\and\\.\prefix matching.len(encoded)against0 < len(encoded) <= 0xFFFFbefore writingUNICODE_STRING.Length.Linux Checks
git diff --check origin/main...HEAD: PASSdocs_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 4dev(Debug):ctest(startup_map_drive) 1/1 Passed (0.39s)release(/O2):ctest(startup_map_drive) 1/1 Passed (0.37s)Status Note
CHANGES_REQUESTEDitems from@R0Y00(restoring the caller'sUNICODE_STRINGafter the hooked NT call, releasing/reusingVirtualAllocExbacking, and adding a multi-open reuse test) remain open as of78c8796d.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.restoreis assigned only in the file-name branch, but the commonif 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.
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.
f618453ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
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 kernelUNICODE_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 anythingisalpha()accepts; and a replacement over 0xFFFF bytes is refused, because aUNICODE_STRINGlength is a USHORT.startup_map_drivestill passes (mapped letter reads its content, negative control fails, unmapped letter untouched). The root-relative path is not covered by that fixture, becauseCreateFileWbuilds the object name without aRootDirectory— a directNtCreateFileconsumer would be needed to exercise it. Say if you want that added before merge.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_STRINGheld, 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-ownedUNICODE_STRINGwhose buffer is exactly its own size, callsNtCreateFilethrough the mapped letter 32 times, and after every return checksLength,MaximumLength,Bufferidentity and contents. The check also requires the trace to show one name allocation for those 32 opens, so allocation growth fails it.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.pypasses anddocs/startup-runtime.mdnow describes the temporary-name and reuse behaviour instead of the old "allocation left to the process" limit.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.
restoreinitialisation. It is now set before the trace-kind dispatch. You were right that the commonif 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:
--map-driveWithout 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_overlapholds 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):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.
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.
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 asad94c950; 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:mainadded thevalloctrace branch (NtAllocateVirtualMemory/Exrequested base, size, type, protect and the caller chain);restore = Noneinitialisation so every trace kind starts with a clean restore callback, plus a return-address read that tolerates a short read.I kept both: the
vallocbranch is preserved verbatim,restore = Noneis 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_driveandstartup_map_drive_overlappass (2/2);debug_launch.pyparses, and a live 75 s launcher run with-MapDriveworked: 374 mapped-name log lines, no trace-related errors.startup_map_drive_overlapis still registeredWILL_FAILon purpose — it documents the launcher dropping concurrent hits (#1281) rather than asserting correct behaviour.The earlier
CHANGES_REQUESTEDfrom 06:32 predates the previous head, so it may not reflect this state; happy to address anything that still applies.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.txtshowsMAP \??\G:\appdata0.rpf -> \??\F:\...\appdata0.rpffor bothNtQueryAttributesFileandNtCreateFile, andcommon.rpffollows the same path. Those opens succeed.The run still stops at 0.36 s in
vcruntime140.dll+0x1989(access violation, write to null, size0x7ffffe0f0).stderr.txtshows:The DirectStorage stand-in's own
Factory::OpenFilepath is not rewritten by the file hook, so the package data is still not read from the real folder. Withsubst 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 rewritesCLZEROand 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
OpenFileneeds to resolve the mapped letter too.Measured on Windows 11 26H2 build 26300 with a Radeon RX 9060 XT (driver
32.0.32029.2010).Imported from R0Y00/Xbox2Windows. Originally posted by SuperCraft3M on 2026-11-24T14:09:32Z.
Independent local integration result: main
8f438025+ #1251ad94c950+ #1408ecbbf3e2+ 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).
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
mainwas merged, not from a DirectStorage gap.I merged current
maininto the branch locally (the conflicts were inCMakeLists.txtandrun.ps1; both were mechanical), rebuilt the stand-ins, and reran the same 30 s startup with noG:volume. It now reaches the 30 s timeout with:Factory::OpenFilereturns ok forG:\appdata0.rpf,common.rpf,movies.rpf,shaders.rpf,anim.rpf,data.rpf,levels.rpf,navmeshes.rpf,packs.rpf,textures.rpf,audio.rpfandscript.rpf, andfiles.txtshows the correspondingMAPlines. 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.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 atf6184535and78c8796d.Verdict: 0 P1 / 1 P2, plus nits.
P2:
startup_map_drive_overlapcan pass for the wrong reason (CMakeLists.txt; the open point from the 10:51 review)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 overlapexits 0 only if"overlap ok" in stdoutandallocations >= 2; the allocation count is an internal pool detail, not something the caller sees.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
[root ...]tag mismatch (the tag is dropped, not written into the name); restoring the caller'sUNICODE_STRINGwith a 32-open serial test; a per-call buffer pool instead of one shared scratch allocation;restore = Noneset before the dispatch; the ASCII A-Z letter check, the\\?\prefix and the 0xFFFF length guard.Path handling (a small harness running the real
map_drivecode on Linux)\??\G:\a\bmaps to\??\D:\pkg\a\b; lower-caseg:works;\\.\and\\?\prefixes are kept; trailing separators on the folder are trimmed for both/and\;H:,GG:and\??\UNC\srv\G:\aare left alone.G:\..\..\Windows\xbecomesD:\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.G:foobecomesD:\pkgfoo; a UNC or relative folder is not validated (the open then fails visibly); root-relative opens keepRootDirectorywhile the name becomes absolute, untested.Other checks
name_buffers <= 1check 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.parseof debug_launch.py and startup_map_drive_check.py, andx86_64-w64-mingw32-g++ -std=c++17 -fsyntax-only tests/startup_map_drive_consumer.cpp: pass.map_drive(restored withgit 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 (onlyname_buffers <= 1on Windows would see it).Not run:
startup_map_drive,startup_map_drive_overlapand 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.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:53:45Z.
@triggered02 could you rebase this branch onto current
mainand force-push?GitHub reports head
ad94c950as conflicting withmain, so it cannot be merged as is.Files that conflict with current
main(cf97bee1):CMakeLists.txtdocs/startup-runtime.mdtools/startup/run.ps1Commands run locally:
Once it is rebased and CI is green it will be re-checked right away.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-25T18:07:50Z.
Rebased onto current
mainand force-pushed: head is now83a7023donstartup/map-drive(wasad94c950, based oncf97bee1).All four commits replayed; none became empty and the messages are unchanged.
git diff --stat origin/main..HEADis 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—mainhas moved and grown the launcher/debugger block. Thestartup_map_drive_consumerexecutable and itscxx_std_17are now defined with the other debugger inputs afterstartup_debug_probe/startup_debug_calls(:1114-1117), andstartup_map_drive(:3460) plusstartup_map_drive_overlap(:3468,WILL_FAIL) are registered right afterstartup_debuginside theif(EXISTS "${INTAKE_PYTHON}")guard.main's storage/inflate/refusal tests are verbatim.docs/startup-runtime.md— the### Package on another volumesection sits after the "It writes:" log-file table (:692) and before### Translating shaders during a run;main's expandedrun.ps1paragraph and new log-table prose are kept.tools/startup/run.ps1—-MapDriveis added before$StoragePath(:23) withmain's trailing-backslash note intact,$mapArgsat:76-77, fed as@mapArgs @traceArgsintomain's$python/try-finallyinvocation (:80).Verification on
83a7023d(fromF:\x2w-wt-1251,out/pe-envPython 3.12.10):git diff --check(andorigin/main..HEAD)tools/startup/debug_launch.pyargv harness with-MapDrive--map-drive G=D:\package, no problemstests/docs_links_check.pytests/bidi_controls_check.pytests/startup_tools_lint_check.py tools/startuptests/startup_run_ps1_check.pytests/startup_run_sh_check.pytests/startup_translator_check.pyNot verified locally, CI must: the new
startup_map_drive_consumerC++ target,startup_map_driveandstartup_map_drive_overlap(Windows-only; they launch the consumer throughdebug_launch.py). I did not configure a build tree in this worktree. Selection isctest --preset dev --no-tests=error -R '^startup_map_drive' -V.The
mergeableflag was staleUNKNOWNright after the push; it should settle toMERGEABLEon 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.pyhas the offline-deny block twice (:606and:623), and the second repeat is unreachable because it tests the sametargetcondition. Say the word if you want it removed in this PR rather than a follow-up.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-26T03:30:46Z.
Rebased onto current main (
e46d336c); head is now14a7a184(was83a7023d). 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.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 of0ffbbde8d; 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 fromname_pool["free"]for that call only and pushed back by that call'srestore()at its return, so a second thread's rewrite cannot overwrite or free the first call's name.restore = Noneis set before the dispatch; a re-trap keeps the first restore (#1408 at08f0f4e9f); the offline deny runs beforemap_drive().Tests:
startup_map_drive_overlaphas noWILL_FAIL. The two threads now open different files of different lengths (map_drive_probe.txt,map_drive_probe_second_longer_name.txt), each checks withGetFinalPathNameByHandleWthat 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 andunprotected=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) makesstartup_map_drive_overlapfail (33, 32 and 35 of 64 opens succeeded in the three runs;startup_map_drivestill 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...HEADclean.AI-assisted; commands listed were executed locally.
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
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'sUNICODE_STRINGis 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_overlapis no longerWILL_FAIL. It passes only when all 64 opens (two threads, 32 each, caller-owned names) are traced as mapped and succeed, all 64MAPlines are present, the consumer reports both caller strings intact, and the debugger reportsunprotected=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 reportunprotectedabove 0, otherwise the control fails because the overlap was not exercised.startup_map_drive_overlapfail with 0 of 64 and0xc000003aeven though the rewritten path was correct: the two tests shared onemap_drive_pkgfolder and each removed it at its end, so underctest --parallelone deleted the folder under the other. With--parallel 1it 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):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.pyPASS,tests/docs_links_check.pyclean.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.
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.
Imported from R0Y00/Xbox2Windows. Originally posted by phantrieu2006-blip on 2026-11-26T18:13:09Z.
Independent retest of
-MapDriveon 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.f9535017(tools/startup/run.ps1,debug_launch.py), run from a separate worktree.releasebuild ofmain@6ee878d8, passed with-BuildDir. The PR conflicts with currentmain, so the launcher and the stand-ins come from different revisions.G:existed during the run.mainlauncher,-DataDir <package root>mainlauncher,subst G:-MapDrivememsetfault at 0.49 sG:\…The
-MapDriverun also reportedhook windows: entries=13365 windows=26725 unprotected=0 deferred=401 timeouts=0 protection=on. It continued two asserts.The
-MapDriverun did not pass-Translate, so three pipelines stayed missing. Its frame rate (25.9 fps) and draw counts are not comparable with thesubstruns. The comparison only shows that-MapDrivegets past the same early fault without a drive letter and reaches the same archive set.Prepared with AI assistance (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T01:01:19Z.
I merged
mainb1e92256into this branch as756ff53b(a merge commit on top of9a257877; no rebase and no force-push). It also merges cleanly with the currentmain86beae95.Conflicts and how I resolved them.
CMakeLists.txt: both sides are additions. I kept this branch's map-drive consumer and tests, andmain's window probe and capture tests.tools/startup/debug_launch.py:main's usage text andwindow_captureimport.restorecallback onreturns.add.window.openstays wheremainputs it, after the retire check.tools/startup/run.ps1: both argument lists are passed,@mapArgs @traceArgs @captureArgs, so-MapDriveand-CaptureEverywork together.What I ran. I built the whole tree in
devandrelease(cmake --build --preset <preset>), then ran:15 of 16 pass in Debug and in Release
/O2.startup_run_shreports a capability skip (77), as it does on every Windows host; the Ubuntu job runs it.git diff --check origin/main...HEADis 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.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T02:50:26Z.
Review: COMMENTED
Retested
756ff53b, the merge ofmaininto9a257877.The merge commit's resolutions look right to me.
git show --remerge-diff 756ff53bshows only the conflicted files differ from a plain merge:CMakeLists.txtkeeps both sides' test registrations.tools/startup/debug_launch.pykeepsmain's usage text andwindow_captureimport. It also keeps this branch'sreturns.add(..., restore), andwindow.openstays wheremainhas it.tools/startup/run.ps1passes@mapArgs @traceArgs @captureArgs.What I ran. I did a full build of
756ff53bindevandrelease, then ranIn each preset, 15 tests pass and
startup_run_shskips (exit 77, no POSIX shell). The 15 arestartup_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_overlapandstartup_runtime_target.Mutants on the resolved lines:
restorefromreturns.addfails bothstartup_map_driveandstartup_map_drive_overlap.@mapArgsfrom therun.ps1call fails nothing. This gap isn't new with the merge:startup_map_drive_check.pydrivesdebug_launch.pydirectly, so no test reaches-MapDriveinrun.ps1. It's non-blocking; arun.ps1 -MapDrivecase instartup_run_ps1would cover it.The branch conflicts with
mainagain.main4d7265c0(#2867) wraps thedebug_launch.pycall inrun.ps1in a& { $ErrorActionPreference = "Continue"; ... }block. I'm pushing a merge ofmainthat keeps that wrapper and passes@mapArgsthrough it, and I'll comment with the details. Because I made that merge, another reviewer should check it.R0Y00's changes-requested review on
ad94c950still 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 fixturesandRun platform-independent Python checks on Linuxpass on756ff53b.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-28T03:10:28Z.
Independent check of the current head and the next
mainmerge.I reproduced a merge of
mainc827d8bainto756ff53blocally ase90a5f4c. Onlytools/startup/run.ps1conflicted. The resolution keeps main's& { $ErrorActionPreference = "Continue"; ... }wrapper and passes@mapArgs @traceArgs @captureArgsinside it:git diff origin/main...HEADon that merge is exactly the six PR files. Debug and Release, with the same regex as your review, each gave 15 passed andstartup_run_shskipped (77).startup_map_driveandstartup_map_drive_overlappass in both presets.I also confirmed the
@mapArgsgap: removing it fromrun.ps1leavesstartup_run_ps1,startup_map_driveandstartup_map_drive_overlapall passing. A-MapDriveargv assertion instartup_run_ps1would close it; the stub already recordsdebugger.json.The local merge is not pushed; the one-line resolution above is the complete
run.ps1delta. R0Y00'sCHANGES_REQUESTEDstill stands. The overlap test now requires all 64 mapped opens, both caller strings intact andunprotected=0, withoutWILL_FAIL, so a re-review by R0Y00 is the remaining gate.Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T03:34:21Z.
I pushed
76925ab0, which mergesmain4d7265c0into756ff53b. There's no rebase and no force-push.Conflict:
tools/startup/run.ps1.main(#2867) wraps thedebug_launch.pycall in& { $ErrorActionPreference = "Continue"; ...; $script:debuggerExit = $LASTEXITCODE } *> "$LogDir.out", while this branch added@mapArgsto the bare call. I keptmain's wrapper and passed@mapArgs @traceArgs @captureArgsinside it. The script block reads$mapArgsfrom the script scope, just as it already reads$traceArgs. No other file conflicted, andgit diff --check origin/main...HEADis clean.Tests on
76925ab0:In
dev, the full suite except_hardwareandstartup_audio_*tests: 2001 of 2001 pass.In
release, I ran16 of 16 pass.
startup_run_shskips with exit 77 because there's no POSIX shell here, so it isn't counted as a pass.None of these tests has a
_hardwarevariant.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.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T03:56:15Z.
Review: APPROVED
#1281 was addressed by #1408. At
76925ab0plus mainfdba6e15, the ten Release /O2 launcher, overlap and debugger tests passed. On maine8dd89ed(integration treef883c301), both Debug and Release re-ran four focused tests, 4/4 each, zero skips: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,-TraceCallsand-CaptureEvery. It receives all three argument pairs in order, including spaces in the mapped path. Removing@mapArgsfails 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.