HLE: a module name with a trailing dot gets no .dll appended #2902

Open
github-bot wants to merge 2 commits from github-bot/gh-2902 into main AGit
Owner

@⁠pawrenity on GitHub · 2026-11-25 23:31 UTC · original
pawrenity:hle/module-name-trailing-dot → main · +22 −2 · 1 files · 2 commits · open

find_module (behind GetModuleHandleA/W and LoadLibrary[Ex]A/W) added .dll only to names without a dot, and otherwise kept the name as given. A name with a trailing dot, such as "foo.", therefore kept its dot and matched nothing: not the title image named foo, not the registry, not HostPolicy::allows. The call returned NULL with ERROR_MOD_NOT_FOUND.

The Win32 contract (LoadLibraryW / GetModuleHandleW):

If the string specifies a module name without a path and the file name extension is omitted, the function appends the default library extension .dll to the module name. To prevent the function from appending .dll to the module name, include a trailing point character (.) in the module name string.

Now:

Name Looks up
"foo" foo.dll (unchanged)
"foo.dll", "foo.exe" as given (unchanged)
"foo.", "sub\FOO." a module named exactly foo, never foo.dll

Test: modules::kernel::tests::a_module_name_with_a_trailing_dot_gets_no_dll_appended registers two synthetic title images, C:\title\plain and C:\title\plain.dll, and checks all four lookups. Before the fix it fails at the first assertion: "plain." returns NULL.

Verification: Windows 11, MSVC.

  • cargo test -p victory-hle --locked: all 153 lib tests pass, plus the other test targets.
  • cargo clippy -p victory-hle --all-targets --locked -- -D warnings: clean.
  • rustfmt --check on the changed file: clean.

No game files used. Claimed in #1633.

🤖 Generated with Claude Code

**@⁠pawrenity** on GitHub · 2026-11-25 23:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/2902) `pawrenity:hle/module-name-trailing-dot` → `main` · +22 −2 · 1 files · 2 commits · open `find_module` (behind `GetModuleHandleA/W` and `LoadLibrary[Ex]A/W`) added `.dll` only to names without a dot, and otherwise kept the name as given. A name with a trailing dot, such as `"foo."`, therefore kept its dot and matched nothing: not the title image named `foo`, not the registry, not `HostPolicy::allows`. The call returned NULL with `ERROR_MOD_NOT_FOUND`. The Win32 contract (LoadLibraryW / GetModuleHandleW): > If the string specifies a module name without a path and the file name extension is omitted, the function appends the default library extension .dll to the module name. To prevent the function from appending .dll to the module name, include a trailing point character (.) in the module name string. Now: | Name | Looks up | |---|---| | `"foo"` | `foo.dll` (unchanged) | | `"foo.dll"`, `"foo.exe"` | as given (unchanged) | | `"foo."`, `"sub\FOO."` | a module named exactly `foo`, never `foo.dll` | **Test:** `modules::kernel::tests::a_module_name_with_a_trailing_dot_gets_no_dll_appended` registers two synthetic title images, `C:\title\plain` and `C:\title\plain.dll`, and checks all four lookups. Before the fix it fails at the first assertion: `"plain."` returns NULL. **Verification:** Windows 11, MSVC. - `cargo test -p victory-hle --locked`: all 153 lib tests pass, plus the other test targets. - `cargo clippy -p victory-hle --all-targets --locked -- -D warnings`: clean. - `rustfmt --check` on the changed file: clean. No game files used. Claimed in #1633. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
LoadLibrary and GetModuleHandle: "If the string specifies a module name
without a path and the file name extension is omitted, the function
appends the default library extension .dll to the module name. To
prevent the function from appending .dll to the module name, include a
trailing point character (.) in the module name string."

find_module kept the dot as part of the name, so "foo." never matched
a title image or module named "foo" and was refused instead. The dot
is now dropped and no extension added; "foo" still means foo.dll.

Test: a_module_name_with_a_trailing_dot_gets_no_dll_appended (fails
before: "plain." returned NULL instead of the extensionless image).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:17:06 +00:00
Review on #2902: GetModuleHandleW("kernel32.dll..") on Windows 11 returns
kernel32.dll, so the loader strips all trailing dots, not one. The test
now also looks up "plain.." and "plain.dll..".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 02:16 UTC · original · edited 2026-11-26 05:24 UTC

Automated triage for the maintainers.

