HLE/Media: translate \??\<drive>:\ NT object-manager paths through virtual drive mounts #3028

Closed
RVZO6 wants to merge 1 commit from upstream-pr/3030 into main
RVZO6 commented 2026-11-26 03:59:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by RVZO6 on 2026-11-26T03:59:46Z.


media::local (crates/victory-hle/src/modules/media.rs:61-67) previously returned Ok(with_nul(url)) immediately for \??\<drive>:\... paths, bypassing files::translate even though \\?\<drive>:\... paths right above (L56-60) rewrite mounted virtual console drives (G:\, T:\, etc.) to their host directories.

Convert \??\<rest> to \\?\<rest> and pass it to files::translate, falling back to with_nul(url) when the drive is not a mounted virtual drive so:

  • Mounted virtual drives (e.g. \??\G:\movies\clip.mp4) resolve identically to \\?\G:\movies\clip.mp4.
  • Unmounted drives (e.g. \??\C:\Windows\a.wav) preserve their original \??\ spelling.
  • Non-drive \??\ paths (e.g. \??\UNC\server\share\a.mp4) remain rejected as shares.

Disjoint from #663 (which does not modify local()'s \??\ branch).

Verification

  • Negative control (before fix): object_manager_prefix_translates_virtual_drives failed (left: "\\??\\Y:\\movies\\clip.mp4", right: "\\\\?\\...\\movies\\clip.mp4").
  • After fix: all 6 modules::media::tests pass.
  • Official Windows MSVC + WARP SM 6.6 CI (Rust 1.98.1, default + --tests + --features diagnostics clippy, xtask policy, full workspace tests): RVZO6/VIctory CI run #45748741503 (green, combined Wave 10 check on 63bcca4).
  • Not run: the title; any hardware GPU.

AI-assisted: T3 Code (Antigravity, gemini-4-neon).

