Repository navigation
BUILD-2035: load mapped images with Unicode basenames - #6287
Conversation
|
Checked head Extra probes beyond the PR's: I copied New data, a merge-order hazard: this PR changes
#3981 and #4313 conflict as well, but both already conflict with main on their own. Not a defect in this PR; this is for whoever merges. No game data. AI-assisted (Claude Code). |
shayderrr
left a comment
There was a problem hiding this comment.
Summary
pe_loader.cpp now keys by_name_ on std::filesystem::path::string_type native basenames with ASCII folding instead of narrowed std::string. New module_key, narrow_module_key and path_utf8 helpers keep a lossless narrow alias for legacy GetModuleHandleA/import-name lookups while Module::name, labels and diagnostics carry UTF-8. find_narrow_module backs find_loaded_module/load_runtime_module; failed runtime loads erase by module_key(mapped->path). Adds module_names_test.cpp, tiny_module_names.cpp, check_module_names.py with CMake targets comparing native and mapped renamed DLLs.
Why merge
Unicode-named DLLs now load and dedupe correctly without breaking the narrow-byte API contract, backed by native-vs-mapped tests including ACP imports.
Verdict: Approve
Summary
Why mergeUnicode-named DLLs now load and dedupe correctly without breaking the narrow-byte API contract, backed by native-vs-mapped tests including ACP imports. Verdict: Approve |
Problem
BUILD-2035. On Windows with MSVC and ACP 1252, an original synthetic executable with a basename containing U+6F22 runs natively but fails before entry in all three loader modes.
Loader::loadconverts its basename throughpath::string()for the cache key.map_imagerepeats the conversion for its display name. ACP-representable non-ASCII names do load, but their raw ACP bytes also make the documented UTF-8 map trace invalid.Claim: #6089 (comment)
The claim carries to #6214.
Changes
filesystem::path::string_typeusingnative(), with the existing ASCII case folding.Module::name, mapped address labels, and path diagnostics. Two names that cannot round-trip through the narrow code page retain distinct native identities.This does not change
library_loaderAPI conversions, add Unicode case folding, or implement the separately owned wide module-identity APIs.Validation
Windows 11 x64, MSVC 19.44.35228, SDK 10.0.26100.0, RelWithDebInfo, ACP 1252. CPU only; no GPU or game files.
The same final fixtures were used for both versions:
561b65a8: all seven native children pass. Four mapped launches fail before entry: the non-ACP basename in--dry-run,--init, and--run, plus a non-ACP importing EXE. Four other mapped runs execute successfully but emit invalid UTF-8 map traces for ACP names. The direct Loader test reports seven failed checks.module_names(59 checks),run_module_names(22 children),pe_loader(79 checks), andloader(86 checks). The last includes failed parent/dependency lookup and retry controls. The optional retail-package checks remain skipped becauseLEONIDA_GAME_DIRis unset.Reproduction:
Independent peer source review completed with no actionable findings.
Integration
Depends on: #2075
Depends on: #5302
Depends on: #5565
Depends on: #5805
These are actual source conflicts, not prerequisites for this standalone branch. Exact-head three-way checks were done in separate local trees. The resolved #5565 combination was also built and executed as described below; the other combinations were checked only in source.
a92e46a7069103a2e1e10ea32dd512d1b03b1e1e: retain its absolute module path and wide identity lookup while retaining the UTF-8 display name and narrow alias.ea4470921b3d4ae666e160cd98a222edd42759cc: retain its buffered reader and use the UTF-8 path helper for its open/read errors.540b8dda750d6b104e7e22097474623713d34d3d: retain its terminal-state guard and conditional lock bypass during prepared process detach; use the narrow alias helper inside that existing lookup scope.f73564a764e765b6e60702c9978ff282f860c9c1: retain its delayed transactional publication and rollback, using the native basename key at its new publication point.2e0f1a29799f3ad0343273d512a31155e4868b21applies cleanly. Its module-path accessors remain separate from the diagnostic name.The resolved combination with #5565 at the exact head above passes the same four focused Unicode/loader CTests and its unchanged 104-child
process_detachsuite. The held-loader, registry, and library-cache lock cases complete all expected lookups and native-matching detach checks. The original early-detach negative control also passes. This verifies the alias iteration within the owner's prepared-detach lookup scope; no other dependency combination was executed.AI-assisted: yes.