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

Open
fuzeofficlal wants to merge 1 commit from upstream-pr/1432 into main
fuzeofficlal commented 2026-11-24 17:58:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-24T17:58:09Z.


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.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6588132231 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1432). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-24T17:58:09Z. --- 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.
acetonahard-code commented 2026-11-24 21:03:47 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by acetonahard-code on 2026-11-24T20:56:45Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7144267431 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1432#issuecomment-7144267431). Originally posted by [acetonahard-code](https://github.com/acetonahard-code) on 2026-11-24T20:56:45Z. --- 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>
Marvisak commented 2026-11-25 02:06:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:27:51Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149574436 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1432#issuecomment-7149574436). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T01:27:51Z. --- <!-- 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)_
cloph-dsp commented 2026-11-26 16:05:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-26T15:17:26Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7196056335 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1432#issuecomment-7196056335). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-26T15:17:26Z. --- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1432:upstream-pr/1432'
git switch 'upstream-pr/1432'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1432'
git switch 'upstream-pr/1432'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1432'
git switch 'upstream-pr/1432'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1432'
git switch 'main'
git merge --squash 'upstream-pr/1432'
git switch 'main'
git merge --ff-only 'upstream-pr/1432'
git switch 'main'
git merge 'upstream-pr/1432'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!1431
No description provided.