VFS: report existing game files on CREATE_ALWAYS #155

Merged
ebarr24 merged 1 commit from upstream-pr/158 into main 2026-11-23 21:08:36 +00:00
ebarr24 commented 2026-11-23 17:47:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ebarr24 on 2026-11-23T17:47:25Z.


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.

<!-- greyfinch-sync:ivall/xcl:issue:6565347151 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/158). Originally posted by [ebarr24](https://github.com/ebarr24) on 2026-11-23T17:47:25Z. --- 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.
upstream-sync closed this pull request 2026-11-24 06:57:26 +00:00
ivall commented 2026-11-24 07:04:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ivall on 2026-11-23T21:09:06Z.


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).

<!-- greyfinch-sync:ivall/xcl:comment:7114074015 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/158#issuecomment-7114074015). Originally posted by [ivall](https://github.com/ivall) on 2026-11-23T21:09:06Z. --- 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).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!155
No description provided.