HLE: DirectStorage open_file shares write/delete and keeps LastError #2450
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2452"
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 Marvisak/VIctory. Originally posted by makmatvey on 2026-11-25T13:49:23Z.
What’s wrong
IDStorageFactoryX::OpenFileopened withFILE_SHARE_READonly. A path already held open for write (share read|write) then failed withERROR_SHARING_VIOLATION. On failure, the path was also turned into aStringbeforelast_os_error(), so a heap allocation could overwriteGetLastErrorand the returnedHRESULT_FROM_WIN32was wrong (VIC-BT-037 in #1249).What the change does
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETEtoCreateFileW.std::io::Error::last_os_error()immediately after a failed open, before any heap work for the path string.Tests
opens_alongside_a_writer_and_keeps_not_found— opens while another handle holds the file for write; missing path returnsHRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND).cargo xtask policy(pass). Fullvictory-hletests need Windows CI.Asset policy
No game data used.
Fixes part of #1249 (VIC-BT-037).
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T13:55:22Z.
Review: APPROVED
Verified against
origin/main(940d32f):LastErroris clean and well-tested.cargo test -p victory-hle dstorage::: 15/15 passed (includingopens_alongside_a_writer_and_keeps_not_found).cargo clippy -p victory-hle --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 183 files ok.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T14:11:24Z.
Review: COMMENTED
HLE DirectStorage open_file shares write/delete, keeps LastError. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.
Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T14:13:04Z.
Independent verification of #2452 at
67ea174(pure CPU)Commands:
cargo test -p victory-hle --lib,cargo clippy -p victory-hle --all-targets -- -D warnings,cargo xtask policy; merges cleanly withorigin/main940d32f.dstorage.rsreverted toorigin/mainwith the new test kept ->opens_alongside_a_writer_and_keeps_not_foundFAILS.std::os::windows), like the surrounding module.AI-assisted verification by Claude Code (Claude Sonnet 5.5). No game files, dumps or hashes.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T16:00:46Z.
Automated triage for the maintainers.
Needs work. In
open_file(crates/victory-hle/src/modules/dstorage.rs), keeping the error from the failed open is fine, but the wider sharing flags change what the title sees and come with no evidence of the console's behaviour (public documentation, or a title code path that needs it). Please add that evidence, or split the error part into its own PR. CI: passing.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T16:52:36Z.
Both parts are real fixes:
FILE_SHARE_WRITE|DELETElets DirectStorage open a file another handle already holds for write (ERROR_SHARING_VIOLATION was fatal here), and capturinglast_os_errorbeforefrom_utf16_lossy's allocation is the right order — an intervening heap call can clobber LastError. The test exercises exactly the writer-held-open case that previously failed.Pull request closed