WIP: file_system: MAXIMUM_ALLOWED open of an overlay copy names read+write to the host (FS-MAXIMUM-ALLOWED-WINE) #977

Closed
leonida/mandy
OlaiFG7 wants to merge 0 commits from fix/fs-maximum-allowed-wine into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

OlaiFG7 commented 2026-11-24 16:10:50 +00:00

Claimed in the coordination issue as: FS-MAXIMUM-ALLOWED-WINE (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7136888814)

What and why

Under Wine a handle opened with MAXIMUM_ALLOWED reads but cannot write (finding by milk4sale in #14); Windows grants every right. The file-system shim already treats MAXIMUM_ALLOWED as a write-open and hands the title an overlay copy, but passed the mask to the host unchanged.

  • host_open_access() in runtime/shims/file_system.{h,cpp} adds GENERIC_READ | GENERIC_WRITE to a mask that has MAXIMUM_ALLOWED; other masks are unchanged. Used by the CreateFileW/A and CreateFile2 shims.
  • If the host answers ERROR_ACCESS_DENIED to the widened mask (read-only overlay copy), the open is retried with the title's own mask.
  • runtime/test/file_system_test.cpp: mask checks and a read-only overlay copy check. No game files.

Tested

Not built and not run: the machine used to write this has no C++ toolchain. Draft until file_system_test is built and run on Windows and under Wine.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly
  • One topic
  • No game data, keys or decryption
  • Not a translator rule

🤖 Generated with Claude Code

Claimed in the coordination issue as: FS-MAXIMUM-ALLOWED-WINE (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7136888814) ### What and why Under Wine a handle opened with `MAXIMUM_ALLOWED` reads but cannot write (finding by milk4sale in #14); Windows grants every right. The file-system shim already treats `MAXIMUM_ALLOWED` as a write-open and hands the title an overlay copy, but passed the mask to the host unchanged. - `host_open_access()` in `runtime/shims/file_system.{h,cpp}` adds `GENERIC_READ | GENERIC_WRITE` to a mask that has `MAXIMUM_ALLOWED`; other masks are unchanged. Used by the CreateFileW/A and CreateFile2 shims. - If the host answers `ERROR_ACCESS_DENIED` to the widened mask (read-only overlay copy), the open is retried with the title's own mask. - `runtime/test/file_system_test.cpp`: mask checks and a read-only overlay copy check. No game files. ### Tested **Not built and not run**: the machine used to write this has no C++ toolchain. Draft until `file_system_test` is built and run on Windows and under Wine. GPUs tested: n/a AI-assisted: yes ### Checklist - [ ] Based on current `main` and merges cleanly - [x] One topic - [x] No game data, keys or decryption - [x] Not a translator rule 🤖 Generated with [Claude Code](https://claude.com/claude-code)
morodirule commented 2026-11-24 16:18:59 +00:00

Wine + MinGW check as requested (Arch Linux, x86_64-w64-mingw32-g++, Wine 11.22, static link with test-only _ReturnAddress shims):

Build: the draft head does not compile under MinGW as-is — file_system.cpp still has the unguarded __try (it predates #903). Cherry-picking 93511b1fa applied cleanly with no conflicts, so a rebase onto current main should be trivial; all results below are head + that guard.

Run: file_system_test under Wine: 498 checks, 5 failures (was 496/11 on the same setup without this PR). The 3 new host_open_access checks all pass, the read-only overlay-copy check passes, and all 6 previously-failing MAXIMUM_ALLOWED checks now pass (CreateFileW/A/2 opens + overlay-copy writes). The 5 remaining failures are the pre-existing Wine-environment set, unrelated to this PR: the host ReadFile into uncommitted pages, and 4 long-path listing/deletion cases.

So the fallback works as described on Wine: named read+write gets a writable handle, and the read-only-copy retry path succeeds. Not claiming; verification only.

Wine + MinGW check as requested (Arch Linux, x86_64-w64-mingw32-g++, Wine 11.22, static link with test-only _ReturnAddress shims): Build: the draft head does not compile under MinGW as-is — file_system.cpp still has the unguarded __try (it predates #903). Cherry-picking 93511b1fa applied cleanly with no conflicts, so a rebase onto current main should be trivial; all results below are head + that guard. Run: file_system_test under Wine: 498 checks, 5 failures (was 496/11 on the same setup without this PR). The 3 new host_open_access checks all pass, the read-only overlay-copy check passes, and all 6 previously-failing MAXIMUM_ALLOWED checks now pass (CreateFileW/A/2 opens + overlay-copy writes). The 5 remaining failures are the pre-existing Wine-environment set, unrelated to this PR: the host ReadFile into uncommitted pages, and 4 long-path listing/deletion cases. So the fallback works as described on Wine: named read+write gets a writable handle, and the read-only-copy retry path succeeds. Not claiming; verification only.
aslan2142 commented 2026-12-01 16:32:42 +00:00

Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.
Sign in to join this conversation.
No description provided.