Skip to content

RT-359: Map remaining UCRT path operations - #5041

Closed
gut0to wants to merge 2 commits into
ItsNotRexed:mainfrom
gut0to:gut0to/rt-359-ucrt-path-operations
Closed

gut0to wants to merge 2 commits into
ItsNotRexed:mainfrom
gut0to:gut0to/rt-359-ucrt-path-operations

Conversation

@gut0to

@gut0to gut0to commented Nov 23, 2026

Copy link
Copy Markdown

Summary

  • route the UCRT remove/rename, _access, _mkdir, _rmdir, and wide variants through the existing console-path overlay
  • map all _stat* and _wstat* layouts to the package/overlay read view while preserving the UCRT ABI and errno
  • add synthetic coverage for package files, overlay mutations, T: scratch paths, traversal refusal, and host-path passthrough

This is stacked on #4996, which provides the shared UCRT open helpers. Once #4996 merges, only commit 14e4c936 remains in this PR's diff.

Testing

  • cmake -S runtime -B runtime/build -A x64
  • cmake --build runtime/build --config RelWithDebInfo --target file_system_test
  • ctest --test-dir runtime/build -C RelWithDebInfo -R '^file_system$' --output-on-failure (1/1 passed)
  • git diff --check

No game files or proprietary data were used. The implementation and tests were AI-assisted and reviewed locally.

Closes RT-359.

TimIdle and others added 2 commits November 23, 2026 15:17
A package DLL linked against the dynamic CRT opens files with fopen or _open
from api-ms-win-crt-stdio-l1-1-0, and ucrtbase's own CreateFileW is the
host's, so a GAME: path reached it as a relative name and the open failed.

The fopen, _fsopen, fopen_s, freopen(_s) and _open, _sopen(_s),
_sopen_dispatch families, narrow and wide, are now shimmed under that api set
and ucrtbase.dll. A console path is mapped with open_target, the CreateFile
rules, using the access and disposition the CRT itself derives from the mode
or the _O_ flags, and ucrtbase's wide function opens the host path, so the
FILE* or descriptor belongs to the CRT the caller reads it with (gta6rt links
the static CRT). Host paths go to ucrtbase unchanged.

Not covered here: the host msvcp140.dll that std::fstream goes through, and
the CRT's other path calls (remove, rename, _stat, _access, _mkdir).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Atomic258

Copy link
Copy Markdown
Contributor

Overlap note for the coordinator: same RT-359 item as #5027 (TimIdle, a1935a7d-era head) — "GAME: paths through the Universal CRT's other path calls". #5027 was just independently verified on Windows: file_system_test → 191 checks, 0 failures on the head; parent segfaults at the new section. Two implementations of the same item — maintainer pick recommended.

AI-assisted (Devin).

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Built and ran file_system_test at 14e4c9362 on Windows 11: 186 checks, 0 failures, exit 0; git diff --check clean.

RT-359 maps the remaining UCRT path operations through the overlay: _wmkdir/_wrmdir/_wchdir/_wgetcwd/_wfullpath/_wstat*/_waccess/_wopen and their A forms resolve GAME: (and the scratch drive) through the same overlay as CreateFileW, so a title that uses the CRT path API sees the packaged files and the overlay instead of the host's literal GAME: folder. docs/runtime_imports.md documents the mapping and the untouched host-path cases. The 175 added lines cover each operation, the above-root refusal and the host path pass-through. No blocking issue.

@gut0to

gut0to commented Nov 23, 2026

Copy link
Copy Markdown
Author

Closing as duplicate of #5027. That PR claimed and implemented RT-359 first and has the broader required surface (_unlink, _access_s, complete errno mapping and the correct filesystem API-set registration). Sorry for the overlap; no project action is needed on this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants