Repository navigation
pe_loader: pass NULL lpvReserved to DllMain on wide dynamic loads - #7996
Open
CourtyardGames wants to merge 1 commit into
Open
CourtyardGames wants to merge 1 commit into
CourtyardGames wants to merge 1 commit into
Conversation
al3xar
approved these changes
Nov 23, 2026
al3xar
left a comment
Contributor
There was a problem hiding this comment.
Tested 7f9564c24 on Windows 11 x64, MSVC 19.44.35230.0 (VS 2022 Build Tools), CMake + Ninja RelWithDebInfo, Windows SDK 10.0.26100.0 (CPU-only, no game files): pass.
- Merges cleanly onto
upstream/main(dde82f27e). - Built
loader_test,pe_loader_test,module_names_test,loader_tls_test, anddll_thread_calls_testwith zero warnings. ctest -R "^(loader|module_names|pe_loader|loader_tls|dll_thread_calls)$" --output-on-failure: 5/5 passed.loader_test.exeon PR head (7f9564c24):89 checks, 0 failed(ok a wide run-time load's DllMain gets a NULL lpvReserved).- Negative control (
runtime/src/pe_loader.cppreverted toupstream/main, PR test kept):loader_test.exefails as expected (89 checks, 1 failed:FAIL a wide run-time load's DllMain gets a NULL lpvReserved: lpvReserved was non-NULL). python -I scripts/check_no_game_data.py runtime/src/pe_loader.cpp runtime/test/loader_test.cpp: clean (exit 0).- Diff review: moving
RuntimeLoadScopeintoload_runtime_candidate()covers both narrow and wide run-time dynamic loads cleanly.
AI-assisted.
|
Tested
Code read: |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Claimed in the coordination issue as: #7694 (comment)
What and why
Loader::load_runtime_module_w(runtime/src/pe_loader.cpp) did not hold aRuntimeLoadScope, unlikeLoader::load_runtime_moduleandLoader::resolve_module_export. When a bundled DLL with a non-ASCII basename was dynamically loaded viaload_runtime_module_w,Loader::load()leftmapped->dynamic_load = false(sinceruntime_loads_ == 0), causingLoader::initialise()to pass a non-NULLlpvReserved(the static-load indicator) toDllMain(DLL_PROCESS_ATTACH)instead ofnullptr.This moves
const RuntimeLoadScope dynamic(runtime_loads_);intoLoader::load_runtime_candidatearoundload(candidate), so both narrow (load_runtime_module) and wide (load_runtime_module_w) dynamic loads mark the mapped module and its dependencies as dynamic loads.Also adds a regression check in
runtime/test/loader_test.cpp(test_attach_reserved) verifying thatload_runtime_module_won a non-ASCII bundled DLL (attach_reserved_漢.dll) passeslpvReserved == nullptrtoDllMain(DLL_PROCESS_ATTACH).Tested
RelWithDebInfo, Ninja); CPU-only (no GPU or game files needed).loader_testfails on unpatchedmain(FAIL a wide run-time load's DllMain gets a NULL lpvReserved: lpvReserved was non-NULL, 89 checks, 1 failed).ctest --test-dir runtime/build -R "^(loader|module_names|pe_loader|loader_tls|dll_thread_calls)$" --output-on-failure— 5/5 passed.python -I scripts/check_no_game_data.py runtime/src/pe_loader.cpp runtime/test/loader_test.cpp— passed (exit 0).AI-assisted: yes
Checklist
docs/design.md, with how it was confirmed. (N/A — runtime loader fix, not a shader-translator rule.)