HLE: reject failed GetLogicalDrives() mask when mounting virtual drives #3132
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T09:39:17Z.
Summary
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.Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-26T10:23:08Z.
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).
Imported from Marvisak/VIctory. Originally posted by AurumCarlos on 2026-11-26T12:44:04Z.
Review: COMMENTED
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.Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-27T12:02:47Z.
NVIDIA full-suite run, to go with the reports above by cloph-dsp, since none of them names a GPU run. Tested exact head
8416b0b(on its base63bcca4).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: 869 passed, 0 failed, 10 ignored.mount_in_rejects_failed_host_drive_query,mount_in_uses_only_d_through_z,mount_in_chooses_highest_free_letter_and_reuses_mounts.--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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.