VFS: moves through MoveFileWithProgressW are redirected too #57
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/58"
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 ivall/xcl. Originally posted by gefydev on 2026-11-22T23:03:12Z.
vfs_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.Imported from ivall/xcl. Originally posted by ivall on 2026-11-23T09:45:17Z.
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!