HLE: GetProcAddress finds our pseudo modules' functions by ordinal #4541
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!4541
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4540"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@breachato on GitHub · 2026-11-30 22:07 UTC · original
breachato:hle-getprocaddress-ordinals→main· +45 −11 · 1 files · 1 commits · open[pr-fix]
What it changes
Our modules list their ordinal exports as
#n(hle_exportnames;gameinput.dll's only export is#1,GameInputCreate, since titles import it by ordinal only), and import binding finds them by that name.GetProcAddresson a pseudo module's handle did not: every ordinal (MAKEINTRESOURCE(n), a value below 0x10000) logged a warning and returned NULL. So a title that loadsgameinput.dlland looks up ordinal 1 got nothing where an import of the same ordinal works.It now looks up
#nlike import binding does. Host modules are unchanged (host_overridealready maps their ordinals).A function that is not there now sets the last error the host sets for the same miss on a real DLL:
ERROR_INVALID_ORDINAL(182) for an ordinal,ERROR_PROC_NOT_FOUND(127) for a name. Before, the last error was left as it was, so a title checking it after a NULL saw whatever an earlier call left.How it was tested
pseudo_modules_answer_ordinals_and_report_a_missing_function:LoadLibraryW("gameinput.dll")gives the pseudo module's handle;GetProcAddress(module, 1)equals whatregistry::lookup("gameinput.dll", "#1")binds; a missing ordinal (9999) and a missing name give NULL and the same last error asGetProcAddress(kernel32, ...)for the same miss.main):GetProcAddress(gameinput, 1)returned 0 (the test fails there). After: the bound address.cargo test -p victory-hle --lib --locked modules::kernel: 19 passed.cargo test -p victory-hle --lib --locked: 468 passed; twoxmemtests failed in the full parallel run and pass alone (a_read_by_range_waits_only_for_a_remapping_that_meets_it, the known flake in #2420 and #2439, andlarge_default_allocations_honour_write_watch_switch).cargo clippy -p victory-hle --no-deps --all-targets: nothing inkernel.rs.cargo testpassed for the crates it touches: yesHow to try it
cargo test -p victory-hle --lib --locked pseudo_modules_answer_ordinals.Checked for overlap
GetProcAddressordinals.Assisted by Claude.
0dceb9e983toea5e29de80View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.