Preserve Win32 errors from DirectStorage OpenFile #1383

Closed
github-bot wants to merge 2 commits from gh-pr/1383/head into gh-pr/1383/base
Owner

@⁠EatCodeSleep2 on GitHub · 2026-11-24 17:40 UTC · original
EatCodeSleep2:fix/preserve-dstorage-open-error-1249 → main · +37 −4 · 2 files · 2 commits · closed without merging

Addresses VIC-BT-037 in #1249. Capture the host error before decoding the path for the DirectStorage log. Preserve the host thread error around disposal of the translated path in CreateFileW so virtual-drive opens report the same error as direct opens. Keep the documented read access and sharing mode.

Added a factory-vtable test checking the distinct HRESULTs for a missing file and missing parent directory. All 95 victory-hle library tests pass on Windows.

**@⁠EatCodeSleep2** on GitHub · 2026-11-24 17:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/1383) `EatCodeSleep2:fix/preserve-dstorage-open-error-1249` → `main` · +37 −4 · 2 files · 2 commits · closed without merging Addresses VIC-BT-037 in #1249. Capture the host error before decoding the path for the DirectStorage log. Preserve the host thread error around disposal of the translated path in CreateFileW so virtual-drive opens report the same error as direct opens. Keep the documented read access and sharing mode. Added a factory-vtable test checking the distinct HRESULTs for a missing file and missing parent directory. All 95 victory-hle library tests pass on Windows.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:29:44 +00:00
github-bot closed this pull request 2026-11-26 04:29:44 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 02:37 UTC · original

Automated triage for the maintainers. Recommended for a maintainer's look: open_file in crates/victory-hle/src/modules/dstorage.rs now captures the last OS error right after CreateFileW, before allocating the path string for the log, and CreateFileW in files.rs saves and restores the thread's last error around dropping the translated virtual-drive path. Win32 does not promise that heap calls leave the last error alone, so reading it first is the correct order; the change is small and uses windows-sys features already enabled. Note that the new test (missing file -> 0x80070002, missing directory -> 0x80070003) most likely passes on main too, so it pins the behaviour rather than reproducing a failure. CI passes.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 02:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/1383#issuecomment-7150963866) <!-- victory-triage v1 head=a613b9e81b1de2fb8aea8586de05a9948114a7a0 verdict=merge-candidate at=2026-11-25T02:20:29Z --> Automated triage for the maintainers. Recommended for a maintainer's look: `open_file` in `crates/victory-hle/src/modules/dstorage.rs` now captures the last OS error right after `CreateFileW`, before allocating the path string for the log, and `CreateFileW` in `files.rs` saves and restores the thread's last error around dropping the translated virtual-drive path. Win32 does not promise that heap calls leave the last error alone, so reading it first is the correct order; the change is small and uses `windows-sys` features already enabled. Note that the new test (missing file -> 0x80070002, missing directory -> 0x80070003) most likely passes on main too, so it pins the behaviour rather than reproducing a failure. CI passes. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 22:00 UTC · original

Automated triage for the maintainers, second look (a review against current main, with builds and tests where they could change the verdict).

Closing because it changes no behaviour. Between CreateFileW and the error read there is only a successful heap allocation and free, which do not set the thread's last error, so main already returns the same HRESULT: with both source files put back to main and only the new test kept, open_file_preserves_win32_error still passes.

If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 22:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/1383#issuecomment-7175824135) Automated triage for the maintainers, second look (a review against current `main`, with builds and tests where they could change the verdict). Closing because it changes no behaviour. Between `CreateFileW` and the error read there is only a successful heap allocation and free, which do not set the thread's last error, so `main` already returns the same HRESULT: with both source files put back to `main` and only the new test kept, `open_file_preserves_win32_error` still passes. If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1383
No description provided.