HLE: DirectStorage open_file shares write/delete and keeps LastError #2452
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2452
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@makmatvey on GitHub · 2026-11-25 13:49 UTC · original
makmatvey:cursor/hle-dstorage-open-share-0835→main· +58 −3 · 1 files · 1 commits · openWhat’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).
@oni-swr on GitHub · 2026-11-25 14:13 UTC · original
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.
@Marvisak on GitHub · 2026-11-25 16:00 UTC · original
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
@kotekompotek on GitHub · 2026-11-25 16:52 UTC · original
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.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.