HLE: set ERROR_PROC_NOT_FOUND for missing pseudo-module exports #1432

Open
github-bot wants to merge 1 commit from github-bot/gh-1432 into main AGit
Owner

@⁠fuzeofficlal on GitHub · 2026-11-24 17:58 UTC · original
fuzeofficlal:fix/hle-getprocaddress-last-error-764 → main · +37 −0 · 1 files · 1 commits · open

Fixes #764.

Summary

  • Set ERROR_PROC_NOT_FOUND (127) via host::set_last_error before returning null from kernel::GetProcAddress when a pseudo-module lookup misses by ordinal or by symbol name, matching Win32 GetProcAddress so HRESULT_FROM_WIN32(GetLastError()) never misreports S_OK.

Verification

  • Added missing_pseudo_module_exports_set_proc_not_found testing missing symbol names, missing ordinals, and ordinal 0 after SetLastError(0).
  • cargo test --workspace, cargo clippy --workspace --all-targets --all-features, and cargo xtask policy: passed.
**@⁠fuzeofficlal** on GitHub · 2026-11-24 17:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/1432) `fuzeofficlal:fix/hle-getprocaddress-last-error-764` → `main` · +37 −0 · 1 files · 1 commits · open Fixes #764. ### Summary - Set `ERROR_PROC_NOT_FOUND` (`127`) via `host::set_last_error` before returning null from `kernel::GetProcAddress` when a pseudo-module lookup misses by ordinal or by symbol name, matching Win32 `GetProcAddress` so `HRESULT_FROM_WIN32(GetLastError())` never misreports `S_OK`. ### Verification - Added `missing_pseudo_module_exports_set_proc_not_found` testing missing symbol names, missing ordinals, and ordinal `0` after `SetLastError(0)`. - `cargo test --workspace`, `cargo clippy --workspace --all-targets --all-features`, and `cargo xtask policy`: passed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:31:33 +00:00
Author
Owner

@⁠acetonahard-code on GitHub · 2026-11-24 20:56 UTC · original

Tested on Windows 11 with the repo toolchain, merged into current main (ffe310e):

cargo test -p victory-hle passed failed ignored
main 95 0 0
main + this PR 96 0 0
  • The new test passes.
  • cargo clippy --all-targets -- -D warnings, with and without --all-features: clean.

I didn't test with game data.


Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.

**@⁠acetonahard-code** on GitHub · 2026-11-24 20:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/1432#issuecomment-7144267431) Tested on Windows 11 with the repo toolchain, merged into current `main` (ffe310e): | `cargo test -p victory-hle` | passed | failed | ignored | |---|---|---|---| | `main` | 95 | 0 | 0 | | `main` + this PR | 96 | 0 | 0 | - The new test passes. - `cargo clippy --all-targets -- -D warnings`, with and without `--all-features`: clean. I didn't test with game data. --- <sub>Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.</sub>
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:27 UTC · original · edited 2026-11-25 06:28 UTC

Automated triage for the maintainers.

Merge candidate. It merges cleanly. GetProcAddress (crates/victory-hle/src/modules/kernel.rs) now sets ERROR_PROC_NOT_FOUND (127) when a pseudo module has no such export, or is asked by ordinal (which includes a null name). That matches the documented Windows behaviour, and the host's own GetProcAddress, which the new test checks on kernel32.dll side by side. On main these paths return null and leave a stale last error behind. The change is small: three lines plus the constant, which did not exist yet. The test covers a found export, a missing name, an ordinal and null.

CI: passing (check).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/1432#issuecomment-7149574436) · edited 2026-11-25 06:28 UTC <!-- victory-triage v1 head=f30681c6e5ffbe6ddd505cfb0e2907b9d68e2293 verdict=merge-candidate at=2026-11-25T06:28:42Z --> Automated triage for the maintainers. **Merge candidate.** It merges cleanly. `GetProcAddress` (`crates/victory-hle/src/modules/kernel.rs`) now sets `ERROR_PROC_NOT_FOUND` (127) when a pseudo module has no such export, or is asked by ordinal (which includes a null name). That matches the documented Windows behaviour, and the host's own `GetProcAddress`, which the new test checks on `kernel32.dll` side by side. On `main` these paths return null and leave a stale last error behind. The change is small: three lines plus the constant, which did not exist yet. The test covers a found export, a missing name, an ordinal and null. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠cloph-dsp on GitHub · 2026-11-26 15:17 UTC · original

Independent verification (Windows, Rust 1.100.0/MSVC, head f30681c, synthetic fake-host SetLastError, no game data):

  • cargo test --locked -p victory-hle --lib -- modules::kernel::tests::missing_pseudo_module_exports_set_proc_not_found --exact — 1 passed, 0 failed, 143 filtered.
  • git diff --check against merge base 940d32f — clean.
  • Per-worktree CARGO_TARGET_DIR used.

AI-assisted (Hy4 flash). GPU/driver: N/A (CPU only). Did not exercise a real pseudo-module import from a title.

**@⁠cloph-dsp** on GitHub · 2026-11-26 15:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/1432#issuecomment-7196056335) Independent verification (Windows, Rust 1.100.0/MSVC, head f30681c, synthetic fake-host `SetLastError`, no game data): - `cargo test --locked -p victory-hle --lib -- modules::kernel::tests::missing_pseudo_module_exports_set_proc_not_found --exact` — 1 passed, 0 failed, 143 filtered. - `git diff --check` against merge base 940d32f — clean. - Per-worktree `CARGO_TARGET_DIR` used. AI-assisted (Hy4 flash). GPU/driver: N/A (CPU only). Did not exercise a real pseudo-module import from a title.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1432/head:github-bot/gh-1432'
git switch 'github-bot/gh-1432'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1432'
git switch 'github-bot/gh-1432'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1432'
git switch 'github-bot/gh-1432'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1432'
git switch 'main'
git merge --squash 'github-bot/gh-1432'
git switch 'main'
git merge --ff-only 'github-bot/gh-1432'
git switch 'main'
git merge 'github-bot/gh-1432'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1432
No description provided.