HLE: reject failed GetLogicalDrives() mask when mounting virtual drives #2437

Manually merged
github merged 1 commit from github-bot/gh-2437 into main 2026-11-30 14:17:16 +00:00 AGit
Owner

@⁠fuzeofficlal on GitHub · 2026-11-29 13:01 UTC · original
fuzeofficlal:fix/hle-files-logical-drives-zero → main · +55 −3 · 1 files · 1 commits · merged 2026-11-30 14:12 UTC

Summary

Win32 GetLogicalDrives() returns 0 on failure. files::mount (crates/victory-hle/src/modules/files.rs) previously did not check for 0, so (0 >> bit) & 1 == 0 treated every drive letter D..=Z as free and allocated Z:, risking shadowing a real host drive.

Fix

  • Extract mount_in so mount logs a warning and returns None without modifying the mount table when GetLogicalDrives() returns 0, while still returning cached letters for already-mounted roots.
  • Add isolated unit tests in modules::files::tests covering 0, full bitmasks (0x03ff_ffff / 0x03ff_fff8), and normal letter allocation/reuse without mutating global DRIVES.

Verification

  • Verified locally on VIctory-NVIDIA:
    • cargo test --locked -p victory-hle -- --test-threads=1
    • cargo clippy --locked -p victory-hle --all-targets (no new warnings)
    • cargo run --quiet --locked -p xtask -- policy --staged
**@⁠fuzeofficlal** on GitHub · 2026-11-29 13:01 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2437) `fuzeofficlal:fix/hle-files-logical-drives-zero` → `main` · +55 −3 · 1 files · 1 commits · merged 2026-11-30 14:12 UTC ## Summary Win32 `GetLogicalDrives()` returns `0` on failure. `files::mount` (`crates/victory-hle/src/modules/files.rs`) previously did not check for `0`, so `(0 >> bit) & 1 == 0` treated every drive letter `D..=Z` as free and allocated `Z:`, risking shadowing a real host drive. ## Fix - Extract `mount_in` so `mount` logs a warning and returns `None` without modifying the mount table when `GetLogicalDrives()` returns `0`, while still returning cached letters for already-mounted roots. - Add isolated unit tests in `modules::files::tests` covering `0`, full bitmasks (`0x03ff_ffff` / `0x03ff_fff8`), and normal letter allocation/reuse without mutating global `DRIVES`. ## Verification - Verified locally on `VIctory-NVIDIA`: - `cargo test --locked -p victory-hle -- --test-threads=1` - `cargo clippy --locked -p victory-hle --all-targets` (no new warnings) - `cargo run --quiet --locked -p xtask -- policy --staged`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 13:06:11 +00:00
Author
Owner

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

Tested locally merged onto main (829188e9).

  • Merge: Clean merge in crates/victory-hle/src/modules/files.rs.
  • Tests: cargo test -p victory-hle --lib files passed (18 passed; 0 failed, including mount_in_rejects_failed_host_drive_query, mount_in_chooses_highest_free_letter_and_reuses_mounts, and mount_in_uses_only_d_through_z) with 0 warnings in victory-hle.

Clean guard against failed GetLogicalDrives() masks when mounting virtual drives. LGTM.

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

**@⁠Dukestar69** on GitHub · 2026-11-29 13:03 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2437#pullrequestreview-6102990140) · **approved these changes** Tested locally merged onto `main` (`829188e9`). - **Merge**: Clean merge in `crates/victory-hle/src/modules/files.rs`. - **Tests**: `cargo test -p victory-hle --lib files` passed (`18 passed; 0 failed`, including `mount_in_rejects_failed_host_drive_query`, `mount_in_chooses_highest_free_letter_and_reuses_mounts`, and `mount_in_uses_only_d_through_z`) with 0 warnings in `victory-hle`. Clean guard against failed `GetLogicalDrives()` masks when mounting virtual drives. LGTM. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
github manually merged commit 34ff4de03f into main 2026-11-30 14:17:16 +00:00
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/trustno1-coder--VIctory-NVIDIA!2437
No description provided.