VFS: report existing game files on CREATE_ALWAYS #158

Manually merged
github merged 1 commit from gh-pr/158/head into gh-pr/158/base 2026-11-26 04:13:03 +00:00
Owner

@⁠ebarr24 on GitHub · 2026-11-23 17:47 UTC · original
ebarr24:fix/vfs-create-always-last-error → main · +107 −29 · 2 files · 1 commits · merged 2026-11-23 21:08 UTC

When CREATE_ALWAYS overwrites an existing file, Win32 returns a valid handle and sets GetLastError() to ERROR_ALREADY_EXISTS (183). XCL's first overwrite of a game file creates a new physical overlay file. That open succeeds with last error 0, so the title sees the file as newly created. Win32 CreateFileW contract

The CreateFileW, CreateFileA, and CreateFile2 hooks share the same open decision. When a visible original file has no overlay entry, report ERROR_ALREADY_EXISTS after the redirected overwrite succeeds. The test covers the first overwrite, an existing overlay file, a new path, and a previously deleted path. It checks the original bytes and verifies that a native open failure preserves its error.

Verification

On Windows 11 25H2 (26200.9711), Rust 1.100.0 x86_64-pc-windows-gnu, RTX 3080 (driver 616.92), and DXC 1.9.2609.5:

cargo build --locked --workspace
cargo test --locked -p xcl create_always_reports_existing_game_file -- --test-threads=4
  • With the regression harness on base db5dc26, overwriting a game file for the first time succeeds with 0 instead of 183.
  • On 323767f the regression passes.
  • The full workspace suite on 9f1a048 with the independent fixture test fix reported 569 passes, zero failures and 39 ignored. Two native-wave64 tests and the unconfigured retail-sample tests returned early. Fixture test fix #157

AI-assisted patch preparation and verification.

**@⁠ebarr24** on GitHub · 2026-11-23 17:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/158) `ebarr24:fix/vfs-create-always-last-error` → `main` · +107 −29 · 2 files · 1 commits · merged 2026-11-23 21:08 UTC When `CREATE_ALWAYS` overwrites an existing file, Win32 returns a valid handle and sets `GetLastError()` to `ERROR_ALREADY_EXISTS` (183). XCL's first overwrite of a game file creates a new physical overlay file. That open succeeds with last error `0`, so the title sees the file as newly created. [Win32 CreateFileW contract](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew) The `CreateFileW`, `CreateFileA`, and `CreateFile2` hooks share the same open decision. When a visible original file has no overlay entry, report `ERROR_ALREADY_EXISTS` after the redirected overwrite succeeds. The test covers the first overwrite, an existing overlay file, a new path, and a previously deleted path. It checks the original bytes and verifies that a native open failure preserves its error. ## Verification On Windows 11 25H2 (26200.9711), Rust 1.100.0 `x86_64-pc-windows-gnu`, RTX 3080 (driver 616.92), and DXC 1.9.2609.5: ```powershell cargo build --locked --workspace cargo test --locked -p xcl create_always_reports_existing_game_file -- --test-threads=4 ``` - With the regression harness on base `db5dc26`, overwriting a game file for the first time succeeds with `0` instead of `183`. - On `323767f` the regression passes. - The full workspace suite on `9f1a048` with the independent fixture test fix reported 569 passes, zero failures and 39 ignored. Two native-wave64 tests and the unconfigured retail-sample tests returned early. [Fixture test fix #157](https://github.com/ivall/xcl/pull/157) AI-assisted patch preparation and verification.
The first overwrite of a visible game file creates a new overlay file, so the native open reports success with a zero last error. Preserve ERROR_ALREADY_EXISTS for the title after a successful redirected open.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:13:02 +00:00
github manually merged commit 323767f4d4 into gh-pr/158/base 2026-11-26 04:13:03 +00:00
Author
Owner

@⁠ivall on GitHub · 2026-11-23 21:09 UTC · original

Merged (main 6da33fa). Checked on an RX 9070 (RDNA4) with the 22 PRs merged together on main eaa36b6: cargo build --workspace && cargo test --workspace -- --test-threads=4 - 582 unit tests passed, 0 failed (20 ignored), the integration and e2e tests passed too; and the retail game still reaches its first menu (646 frames in 30 s, no device removal).

**@⁠ivall** on GitHub · 2026-11-23 21:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/158#issuecomment-7114074015) Merged (main 6da33fa). Checked on an RX 9070 (RDNA4) with the 22 PRs merged together on main eaa36b6: `cargo build --workspace && cargo test --workspace -- --test-threads=4` - 582 unit tests passed, 0 failed (20 ignored), the integration and e2e tests passed too; and the retail game still reaches its first menu (646 frames in 30 s, no device removal).
This discussion has been locked. Commenting is limited to contributors.
No description provided.