HLE: succeed DisableThreadLibraryCalls for pseudo-module handles #2745

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

@⁠fuzeofficlal on GitHub · 2026-11-25 19:28 UTC · original
fuzeofficlal:fix/hle-kernel-disable-thread-library-calls → main · +12 −0 · 1 files · 1 commits · open

Summary

Handle HLE pseudo-module handles in crates/victory-hle/src/modules/kernel.rs::DisableThreadLibraryCalls:

  • LoadLibraryA/W and GetModuleHandleA/W return &HleModule pointers as pseudo-module handles for console HLE DLLs (such as xgameruntime.dll, d3d12_xs.dll, dstorage_xs.dll, gameinput.dll).
  • FreeLibrary already recognizes pseudo-module handles (registry().iter().any(|m| handle(m) == module)) and returns 1, but DisableThreadLibraryCalls forwarded them directly to Windows' host DisableThreadLibraryCalls, which rejects pseudo-module handles with 0 (ERROR_INVALID_HANDLE).
  • Return 1 for registered HLE pseudo-module handles before delegating title/host modules to host::disable_thread_library_calls.

Tests

Added disable_thread_library_calls_accepts_pseudo_modules in crates/victory-hle/src/modules/kernel.rs.

Verification

  • cargo clippy --locked -p victory-hle --all-targets -- -D warnings and --all-features: 0 warnings.
  • cargo test --locked -p victory-hle --lib: 147 passed, 0 failed.
  • cargo xtask policy: 184 files ok.
**@⁠fuzeofficlal** on GitHub · 2026-11-25 19:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/2745) `fuzeofficlal:fix/hle-kernel-disable-thread-library-calls` → `main` · +12 −0 · 1 files · 1 commits · open ## Summary Handle HLE pseudo-module handles in `crates/victory-hle/src/modules/kernel.rs::DisableThreadLibraryCalls`: - `LoadLibraryA/W` and `GetModuleHandleA/W` return `&HleModule` pointers as pseudo-module handles for console HLE DLLs (such as `xgameruntime.dll`, `d3d12_xs.dll`, `dstorage_xs.dll`, `gameinput.dll`). - `FreeLibrary` already recognizes pseudo-module handles (`registry().iter().any(|m| handle(m) == module)`) and returns `1`, but `DisableThreadLibraryCalls` forwarded them directly to Windows' host `DisableThreadLibraryCalls`, which rejects pseudo-module handles with `0` (`ERROR_INVALID_HANDLE`). - Return `1` for registered HLE pseudo-module handles before delegating title/host modules to `host::disable_thread_library_calls`. ## Tests Added `disable_thread_library_calls_accepts_pseudo_modules` in `crates/victory-hle/src/modules/kernel.rs`. ## Verification - `cargo clippy --locked -p victory-hle --all-targets -- -D warnings` and `--all-features`: 0 warnings. - `cargo test --locked -p victory-hle --lib`: **147 passed, 0 failed**. - `cargo xtask policy`: 184 files ok.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:13:16 +00:00
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 20:05 UTC · original

Correct: pseudo-module handles (our registered title images) have no host HMODULE, so forwarding to host::disable_thread_library_calls failed - returning 1 for them matches the loader contract (title images hear thread notifications from us anyway). The test covers both the pseudo and null cases.

**@⁠kotekompotek** on GitHub · 2026-11-25 20:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/2745#issuecomment-7173188227) Correct: pseudo-module handles (our registered title images) have no host HMODULE, so forwarding to host::disable_thread_library_calls failed - returning 1 for them matches the loader contract (title images hear thread notifications from us anyway). The test covers both the pseudo and null cases.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 20:15 UTC · original

Independent WARP/CPU verification for head 786165f1c2 against origin/main 13f91caee2. State check at start and again before posting: open, non-draft, mergeable, head unchanged; no prior oni-swr comment.

Environment: Windows 11 x64, Rust 1.98.1 (48a229cea 2026-09-01), cargo 1.98.1, Windows SDK dxil.dll 10.0.26100.0 (file version 1.8.2502.11). VICTORY_WARP=1 and VICTORY_D3D12_WARP=1 set (WARP only, no physical GPU); no game files. CARGO_TARGET_DIR=D:\victory-warp-2741-target. Tested commit: the PR head itself, which is exactly one commit on top of origin/main (merge-base = origin/main, so no temporary merge was needed).

Commands/results:

  • Baseline (origin/main): cargo test --locked -p victory-hle — lib 146 passed, 0 failed; the other test binaries also pass (0 failed anywhere). cargo clippy --locked -p victory-hle --all-targets -- -D warnings — pass.
  • PR: cargo test --locked -p victory-hle --lib disable_thread_library_calls — 1/1 passed. cargo test --locked -p victory-hle — lib 147 passed (+1), 0 failed, 0 ignored; other binaries pass. cargo clippy --locked -p victory-hle --all-targets -- -D warnings — pass.
  • Negative control: kept the new test, disabled the production branch (if false && registry()...); disable_thread_library_calls_accepts_pseudo_modules FAILED (assertion at kernel.rs:618, the pseudo-module handle fell through to the host call). Restored, tree clean.

Review: no blocker found. Pseudo-module handles come from our own registry and are not real loader modules, so forwarding them to the host's DisableThreadLibraryCalls could only fail; returning 1 for them and still forwarding everything else (null still returns 0, covered by the test) is the right split. Nit: the added doc line sits directly above the existing one, so the doc comment now reads as two unrelated summary sentences.

