write_target cleared the delete marker before the host CreateFileW ran, and copied a package file up
without looking at the marker, so a write-open of a deleted name could make it readable again: an
OPEN_EXISTING open succeeded on the copy-up, and one that failed left the marker gone with the package
file visible behind it.
The marker is now never removed, and a tombstoned name is never copied up. Reads and listings prefer an
overlay copy, so a re-created file is visible without clearing anything, while an open that keeps the
contents (OPEN_EXISTING, TRUNCATE_EXISTING) fails with ERROR_FILE_NOT_FOUND and leaves the name deleted.
file_system asserts that sequence: the failed write-open, no overlay copy, and the name still gone.
Review pass over the rest of the shim: Target loses the two fields nothing read, FindFirstFile no longer
parses its pattern twice, collect drops its unreachable non-console branch, and the enumeration states are
unique_ptr entries looked up under the lock instead of raw pointers handed out of it.
A mapped title names its files on the console's drives, but nothing mapped them: the file calls went
straight to the host and --game-dir was only used to find modules, so the first file a title opens at boot
would fail. New shims for CreateFile*, FindFirstFile*/FindNextFile*/FindClose, GetFileAttributes*/
GetFileAttributesEx* and DeleteFile* (kernel32, kernelbase and the api-ms-win-core-file sets) map a GAME:
path under --game-dir, and send every open that can write and every delete to --overlay (default
<game-dir>\overlay), which reads and listings prefer. A write-open copies the package file into the overlay
first, so OPEN_EXISTING keeps its bytes, and a delete of a package file leaves a marker instead of removing
it, so the package is never modified. A path that climbs above GAME: with ".." or names another drive is
refused with ERROR_INVALID_NAME. A path without the prefix is still a host path.
The prefixes and the overlay come from ivall/xcl (GPL-2.0-only), as facts only, no code.
file_system ctest: 43 checks over folders in %TEMP%, covering mapping and case, copy-up and read
preference, a new file in folders the package lacks, delete and re-create, the merged listing, host-path
passthrough, the escape refusal and the narrow variants.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>