fix(hle): fix verbatim/UNC/drive-root virtual path translation and GetDiskFreeSpaceW volume roots #3361
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3361"
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?
Imported from Marvisak/VIctory. Originally posted by reeledMarek on 2026-11-26T20:25:47Z.
Summary
\\?\verbatim virtual-drive path (e.g.\\?\G:\...),translateblindly prepended\\?\to the mounted hostroot, producing invalid paths for UNC mounts (\\?\\\server\share\...instead of\\?\UNC\server\share\...), already-verbatim mounts (\\?\\\?\...), and drive-root mounts (\\?\D:\\fooorD:\\foo).verbatim_rootandjoin_host_pathso verbatim, UNC, and drive-root mounts join cleanly without duplicate prefixes or doubled backslashes.volume_rootforGetDiskFreeSpaceWso\\?\C:\...,\\?\UNC\server\share\..., and\\server\share\...translated host paths are trimmed to a valid volume root instead of passing a subdirectory.verbatim_and_drive_root_mounts_join_cleanlyandvolume_root_handles_drive_verbatim_and_unc_paths.Verification
cargo clippy -p victory-hle --all-targets --target x86_64-pc-windows-msvc --locked -- -D warningscargo test -p xtask --lockedImported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T20:27:38Z.
Review: APPROVED
LGTM — verified on Windows against
origin/main(63bcca4).\\?\), UNC (\\?\UNC\.../\\server\share), and drive-root mounts cleanly in virtual path translation andGetDiskFreeSpaceWvolume root extraction is well-tested and avoids malformed path joins.cargo test -p victory-hle --lib modules::files:: -- --test-threads=1: 8 passed, 0 failed (includingverbatim_and_drive_root_mounts_join_cleanlyandvolume_root_handles_drive_verbatim_and_unc_paths).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).
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T20:54:56Z.
Review: APPROVED
LGTM —
verbatim_root,join_host_path, andvolume_rootcleanly resolve the\?\,\?\UNC\, and drive-root joining edge cases and extract volume roots forGetDiskFreeSpaceW.Verified
cargo run --locked -p xtask -- policy:191 files ok.cargo clippy --locked -p victory-hle --all-targets -- -D warnings(default &--all-features): clean.cargo test --locked -p victory-hle --lib modules::files:: -- --test-threads=1: 8 passed, 0 failed (includingverbatim_and_drive_root_mounts_join_cleanlyandvolume_root_handles_drive_verbatim_and_unc_paths).cargo test --locked -p victory-hle --all-targets -- --test-threads=1: 154 lib + 2 integration tests passed, 0 failed.Minor non-blocking nits
crates/victory-hle/src/modules/files.rs:150:if out.last() == Some(&u16::from(b':'))runs after appendingparts; guarding it withparts.is_empty()limits the trailing\strictly to empty-tail drive roots rather than a colon-suffixed guest component.join_host_pathbehavior (files.rs:164, 179):/->\normalization checks!prefix.is_empty()rather than whetheroutstarts with\?\(so a short non-verbatim guest path on a\?\mount keeps/), and short non-verbatim paths still rely on Windows path resolution for...rustfmt --edition 2024reports one formatting diff in the new test atfiles.rs:1046.Imported from Marvisak/VIctory. Originally posted by reeledMarek on 2026-11-26T21:04:26Z.
Thanks for the thorough review @fuzeofficlal! Pushed
60296b7to guard the trailing\inverbatim()withparts.is_empty()(with a regression test covering both an empty-tail drive root and a colon-suffixed component) and fixed therustfmtformatting line.Imported from Marvisak/VIctory. Originally posted by passerbyyhx on 2026-11-26T22:34:47Z.
Windows 11 check at
60296b7against63bcca4using a synthetic file on a real D: volume. I mounted a subdirectory and the drive root, both with and without the host verbatim prefix, then exercised all four guest prefix/separator forms through the HLE file and volume entry points.GetDiskFreeSpaceWimproved from 10/16 to 16/16. All four outputs matched both adjacent native calls on the root returned byGetVolumePathNameW.CreateFileW/ReadFileimproved from 10/16 to 14/16. Both auto-verbatim long paths succeeded on both revisions.X:/...with an already-verbatim host mount. The folder case produced\\?\D:\...\nested/probe.binand returned 123. The drive-root case produced\\?\D:/...and returned 2. The same targets both opened through the guest verbatim\\?\X:/...form, and both ordinary-slash disk queries succeeded on head.The focused files suite passed 7/7 on the parent and 9/9 on head. Live network shares were outside this run. Synthetic fixture
AI-assisted with Codex.
Imported from Marvisak/VIctory. Originally posted by passerbyyhx on 2026-11-27T09:12:13Z.
I sent a small fix against this PR's branch for the two ordinary slash paths on verbatim host mounts. On the same Windows matrix, the file reads now pass 16/16 (previously 14/16), with 16/16 volume queries and both long paths passing. AI-assisted with Codex.
Imported from Marvisak/VIctory. Originally posted by reeledMarek on 2026-11-27T17:13:30Z.
Thanks for testing the full Windows matrix and sending the fix @passerbyyhx! Merged
reeledMarek/VIctory#1into this branch.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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.