diff options
| author | Mike7581 <168859477+Mike7581@users.noreply.github.com> | 2026-11-25 01:38:28 -0300 |
|---|---|---|
| committer | Mike7581 <168859477+Mike7581@users.noreply.github.com> | 2026-11-25 01:38:28 -0300 |
| commit | 582e14d922ad9b24a63ba55f7b8e57bd4aef3c08 (patch) | |
| tree | 160dfe95899342140734b6e5b4126132fcb66f7e /runtime/test/cpp_unwind_test.cpp | |
| parent | c7e82e26eadeac237da66949b64e7a52b718361e (diff) | |
loader: a run-time LoadLibrary takes the LEONIDA_COMPAT_DIR module too
LEONIDA_COMPAT_DIR only applied to static imports: runtime/README.md said "a run-time LoadLibrary of the
same name does not yet". A mapped image's LoadLibrary of a module the folder holds got the shim's
pseudo-handle instead of the drop-in DLL, and GetProcAddress on the compat DLL's real handle looked the
name up in the shim of the same module name first, so one console module could be served half by the
drop-in and half by the shim, which the static step exists to prevent.
Now shims::BundledModuleOps gains compat_module / owns_compat_handle, which rt::Loader answers from the
same compat_handle() its static step (resolve_compat) uses, so both get one HMODULE per module. In
shims/library_loader.cpp:
- LoadLibrary* checks the compat folder before the shim registry and the bundled package DLLs;
- GetModuleHandle* answers a compat module's handle once it is loaded and NULL before (never the shim's
pseudo-handle);
- GetProcAddress on a compat handle gives only that DLL's exports;
- FreeLibrary on it returns TRUE and keeps it loaded (it is the Loader's reference, static imports may
be bound through it; compat modules stay for the process lifetime).
A compat file Windows refuses fails that LoadLibrary with Windows' error (logged) instead of throwing
into the title.
loader_test links library_loader.cpp and gains test_compat_runtime_loads: eight cases with a synthetic
drop-in DLL and the test shim module, no game data.
Diffstat (limited to 'runtime/test/cpp_unwind_test.cpp')
0 files changed, 0 insertions, 0 deletions