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

Open
pawrenity wants to merge 2 commits from upstream-pr/2902 into main
pawrenity commented 2026-11-25 23:31:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pawrenity on 2026-11-25T23:31:30Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:issue:6615934498 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2902). Originally posted by [pawrenity](https://github.com/pawrenity) on 2026-11-25T23:31:30Z. --- `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)
kotekompotek commented 2026-11-25 23:34:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T23:34:10Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:Marvisak/VIctory:review:6066470164 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2902#pullrequestreview-6066470164). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T23:34:10Z. **Review:** COMMENTED --- 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.
fuzeofficlal commented 2026-11-25 23:39:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T23:39:20Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:Marvisak/VIctory:review:6066519216 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2902#pullrequestreview-6066519216). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T23:39:20Z. **Review:** COMMENTED --- 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.
Marvisak commented 2026-11-26 03:05:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T02:16:47Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7180641387 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2902#issuecomment-7180641387). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T02:16:47Z. --- <!-- 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)_
pawrenity commented 2026-11-26 05:04:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pawrenity on 2026-11-26T04:30:29Z.


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).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7182655274 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2902#issuecomment-7182655274). Originally posted by [pawrenity](https://github.com/pawrenity) on 2026-11-26T04:30:29Z. --- 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).
cloph-dsp commented 2026-11-26 13:04:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-26T12:29:34Z.


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).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7192070554 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2902#issuecomment-7192070554). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-26T12:29:34Z. --- 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).
Dukestar69 commented 2026-11-26 13:31:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T13:31:10Z.

Review: APPROVED


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).

<!-- greyfinch-sync:Marvisak/VIctory:review:6074989320 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2902#pullrequestreview-6074989320). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T13:31:10Z. **Review:** APPROVED --- 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).
futurepro62 commented 2026-11-26 18:15:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-26T18:15:56Z.


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.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7200249759 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2902#issuecomment-7200249759). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-26T18:15:56Z. --- 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 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/2902:upstream-pr/2902'
git switch 'upstream-pr/2902'

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/2902'
git switch 'upstream-pr/2902'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2902'
git switch 'upstream-pr/2902'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2902'
git switch 'main'
git merge --squash 'upstream-pr/2902'
git switch 'main'
git merge --ff-only 'upstream-pr/2902'
git switch 'main'
git merge 'upstream-pr/2902'
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!2900
No description provided.