Skip to content

Files: .. in a title path stops at the virtual drive's root - #182

Open
Maraco91 wants to merge 1 commit into
Marvisak:mainfrom
Maraco91:files/dotdot-stops-at-drive-root
Open

Maraco91 wants to merge 1 commit into
Marvisak:mainfrom
Maraco91:files/dotdot-stops-at-drive-root

Conversation

@Maraco91

Copy link
Copy Markdown
Contributor

What

A title path with .. could name a file outside the host folder behind its virtual drive.

translate hands a short path to the host as the host folder followed by the title's tail, unchanged. The host then resolves .. against the host folder, which has a parent: with a drive over C:\data\title, X:\..\outside.bin becomes C:\data\title\..\outside.bin, and CreateFileW makes C:\data\outside.bin. To the title X:\ is a drive root, where .. stops: the path is X:\outside.bin (as C:\..\x is C:\x on the host). The same goes for X:\a\..\..\b, X:/../b and X:..\b.

The long form already does this: verbatim() resolves . and .. itself and ".. stops at the root" (the existing test checks /x/../../y). So today the same title path names different host files depending on whether root + tail reaches 248 characters.

Now a tail with a .. part is resolved here in the short form too, with the same clean-up (moved out of verbatim() into parts(), unchanged), and written as the host folder plus the names left. A trailing separator is kept, and X:\.. is the root (<root>\). Paths without a .. part are passed on exactly as before, / and all. Paths given with \?\ are untouched: after that prefix .. is a name to the host too.

I have not seen a title build such a path (I have no game files); this is from reading the code. Both drives a title writes through (T:, persistent storage) and the package drive go through this function.

Tested

Windows 11 Pro 10.0.26200, rustc 1.98.1 (x86_64-pc-windows-msvc), no game data, no GPU involved.

New unit test parent_parts_stop_at_the_drive_root: mounts <temp>\title, calls CreateFileW on X:\..\outside.bin and checks the file is in <temp>\title and not in <temp>; then checks translate on seven paths (\..\, /../, drive-relative ..\, several levels, with ., a trailing separator, the bare X:\..). Controls in the same test: X:\a\..\b.bin still names <root>\b.bin, and names that merely contain dots (a..b, ..c) are passed on unchanged.

  • main (d2a4bae) + the test only: cargo test -p victory-hle --lib parent_parts fails: left the drive (the file was created in <temp>, beside the drive's folder).
  • with the fix: cargo test -p victory-hle --lib files::: 5 passed, 0 failed (the 4 existing files tests, among them the long-path ones that go through verbatim(), and the new one).
  • cargo clippy -p victory-hle --tests: nothing in files.rs. rustfmt --check files.rs: nothing in the lines changed (one existing difference at the ReadFile assertion in kernel_reads_reach_the_buffer).
  • cargo xtask policy --staged: ok.

Not tested: a title run.

Touches translate/verbatim only; #111 (narrow wrappers) and #133 (mount_at) change other parts of the file.

AI-assisted (Claude Code); the tests above were run on the machine described.

🤖 Generated with Claude Code

A path on a virtual drive was handed to the host as the host folder
followed by the title's tail, so the host resolved `..` against the host
folder: `X:\..\f` named a file beside the drive's folder, where on a
drive of its own `..` stops at the root and the path is `X:\f`. Long
paths (the `\?\` form) already resolved `..` here and stopped at the
root, so the same title path named different files depending on its
length.

A tail with a `..` part is now resolved here in the short form too, with
the clean-up the long form uses. Other paths are passed on as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@DaviTostes

Copy link
Copy Markdown

Tested 1827532 under Wine 11.22 + vkd3d-proton 3.1 on Arch Linux x86_64 (AMD RX 9060 XT, RADV 26.3.1), Windows build with cargo xwin ... --target x86_64-pc-windows-msvc -p victory-hle and a native Microsoft d3dcompiler_47: pass.

No game data used.

AntoninMichelq pushed a commit to AntoninMichelq/VIctory that referenced this pull request Nov 24, 2026
…al drive's root) into the integration

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
@ghost ghost mentioned this pull request Nov 24, 2026
sahajiscoding added a commit to sahajiscoding/VIctory that referenced this pull request Nov 24, 2026
… & shader ops

- Prefer high-performance discrete GPU via IDXGIFactory6::EnumAdapterByGpuPreference
  and VICTORY_ADAPTER (index or name substring) in victory-gpu and victory-shader (Marvisak#208/Marvisak#1132)
- Cap shader-visible sampler heaps at D3D12's 2,048 architectural limit instead of
  failing heap creation (Marvisak#100/Marvisak#86)
- Fall back to the in-memory translated shader if shader-cache disk write fails (Marvisak#358)
- Add F11 / Alt+Enter borderless fullscreen toggle and clean WM_CLOSE handling to
  both title windows (lifecycle.rs) and VIctory's fallback window (host.rs); clamp
  fit_into() dimensions to >= 1 (Marvisak#451)
- Enhance PC keyboard+mouse fallback gamepad with Space/LShift/R/LCtrl aliases,
  LMB/RMB/MMB triggers, and RMB/F9 mouse camera look; support null-device
  cross-device previous/next reading walk (Marvisak#361)
- Fall back to a no-op display deferral when PowerSetRequest returns ERROR_NOT_SUPPORTED
- Clamp short virtual-drive '..' paths at the virtual drive root (Marvisak#182)
- Wake and cancel sleeping delayed callbacks immediately on XTaskQueueTerminate (Marvisak#132)
- Cache XMA IMDCT rotation sin/cos tables across subframes (Marvisak#172)
- Lower additional RDNA2 VALU instructions (v_mul_hi_{u,i}32_{u,i}24, v_mad_{u,i}32_{u,i}16,
  v_lerp_u8, v_sad_u{8,16,32}, v_cvt_pk_{u,i}16_{u,i}32, v_dot{2,4}_{i,u}32_{i,u}{16,8})
  with DXIL validation and conditional INT64 feature flagging (Marvisak#157)
- Add portable victory.toml lookup next to victory.exe, interactive [S] Setup wizard
  and [K] Controls guide in victory.exe, and scripts/build-windows.ps1 release packager

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@acetonahard-code

Copy link
Copy Markdown

Tested on Windows 11 with the repo toolchain, merged into current main (ffe310e):

cargo test -p victory-hle passed failed ignored
main 95 0 0
main + this PR 96 0 0
main, --all-features 95 0 0
main + this PR, --all-features 96 0 0
  • The new test passes.
  • cargo clippy --all-targets -- -D warnings, with and without --all-features: clean.
  • cargo fmt --check: no new diffs from this PR (the ones it reports are already on main).

I didn't test with game data.


Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: crates/victory-hle/src/modules/files.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants