HLE: succeed DisableThreadLibraryCalls for pseudo-module handles #2745
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2745
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2745"
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?
@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 · openSummary
Handle HLE pseudo-module handles in
crates/victory-hle/src/modules/kernel.rs::DisableThreadLibraryCalls:LoadLibraryA/WandGetModuleHandleA/Wreturn&HleModulepointers as pseudo-module handles for console HLE DLLs (such asxgameruntime.dll,d3d12_xs.dll,dstorage_xs.dll,gameinput.dll).FreeLibraryalready recognizes pseudo-module handles (registry().iter().any(|m| handle(m) == module)) and returns1, butDisableThreadLibraryCallsforwarded them directly to Windows' hostDisableThreadLibraryCalls, which rejects pseudo-module handles with0(ERROR_INVALID_HANDLE).1for registered HLE pseudo-module handles before delegating title/host modules tohost::disable_thread_library_calls.Tests
Added
disable_thread_library_calls_accepts_pseudo_modulesincrates/victory-hle/src/modules/kernel.rs.Verification
cargo clippy --locked -p victory-hle --all-targets -- -D warningsand--all-features: 0 warnings.cargo test --locked -p victory-hle --lib: 147 passed, 0 failed.cargo xtask policy: 184 files ok.@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.
@oni-swr on GitHub · 2026-11-25 20:15 UTC · original
Independent WARP/CPU verification for head
786165f1c2against origin/main13f91caee2. 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=1andVICTORY_D3D12_WARP=1set (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 oforigin/main(merge-base =origin/main, so no temporary merge was needed).Commands/results:
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.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.if false && registry()...);disable_thread_library_calls_accepts_pseudo_modulesFAILED (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
DisableThreadLibraryCallscould 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).
@Marvisak on GitHub · 2026-11-25 23:25 UTC · original
Automated triage for the maintainers.
DisableThreadLibraryCallsincrates/victory-hle/src/modules/kernel.rsnow 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 howFreeLibraryalready 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:checkpassing. This is a recommendation for a maintainer to look, not an approval.Generated by Claude Code
@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 newdisable_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).
@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 base13f91ca).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo 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.disable_thread_library_calls_accepts_pseudo_modules.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#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_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
View 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.