HLE: reject failed GetLogicalDrives() mask when mounting virtual drives #3134
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!3134
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3134"
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-26 09:39 UTC · original
fuzeofficlal:fix/hle-files-logical-drives-zero→main· +55 −3 · 1 files · 1 commits · openSummary
Win32
GetLogicalDrives()returns0on failure.files::mount(crates/victory-hle/src/modules/files.rs) previously did not check for0, so(0 >> bit) & 1 == 0treated every drive letterD..=Zas free and allocatedZ:, risking shadowing a real host drive.Fix
mount_insomountlogs a warning and returnsNonewithout modifying the mount table whenGetLogicalDrives()returns0, while still returning cached letters for already-mounted roots.modules::files::testscovering0, full bitmasks (0x03ff_ffff/0x03ff_fff8), and normal letter allocation/reuse without mutating globalDRIVES.Verification
cargo test -p victory-hle --locked: 155 lib (including 9modules::files::tests) + 1fidelityfx+ 1no_dll_plantingpassed, 0 failed.cargo clippy -p victory-hle --all-targets --locked -- -D warningsand--all-features: clean.cargo test -p xtask --locked policy::tests::repository_passes_policy: passed.@cloph-dsp on GitHub · 2026-11-26 10:23 UTC · original
Independent local verification of head
8416b0bon Windows 11, Rust 1.100.0/MSVC:cargo test --locked -p victory-hle --lib modules::files::tests— 6 passed, 0 failed (including the three newmount_in_*tests).git diff --check origin/main HEAD— clean.Synthetic drive masks only; no game assets, extracted data or DRM material used. AI-assisted (Hy4 flash).
@AurumCarlos on GitHub · 2026-11-26 12:44 UTC · original · reviewed
The refactor is clean: injecting
host_drivesintomount_inmakes the letter choice testable without touching the globalDRIVES. I also like the|| panic!(..)in the reuse test, which proves a cached root never queries the host. The guard does what the description says. I do have one question about the trade-off it makes.What a failed query now costs. On
main, the only non-test caller offiles::mountisstorage::folder(). IfmountreturnsNone, the persistent-storage path calls (0x18/0x20) answerNOT_SUPPORTED, so the title gets no save-storage drive at all. Before this change, the same failure gave the titleZ:\, which works unless the host really has aZ:that the title would also want to reach. These drives are path rewrites inside our own file hooks, not OS mounts, so "shadowing" only affects the title's own paths to that letter, which it has no reason to use for anything but the storage it was given.So the change swaps an unlikely, mostly harmless collision for a hard failure of saving.
GetLogicalDrivesfailing is itself very rare, so this may never matter in practice. But if it does happen, I'd expect "saves still work" to be the better outcome. Some options:warn!but fall back to picking fromD..=Zas before, so the failure is visible in the log without breaking storage.mountdoc comment) that a failed query now means no storage path, so that trade-off is explicit.A minor point, for consistency:
mount_atalso callsGetLogicalDrives, and treats0as "hides no host drive". It's only used for thehides_host_drivelog field there, so it's harmless, but a failed query will logfalseinstead of saying the query failed.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.