Repository navigation
library_loader: shim GetModuleFileNameA/W and GetModuleHandle(NULL) (RT-LIBLOADER-MODULE-FILENAME) - #1461
library_loader: shim GetModuleFileNameA/W and GetModuleHandle(NULL) (RT-LIBLOADER-MODULE-FILENAME)#1461piyonchu wants to merge 1 commit into
Conversation
|
Tested bada1af on NVIDIA GeForce RTX 4060, driver 617.42, AMD Ryzen 5 7500F, Windows 11 Pro build 26200, native Windows: pass. Built at this head with
AI-assisted (Claude Code ran the build and tests). No game files. |
|
Hi @piyonchu, thanks for this pull request. It currently conflicts with AI-assisted (Claude Code, Claude Opus 5.5). |
…RT-LIBLOADER-MODULE-FILENAME)
|
Rebased onto
|
bada1af to
05a2c5d
Compare
Windows 11 Verification (
|
Claimed in the coordination issue as: RT-LIBLOADER-MODULE-FILENAME
Summary
game_scarlett_master.execall sites show bothapi-ms-win-core-libraryloader-l1-2-0.dll!GetModuleFileNameAandapi-ms-win-core-libraryloader-l1-2-0.dll!GetModuleFileNameWcalled withhModule = NULLandnSize = MAX_PATH(0x104), with the wide caller turning0intoHRESULT_FROM_WIN32(GetLastError()). Without shims, both returngta6rt.exerather than the mapped executable, and calls for bundled DLL handles fail withERROR_MOD_NOT_FOUND.full_path) and EXE flag (is_exe) inrt::Module/rt::Loader(runtime/src/pe_loader.h,runtime/src/pe_loader.cpp), exposed through optional callbacks onrt::shims::BundledModuleOps(runtime/shims/shims.h,runtime/shims/registry.cpp).GetModuleFileNameA,GetModuleFileNameW, andGetModuleHandleA/GetModuleHandleW(nullptr)inruntime/shims/library_loader.cppfor mapped executables, bundled DLLs, and owned shim pseudo-handles while matching Win32 buffer truncation (nSize == len,nSize == 0,ERROR_INSUFFICIENT_BUFFER/ERROR_SUCCESS) and preserving host fallback when no mapped EXE is active.library_loader(runtime/test/library_loader_test.cpp) verifying mapped EXEnullptr/handle resolution acrossSetCurrentDirectory, DLL-only host fallback, bundled dependency handle resolution, pseudo-handle resolution, and truncation/size=0 parity against native::GetModuleFileNameW.Verification
RelWithDebInfo, Windows 11, CPU-only build without Vulkan headers) and ranctest -C RelWithDebInfo -R "^(library_loader|dll_thread_calls|pe_loader|xgameruntime)$" --output-on-failure: 4/4 passed (pe_loader,dll_thread_calls,library_loader,xgameruntime).gta6rt.exe --dry-runagainst a localgame_scarlett_master.execonfirms bothapi-ms-win-core-libraryloader-l1-2-0.dll!GetModuleFileNameAandGetModuleFileNameWnow bind toshim.python -I tests/test_build_runtime_fallback.py: 10 tests OK.python -I tests/test_text_write_line_endings.py: 3 tests OK.git diff --check: clean.AI-assisted; synthetic tests +
--dry-runimport check on Windows 11 (CPU-only build; no game files included).