fix(loader): share forwarder resolution with dynamic GetProcAddress #234

Manually merged
github merged 1 commit from github-bot/gh-234 into main 2026-11-27 02:45:02 +00:00 AGit
Owner

@⁠brainbudt on GitHub · 2026-11-27 02:18 UTC · original
brainbudt:fix/loader-getprocaddress-forwarded-exports → main · +103 −59 · 9 files · 1 commits · merged 2026-11-27 02:33 UTC

Summary

When a title DLL exported a symbol forwarded to a host or HLE DLL (for example KERNEL32.SetLastError), static import binding resolved the forwarded target through the launch resolver, while dynamic GetProcAddress only looked up the target DLL in the title-DLL registry and returned NULL.

Changes

  • Share TitleDll::resolve_export and the launch NATIVE_TITLE_RESOLVER (preserving --strict / host policy) between static import binding and dynamic GetProcAddress.
  • Preserve provenance so title-DLL targets return their mapped addresses directly while host/HLE targets receive a title-callable win64 bridge.
  • Replace the fixed recursion depth with a flat loop + seen-set cycle check so cyclic or missing forwarders return NULL with ERROR_PROC_NOT_FOUND.
  • Extend the native probe DLL and tests to verify static + dynamic forwarded host/HLE calls, title-to-title aliases, cycles, and missing targets, and update docs/native-host.md.

Verification

  • cargo test -j4 -p victory-loader (16 passed, 3 ignored)
  • cargo test -p victory-hle --target x86_64-apple-darwin --lib modules::kernel (2 passed)
  • cargo clippy -j4 -p victory-loader -p victory-hle --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings
  • cargo xtask policy
**@⁠brainbudt** on GitHub · 2026-11-27 02:18 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/234) `brainbudt:fix/loader-getprocaddress-forwarded-exports` → `main` · +103 −59 · 9 files · 1 commits · merged 2026-11-27 02:33 UTC ### Summary When a title DLL exported a symbol forwarded to a host or HLE DLL (for example `KERNEL32.SetLastError`), static import binding resolved the forwarded target through the launch resolver, while dynamic `GetProcAddress` only looked up the target DLL in the title-DLL registry and returned `NULL`. ### Changes - Share `TitleDll::resolve_export` and the launch `NATIVE_TITLE_RESOLVER` (preserving `--strict` / host policy) between static import binding and dynamic `GetProcAddress`. - Preserve provenance so title-DLL targets return their mapped addresses directly while host/HLE targets receive a title-callable win64 bridge. - Replace the fixed recursion depth with a flat loop + seen-set cycle check so cyclic or missing forwarders return `NULL` with `ERROR_PROC_NOT_FOUND`. - Extend the native probe DLL and tests to verify static + dynamic forwarded host/HLE calls, title-to-title aliases, cycles, and missing targets, and update `docs/native-host.md`. ### Verification - `cargo test -j4 -p victory-loader` (16 passed, 3 ignored) - `cargo test -p victory-hle --target x86_64-apple-darwin --lib modules::kernel` (2 passed) - `cargo clippy -j4 -p victory-loader -p victory-hle --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings` - `cargo xtask policy`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 02:29:13 +00:00
github manually merged commit 07935c9ba7 into main 2026-11-27 02:45:02 +00:00
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-27 02:33 UTC · original · approved these changes

Reviewed and tested together with the other open PRs on main (macOS x86_64 workspace tests, the setup shell tests, and Windows clippy). Thanks!

**@⁠LakshanSivakumar** on GitHub · 2026-11-27 02:33 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/234#pullrequestreview-6082739240) · **approved these changes** Reviewed and tested together with the other open PRs on main (macOS x86_64 workspace tests, the setup shell tests, and Windows clippy). Thanks!
This discussion has been locked. Commenting is limited to contributors.
No description provided.