<!-- greyfinch-sync:Marvisak/VIctory:issue:6619196710 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3030). Originally posted by [RVZO6](https://github.com/RVZO6) on 2026-11-26T03:59:46Z. --- `media::local` (`crates/victory-hle/src/modules/media.rs:61-67`) previously returned `Ok(with_nul(url))` immediately for `\??\<drive>:\...` paths, bypassing `files::translate` even though `\\?\<drive>:\...` paths right above (`L56-60`) rewrite mounted virtual console drives (`G:\`, `T:\`, etc.) to their host directories. Convert `\??\<rest>` to `\\?\<rest>` and pass it to `files::translate`, falling back to `with_nul(url)` when the drive is not a mounted virtual drive so: - Mounted virtual drives (e.g. `\??\G:\movies\clip.mp4`) resolve identically to `\\?\G:\movies\clip.mp4`. - Unmounted drives (e.g. `\??\C:\Windows\a.wav`) preserve their original `\??\` spelling. - Non-drive `\??\` paths (e.g. `\??\UNC\server\share\a.mp4`) remain rejected as shares. Disjoint from #663 (which does not modify `local()`'s `\??\` branch). ### Verification - **Negative control (before fix):** `object_manager_prefix_translates_virtual_drives` failed (`left: "\\??\\Y:\\movies\\clip.mp4"`, `right: "\\\\?\\...\\movies\\clip.mp4"`). - **After fix:** all 6 `modules::media::tests` pass. - Official Windows MSVC + WARP SM 6.6 CI (Rust 1.98.1, default + `--tests` + `--features diagnostics` clippy, `xtask policy`, full workspace tests): [RVZO6/VIctory CI run #45748741503](https://github.com/RVZO6/VIctory/actions/runs/45748741503) (green, combined Wave 10 check on `63bcca4`). - **Not run:** the title; any hardware GPU. AI-assisted: T3 Code (Antigravity, gemini-4-neon).
fuzeofficlal commented 2026-11-26 05:03:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T04:11:53Z.

Review: CHANGES_REQUESTED


Two issues to flag on de808e50:

  1. Double \\?\ prefix when a virtual drive root is already verbatim (crates/victory-hle/src/modules/media.rs:68-69, crates/victory-hle/src/modules/files.rs:168-170):
    Constructing format!(r"\\?\{rest}") and passing it into files::translate causes files::translate to unconditionally prepend \\?\ onto the stored mount root (out = prefix.to_vec(); out.extend_from_slice(root)). If the mounted drive root already starts with \\?\ (for example from std::fs::canonicalize), the translated path becomes \\?\\\?\D:\..., which fails CreateFileW with ERROR_INVALID_NAME (123). (By contrast, files::verbatim at files.rs:115 explicitly checks root.starts_with(&VERBATIM).)
  2. Overlap with existing open PR: #2089 already addresses \??\ object-manager path translation across both files::translate and media::local (including avoiding duplicate \\?\ prefixes on verbatim mount roots and avoiding lossy UTF-16 round-tripping).

If keeping this PR separate, please avoid duplicating the \\?\ prefix on verbatim mount roots and add a regression test covering a \\?\-prefixed mount root as well as mixed forward slashes in the tail.

<!-- greyfinch-sync:Marvisak/VIctory:review:6068446186 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3030#pullrequestreview-6068446186). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T04:11:53Z. **Review:** CHANGES_REQUESTED --- Two issues to flag on `de808e50`: 1. **Double `\\?\` prefix when a virtual drive root is already verbatim** (`crates/victory-hle/src/modules/media.rs:68-69`, `crates/victory-hle/src/modules/files.rs:168-170`): Constructing `format!(r"\\?\{rest}")` and passing it into `files::translate` causes `files::translate` to unconditionally prepend `\\?\` onto the stored mount root (`out = prefix.to_vec(); out.extend_from_slice(root)`). If the mounted drive root already starts with `\\?\` (for example from `std::fs::canonicalize`), the translated path becomes `\\?\\\?\D:\...`, which fails `CreateFileW` with `ERROR_INVALID_NAME` (123). (By contrast, `files::verbatim` at `files.rs:115` explicitly checks `root.starts_with(&VERBATIM)`.) 2. **Overlap with existing open PR**: `#2089` already addresses `\??\` object-manager path translation across both `files::translate` and `media::local` (including avoiding duplicate `\\?\` prefixes on verbatim mount roots and avoiding lossy UTF-16 round-tripping). If keeping this PR separate, please avoid duplicating the `\\?\` prefix on verbatim mount roots and add a regression test covering a `\\?\`-prefixed mount root as well as mixed forward slashes in the tail.
kotekompotek commented 2026-11-26 05:03:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T04:37:40Z.

Review: APPROVED


LGTM — ??\ drive paths now go through files::translate via the ?\ verbatim spelling, so mounted virtual drives resolve while unmounted ones keep the original spelling. UNC stays rejected as a share; test covers all three.

<!-- greyfinch-sync:Marvisak/VIctory:review:6068614780 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3030#pullrequestreview-6068614780). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-26T04:37:40Z. **Review:** APPROVED --- LGTM — \??\ drive paths now go through files::translate via the \?\ verbatim spelling, so mounted virtual drives resolve while unmounted ones keep the original spelling. UNC stays rejected as a share; test covers all three.
upstream-sync closed this pull request 2026-11-26 06:03:22 +00:00
RVZO6 commented 2026-11-26 06:03:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by RVZO6 on 2026-11-26T06:01:41Z.


Closing in favor of #2089, which already fixes \??\ virtual-drive translation in both files.rs and media.rs (matching the second-look review on #2416).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7184024073 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3030#issuecomment-7184024073). Originally posted by [RVZO6](https://github.com/RVZO6) on 2026-11-26T06:01:41Z. --- Closing in favor of #2089, which already fixes `\??\` virtual-drive translation in both `files.rs` and `media.rs` (matching the second-look review on #2416).

Pull request closed

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!3028
No description provided.