Merge candidate (recommending a look, not approving). The new head answers the reviewer note that Windows drops every trailing dot, not just one: find_module in crates/victory-hle/src/modules/kernel.rs now uses trim_end_matches('.') when the name ends in ., so plain.. resolves to plain and plain.dll.. to plain.dll, while names with or without an extension behave as on main. The test adds both of those spellings to the earlier four, with synthetic image paths. CI check passes on 3d514a0.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 02:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/2902#issuecomment-7180641387) · edited 2026-11-26 05:24 UTC <!-- victory-triage v1 head=3d514a0a1e2620b863cd3a73132dba29fbf8cfdc verdict=merge-candidate at=2026-11-26T05:25:00Z --> Automated triage for the maintainers. **Merge candidate** (recommending a look, not approving). The new head answers the reviewer note that Windows drops every trailing dot, not just one: `find_module` in `crates/victory-hle/src/modules/kernel.rs` now uses `trim_end_matches('.')` when the name ends in `.`, so `plain..` resolves to `plain` and `plain.dll..` to `plain.dll`, while names with or without an extension behave as on `main`. The test adds both of those spellings to the earlier four, with synthetic image paths. CI `check` passes on `3d514a0`. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠pawrenity on GitHub · 2026-11-26 04:30 UTC · original

Thanks for checking against kernel32 directly. I've pushed 3d514a0, which drops every trailing dot (trim_end_matches('.') when the name ends in .), so "kernel32.dll.." resolves like Windows does. The test now also covers "plain.." (the extensionless image) and "plain.dll.." (plain.dll). cargo test -p victory-hle --locked passes 153/153, clippy -D warnings is clean, and rustfmt --check is clean.

AI-assisted (Claude Code).

**@⁠pawrenity** on GitHub · 2026-11-26 04:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2902#issuecomment-7182655274) Thanks for checking against `kernel32` directly. I've pushed 3d514a0, which drops every trailing dot (`trim_end_matches('.')` when the name ends in `.`), so `"kernel32.dll.."` resolves like Windows does. The test now also covers `"plain.."` (the extensionless image) and `"plain.dll.."` (`plain.dll`). `cargo test -p victory-hle --locked` passes 153/153, clippy `-D warnings` is clean, and `rustfmt --check` is clean. AI-assisted (Claude Code).
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 23:34 UTC · original · reviewed

Matches the Windows loader: a trailing dot declares 'no extension' so no .dll is appended and the name resolves bare — distinct from a dot-free name which gets .dll. Test covers all four spellings. LGTM.

**@⁠kotekompotek** on GitHub · 2026-11-25 23:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/2902#pullrequestreview-6066470164) · **reviewed** Matches the Windows loader: a trailing dot declares 'no extension' so no .dll is appended and the name resolves bare — distinct from a dot-free name which gets .dll. Test covers all four spellings. LGTM.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 23:39 UTC · original · reviewed

Verified head 4a3d3db1 cleanly merged onto origin/main (63bcca43) on Windows 11 x64.

Code & Win32 Behavior Review

  • Verified directly against Windows 11 kernel32!GetModuleHandleW:
    • GetModuleHandleW("kernel32.") -> NULL (err=126, no .dll appended), matching this PR's strip_suffix('.') -> "kernel32" path.
    • GetModuleHandleW("kernel32.dll.") -> returns the kernel32.dll handle, matching this PR's strip_suffix('.') -> "kernel32.dll" -> HostPolicy pass-through.
  • Minor edge case (non-blocking): Native GetModuleHandleW("kernel32.dll..") actually strips all trailing dots (equivalent to trim_end_matches('.') when file.ends_with('.')), whereas strip_suffix('.') strips only one trailing dot (and strip_suffix('.') on a bare "." yields ""). For the standard Win32 single-trailing-dot no-extension convention ("foo."), strip_suffix('.') behaves cleanly.

Local Verification

  • cargo test --locked -p victory-hle --lib modules::kernel::tests: 6/6 passed (including a_module_name_with_a_trailing_dot_gets_no_dll_appended).
  • cargo clippy --locked -p victory-hle --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Looks clean and ready to merge.

