Repository navigation
Conversation
A title that deletes a game file through a handle (MSVC's std::filesystem::remove: CreateFile2 with DELETE, then SetFileInformationByHandle with FileDispositionInfoEx or FileDispositionInfo) holds a handle to the overlay copy. The delete removed only that copy and no whiteout was recorded, so the original was visible again. SetFileInformationByHandle is hooked now. After a successful delete disposition on a file inside the overlay the whiteout is recorded through commit_overlay_removal; a disposition that takes the delete back removes it again. Directories, FILE_DISPOSITION_FLAG_ON_CLOSE, other information classes and handles outside the overlay are passed through unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Owner
Author
|
Upstream PR xcl-dev#1054 was closed or merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A game file deleted through a handle came back:
SetFileInformationByHandlewas not hooked, so the delete removed only the overlay copy the handle points at and no whiteout was recorded. MSVC'sstd::filesystem::removedeletes this way. Part of xcl-dev#998 (the delete-by-handle case for files).What is in it
crates/xcl/src/vfs_hooks.rs: a hook onSetFileInformationByHandle. After a successfulFileDispositionInfo/FileDispositionInfoExdelete on a file inside the overlay, the whiteout is recorded through the existingcommit_overlay_removal; a disposition that takes the delete back removes it. Everything else is passed through unchanged: other information classes, handles outside the overlay, failed calls.delete_by_handle_hides_the_game_fileandset_file_info_by_handle_passes_everything_else_through.Tested
stable-x86_64-pc-windows-msvc; release; DXC 1.9.2602.17cargo test --workspace --release --no-fail-fast -- --test-threads=4on this PR's head: 729 passed, 0 failed, 41 ignored (mainat 02bfd1d: 727 passed, 0 failed, 41 ignored)no wave64(gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware). With--nocapture,mainshows 3 more on this machine (no reserved cube with mips on this adapter; no D3D12 debug layer installed, twice); that run was not repeated on the PR.delete_by_handle_hides_the_game_filefails without the new logic (withset_file_info_vfsreturning the original call's result at once: 11 passed, 1 failed incargo test -p xcl --release --lib vfs_hooks, at the whiteout assertion).Regression run
main:
PR:
Not tested
dumpbin -importsshows noSetFileInformationByHandlein its exe,msvcp140.dll,XCurl.dllorlibHttpClient.GDK.dll, and itsmsvcp140.dllexports no__std_fs_*function. For files the exe importsDeleteFileW,RemoveDirectoryW,MoveFileExW,CreateFileW,CreateDirectoryW,FindFirstFileWand the CRT'sremove. A call throughGetProcAddressis not ruled out. The run'sreport.jsonhas an emptyvfssection (no redirected writes, no whiteouts). So this fixes a case found by reading the code, not one seen in a game; other titles were not checked.std::filesystem::removereaches the kernelbaseSetFileInformationByHandleexport (only the unit tests andpls_quota, which installs the hooks, cover it).FILE_FLAG_DELETE_ON_CLOSE(andFILE_DISPOSITION_FLAG_ON_CLOSE, passed through), rename by handle, skipping the content copy for aDELETE-only open.prepare_writebehaviour); not tested.vfs::tests::truncate_existing_validation_errorsfails when only thevfstests are run (cargo test -p xcl --release --lib vfs: 21 passed, 1 failed, 3 runs of 3, last error 127 where 5 is expected) and passes in the whole suite. Seen with this PR; reported by the tool as the same without it, which I did not rerun myself. Not touched here.AI use
🤖 Generated with Claude Code
Mirror of xcl-dev#1054 (auto-synced, do not edit).