You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BUILD-1961: mapped MSVC executables linked with setargv.obj, wsetargv.obj, or noarg.obj receive the same eagerly initialized, unexpanded arguments. The two _configure_*_argv imports currently ignore their startup mode.
The initial native/mapped reproducer uses real linker-selected startup options, without directly calling the shim. Default narrow/wide startup has the expected argument count; expanded narrow/wide and no-argument narrow/wide differ from native Windows in all four cases.
Change
Keep the original command-line inputs separate from each width's configured argument storage. Each run starts with zero arguments and null tables; GetCommandLineA/W remains available before TLS and DLL attach.
Configure narrow and wide tables independently. Unexpanded mode publishes the original arguments. Expanded mode uses native Windows filename enumeration, preserves unmatched patterns and path prefixes, and skips dot entries.
Perform narrow matching after ACP conversion, matching native startup when conversion itself introduces a wildcard.
Treat no-argument mode as a no-op, including after either width was configured. Preserve table pointers and the shared count.
Keep the legacy __getmainargs default/environment path working with the new initial state.
Correct the existing early-argv fixture to the measured native preconfiguration state while retaining command-line identity, entry arguments, and failed-attach coverage.
The new mapped regression runs six binaries built from one original fixture with MSVC's actual default, setargv.obj / wsetargv.obj, and noarg.obj startup options. Its native oracle covers quoted and unquoted patterns, unmatched patterns, an empty directory, a directory with spaces, ACP-sensitive names, and both-width reconfiguration. The reset test also checks that host CRT argument globals remain unchanged.
Validation
Native Windows 11 x64, MSVC 19.44.35228, Windows SDK 10.0.26100.0, Python 3.14.6. Detected ACP: 1252. No GPU or game files used.
Same final fixture binaries and runner: unchanged main 561b65a8 has 26/26 full-state comparison mismatches; this patch has 0/26. These comparisons include table independence, in addition to the original four startup-mode argument-count failures.
Standalone build succeeds. Four focused CTests pass: process_cmdline, run_argv_modes, run_startup_cmdline, and run_tiny_game.
These are source-integration conflicts; this branch builds and passes independently on main.
Runtime: expose the mapped title's full path through CRT program-path imports #286156c5afe4bb99a25c634406dfae18ddfe7b478b25: preserve its third image_path parameter and separate retained g_program/g_wprogram storage alongside the new g_input_args/g_input_wargs setup. Its program-path getters do not read the lazily configured argv tables. The conflict touches process.cpp and process_shim.h.
runtime: initialize guest command line in --init mode #388163c56e4ea35278bd7a70f61622b79af9b44cc4f2: preserve the native checks before its --run/--init test loop, the fixture's no-argument preconfiguration state, and its failed-attach checks. Its README statement about argv before CRT startup should describe GetCommandLineA/W availability and unconfigured argv instead.
Both exact-head three-way applications were inspected and resolved in separate scratch trees, with clean diff checks. Those two combinations were reviewed as source only; they were not built or executed. The quick-exit/TLS combination above was built and executed.
This implements UCRT startup modes against the host working directory. It does not add console-path wildcard routing or change the legacy msvcrt!__getmainargs wildcard policy. Argument globals remain owned by the guest shim.
Tested a906994 (merged on main561b65a) on Windows 11 23H2 (22631), MSVC 2022 Build Tools RelWithDebInfo, RTX 3090: pass. AI-assisted.
The new and affected ctests pass: run_argv_modes, run_startup_cmdline, process_cmdline, startup_trace. run_argv_modes covers the real setargv/wsetargv/noarg linker options through gta6rt --run.
Full ctest gives the same results as main on this host. The only failures are the three that main has here (d3d12_indirect_dispatch_count, d3d12_clear, d3d12_indirect_rt), which are unrelated to this PR.
Code read: I checked one thing that looked like a difference. The SDK's UCRT source (ucrt/startup/argv_wildcards.cpp) calls qsort on the expanded names, but its comparator compares the element addresses, not the strings, so native startup keeps FindFirstFileExW order, as this PR does. Minor and pre-existing, not for this PR: the legacy __getmainargs / __wgetmainargs still ignore their DoWildCard argument and always configure unexpanded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
BUILD-1961: mapped MSVC executables linked with
setargv.obj,wsetargv.obj, ornoarg.objreceive the same eagerly initialized, unexpanded arguments. The two_configure_*_argvimports currently ignore their startup mode.The initial native/mapped reproducer uses real linker-selected startup options, without directly calling the shim. Default narrow/wide startup has the expected argument count; expanded narrow/wide and no-argument narrow/wide differ from native Windows in all four cases.
Change
GetCommandLineA/Wremains available before TLS and DLL attach.__getmainargsdefault/environment path working with the new initial state.The new mapped regression runs six binaries built from one original fixture with MSVC's actual default,
setargv.obj/wsetargv.obj, andnoarg.objstartup options. Its native oracle covers quoted and unquoted patterns, unmatched patterns, an empty directory, a directory with spaces, ACP-sensitive names, and both-width reconfiguration. The reset test also checks that host CRT argument globals remain unchanged.Validation
Native Windows 11 x64, MSVC 19.44.35228, Windows SDK 10.0.26100.0, Python 3.14.6. Detected ACP: 1252. No GPU or game files used.
561b65a8has 26/26 full-state comparison mismatches; this patch has 0/26. These comparisons include table independence, in addition to the original four startup-mode argument-count failures.process_cmdline,run_argv_modes,run_startup_cmdline, andrun_tiny_game.10aac54a, including RT-364: run mapped title quick-exit handlers #5039 head73c7309a, on current main. That integration builds and passes the four tests above plusrun_tiny_atexitandrun_tiny_tls_exit, six tests total.git diff --checkpass.Reproduction:
The standalone change does not require the quick-exit/TLS PRs; their exact heads were checked because they touch the same runtime area.
Integration conflicts
Depends on: #2861
Depends on: #3881
These are source-integration conflicts; this branch builds and passes independently on main.
56c5afe4bb99a25c634406dfae18ddfe7b478b25: preserve its thirdimage_pathparameter and separate retainedg_program/g_wprogramstorage alongside the newg_input_args/g_input_wargssetup. Its program-path getters do not read the lazily configured argv tables. The conflict touchesprocess.cppandprocess_shim.h.63c56e4ea35278bd7a70f61622b79af9b44cc4f2: preserve the native checks before its--run/--inittest loop, the fixture's no-argument preconfiguration state, and its failed-attach checks. Its README statement about argv before CRT startup should describeGetCommandLineA/Wavailability and unconfigured argv instead.Both exact-head three-way applications were inspected and resolved in separate scratch trees, with clean diff checks. Those two combinations were reviewed as source only; they were not built or executed. The quick-exit/TLS combination above was built and executed.
Claim: #5934 (comment), carried to #6089 as BUILD-1961.
Scope
This implements UCRT startup modes against the host working directory. It does not add console-path wildcard routing or change the legacy
msvcrt!__getmainargswildcard policy. Argument globals remain owned by the guest shim.References: MSVC wildcard startup, CRT link options, and the native fixtures in this change.
AI-assisted: yes.