**@⁠fuzeofficlal** on GitHub · 2026-11-25 23:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/2902#pullrequestreview-6066519216) · **reviewed** Verified head `4a3d3db1` cleanly merged onto `origin/main` (`63bcca43`) on Windows 11 x64. ### Code & Win32 Behavior Review - Verified directly against Windows 11 `kernel32!GetModuleHandleW`: - `GetModuleHandleW("kernel32.")` -> `NULL` (`err=126`, no `.dll` appended), matching this PR's `strip_suffix('.')` -> `"kernel32"` path. - `GetModuleHandleW("kernel32.dll.")` -> returns the `kernel32.dll` handle, matching this PR's `strip_suffix('.')` -> `"kernel32.dll"` -> `HostPolicy` pass-through. - **Minor edge case (non-blocking)**: Native `GetModuleHandleW("kernel32.dll..")` actually strips *all* trailing dots (equivalent to `trim_end_matches('.')` when `file.ends_with('.')`), whereas `strip_suffix('.')` strips only one trailing dot (and `strip_suffix('.')` on a bare `"."` yields `""`). For the standard Win32 single-trailing-dot no-extension convention (`"foo."`), `strip_suffix('.')` behaves cleanly. ### Local Verification - `cargo test --locked -p victory-hle --lib modules::kernel::tests`: **6/6 passed** (including `a_module_name_with_a_trailing_dot_gets_no_dll_appended`). - `cargo clippy --locked -p victory-hle --all-targets -- -D warnings`: clean. - `cargo xtask policy`: `191 files ok`. Looks clean and ready to merge.
Author
Owner

@⁠cloph-dsp on GitHub · 2026-11-26 12:29 UTC · original

Independent local verification of head 3d514a0 on Windows 11, Rust 1.100.0/MSVC:

  • cargo test --locked -p victory-hle --lib -- modules::kernel::tests::a_module_name_with_a_trailing_dot_gets_no_dll_appended --exact — 1 passed, 0 failed.
  • git diff --check origin/main HEAD — clean.

Used a worktree-local CARGO_TARGET_DIR. Synthetic module-name inputs only; no game assets, extracted data or DRM material used. AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only).

**@⁠cloph-dsp** on GitHub · 2026-11-26 12:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/2902#issuecomment-7192070554) Independent local verification of head `3d514a0` on Windows 11, Rust 1.100.0/MSVC: - `cargo test --locked -p victory-hle --lib -- modules::kernel::tests::a_module_name_with_a_trailing_dot_gets_no_dll_appended --exact` — 1 passed, 0 failed. - `git diff --check origin/main HEAD` — clean. Used a worktree-local `CARGO_TARGET_DIR`. Synthetic module-name inputs only; no game assets, extracted data or DRM material used. AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only).
Author
Owner

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

Verified against origin/main (63bcca4):

  • cargo test -p victory-hle --lib modules::kernel:: -- --test-threads=1: 6/6 passed (including a_module_name_with_a_trailing_dot_gets_no_dll_appended).
  • cargo clippy -p victory-hle --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Matches Windows module-lookup semantics by not appending .dll when a module name ends with a trailing dot.

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

**@⁠Dukestar69** on GitHub · 2026-11-26 13:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/2902#pullrequestreview-6074989320) · **approved these changes** Verified against `origin/main` (`63bcca4`): - `cargo test -p victory-hle --lib modules::kernel:: -- --test-threads=1`: 6/6 passed (including `a_module_name_with_a_trailing_dot_gets_no_dll_appended`). - `cargo clippy -p victory-hle --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Matches Windows module-lookup semantics by not appending `.dll` when a module name ends with a trailing dot. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-26 18:15 UTC · original

NVIDIA full-suite run, to go with the reports above by Dukestar69, cloph-dsp, fuzeofficlal, since none of them names a GPU run. Tested exact head 3d514a0 (on its base 842b0cb).

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: 867 passed, 0 failed, 10 ignored.
  • The new tests ran and passed: a_module_name_with_a_trailing_dot_gets_no_dll_appended.
  • --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 18:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/2902#issuecomment-7200249759) NVIDIA full-suite run, to go with the reports above by Dukestar69, cloph-dsp, fuzeofficlal, since none of them names a GPU run. Tested exact head `3d514a0` (on its base `842b0cb`). **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`: **867 passed, 0 failed, 10 ignored**. - The new tests ran and passed: `a_module_name_with_a_trailing_dot_gets_no_dll_appended`. - `--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/2902/head:github-bot/gh-2902'
git switch 'github-bot/gh-2902'

Merge

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