VFS: moves through MoveFileWithProgressW are redirected too #58
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!58
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/58/head"
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?
@gefydev on GitHub · 2026-11-22 23:03 UTC · original
gefydev:vfs-move-file-with-progress→main· +15 −0 · 1 files · 1 commits · merged 2026-11-23 09:44 UTCvfs_hooks.rshooksMoveFileExW, but notMoveFileWithProgressW.MoveFileAandMoveFileExAreachMoveFileWithProgressWwithout going throughMoveFileExW, so a move between console paths (T:\a.txt→T:\b.txt) goes to the PC's ownT:and fails.MoveFileWithProgressWis now hooked too, with the same handling (the body of theMoveFileExWhook moved into a sharedmove_file). WhenMoveFileExWitself callsMoveFileWithProgressW, the existing hook guard lets the inner call through, so a move is never handled twice.Validation
The hooks are process-wide and need an initialized VFS (a global
OnceLock), so I did not add them to the unit tests. I checked with two probe tests, run alone, on the branchgefydev/probe-movefile(not part of this PR):kernelbaseentry each API reaches, under Wine:T:\a.txt→T:\b.txtwith the real hooks and a VFS mountingT:: onmain,MoveFileAandMoveFileExAfail and the file stays; with this change all four APIs move it.I have not yet run the probes on Windows itself, so I can't say for sure that its
kernelbasetakes the same paths. IfMoveFileAdoesn't reachMoveFileWithProgressWthere, the extra hook does nothing.cargo test -p xcl --lib: 343 passed, 0 failed, on Windows GNU under Wine.@ivall on GitHub · 2026-11-23 09:45 UTC · original
Merged (
6ca99f2). I ran your probe on Windows 11 – the paths differ from Wine:So on Windows this PR is what makes
MoveFileWwork at all (it was not redirected before), but the ANSI moves reach no kernelbase entry – kernel32 does them with an internal helper.8064fe3hooksMoveFileA/MoveFileExA/MoveFileWithProgressAin kernel32 (paths to wide, then theMoveFileWithProgressWpath). With the real hooks and a VFS mountingT:(no such drive on the PC) all six entries moveT:\a.txt→T:\b.txt; a game file moved throughMoveFileExAlands in the overlay and the game folder stays intact.Tested on Windows 11 (RX 9070):
cargo test --workspacegreen (lib 351, e2e), and a 45 s Unicorn Overlord run on the release build (VFS hooks active, ~60 fps, clean exit). Thanks!