Not tested: physical GPU, retail title/game behavior, release build (debug profile only).

AI disclosure: Claude Code (Claude Sonnet 5.5).

**@⁠oni-swr** on GitHub · 2026-11-25 20:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/2745#issuecomment-7173407486) Independent WARP/CPU verification for head 786165f1c29bcc08761a3238b7f468c26493cda6 against origin/main 13f91caee25f2fdf2c062be5f7a27f058e51cbca. State check at start and again before posting: open, non-draft, mergeable, head unchanged; no prior oni-swr comment. Environment: Windows 11 x64, Rust 1.98.1 (48a229cea 2026-09-01), cargo 1.98.1, Windows SDK dxil.dll 10.0.26100.0 (file version 1.8.2502.11). `VICTORY_WARP=1` and `VICTORY_D3D12_WARP=1` set (WARP only, no physical GPU); no game files. `CARGO_TARGET_DIR=D:\victory-warp-2741-target`. Tested commit: the PR head itself, which is exactly one commit on top of `origin/main` (merge-base = `origin/main`, so no temporary merge was needed). Commands/results: - Baseline (origin/main): `cargo test --locked -p victory-hle` — lib 146 passed, 0 failed; the other test binaries also pass (0 failed anywhere). `cargo clippy --locked -p victory-hle --all-targets -- -D warnings` — pass. - PR: `cargo test --locked -p victory-hle --lib disable_thread_library_calls` — 1/1 passed. `cargo test --locked -p victory-hle` — lib 147 passed (+1), 0 failed, 0 ignored; other binaries pass. `cargo clippy --locked -p victory-hle --all-targets -- -D warnings` — pass. - Negative control: kept the new test, disabled the production branch (`if false && registry()...`); `disable_thread_library_calls_accepts_pseudo_modules` FAILED (assertion at kernel.rs:618, the pseudo-module handle fell through to the host call). Restored, tree clean. Review: no blocker found. Pseudo-module handles come from our own registry and are not real loader modules, so forwarding them to the host's `DisableThreadLibraryCalls` could only fail; returning 1 for them and still forwarding everything else (null still returns 0, covered by the test) is the right split. Nit: the added doc line sits directly above the existing one, so the doc comment now reads as two unrelated summary sentences. Not tested: physical GPU, retail title/game behavior, release build (debug profile only). AI disclosure: Claude Code (Claude Sonnet 5.5).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 23:25 UTC · original

Automated triage for the maintainers. DisableThreadLibraryCalls in crates/victory-hle/src/modules/kernel.rs now returns 1 for our registered pseudo-module handles instead of passing them to the host loader, which does not know them and fails. This matches how FreeLibrary already treats them. The new test covers both a pseudo handle and null. A small nit: the new doc line sits above the existing one, so the doc comment now reads as two unrelated sentences. CI: check passing. This is a recommendation for a maintainer to look, not an approval.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 23:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/2745#issuecomment-7177531000) <!-- victory-triage v1 head=786165f1c29bcc08761a3238b7f468c26493cda6 verdict=merge-candidate at=2026-11-25T23:24:53Z --> Automated triage for the maintainers. `DisableThreadLibraryCalls` in `crates/victory-hle/src/modules/kernel.rs` now returns 1 for our registered pseudo-module handles instead of passing them to the host loader, which does not know them and fails. This matches how `FreeLibrary` already treats them. The new test covers both a pseudo handle and null. A small nit: the new doc line sits above the existing one, so the doc comment now reads as two unrelated sentences. CI: `check` passing. This is a recommendation for a maintainer to look, not an approval. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 04:12 UTC · original · approved these changes

Tested merged onto origin/main (63bcca4) on Windows 11 x64:

  • cargo test -p victory-hle --lib modules::kernel::: 6 passed, 0 failed (including new disable_thread_library_calls_accepts_pseudo_modules).
  • cargo clippy -p victory-hle --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 04:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/2745#pullrequestreview-6068449722) · **approved these changes** Tested merged onto `origin/main` (`63bcca4`) on Windows 11 x64: - `cargo test -p victory-hle --lib modules::kernel::`: **6 passed, 0 failed** (including new `disable_thread_library_calls_accepts_pseudo_modules`). - `cargo clippy -p victory-hle --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-26 13:25 UTC · original

NVIDIA full-suite run, to go with the reports above by Dukestar69, oni-swr, since none of them names a GPU run. Tested exact head 786165f (on its base 13f91ca).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 774 passed, 0 failed, 9 ignored.
  • The new tests ran and passed: disable_thread_library_calls_accepts_pseudo_modules.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-26 13:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/2745#issuecomment-7193326124) NVIDIA full-suite run, to go with the reports above by Dukestar69, oni-swr, since none of them names a GPU run. Tested exact head `786165f` (on its base `13f91ca`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **774 passed, 0 failed, 9 ignored**. - The new tests ran and passed: `disable_thread_library_calls_accepts_pseudo_modules`. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
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/2745/head:github-bot/gh-2745'
git switch 'github-bot/gh-2745'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2745'
git switch 'github-bot/gh-2745'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2745'
git switch 'github-bot/gh-2745'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2745'
git switch 'main'
git merge --squash 'github-bot/gh-2745'
git switch 'main'
git merge --ff-only 'github-bot/gh-2745'
git switch 'main'
git merge 'github-bot/gh-2745'
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!2745
No description provided.