hle(host_posix): the file calls a title manages its saves with (MoveFileW, CopyFileW, ReplaceFileW, GetFileType, CreateFileMappingA) are stubs #627
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS#627
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@AnastasisKon on GitHub · 2026-11-28 15:54 UTC · original
Summary
Five file calls a title makes when it manages its own files were unimplemented and answered through the loader's import stub:
MoveFileW,CopyFileW,ReplaceFileW,GetFileTypeandCreateFileMappingA.The first three are how a title writes a save file without leaving a half-written one: write a new file, copy the old one to a backup, then replace. With stubs, every one of those steps silently failed, and a title that checks the return value gives up on saving (or worse, saves nothing and reports success to the wrong layer).
GetFileTypeis what a title asks before reading or seeking a handle, andCreateFileMappingAis the ANSI form of the mapping added in #623.What the change does
MoveFileW: the plain form ofMoveFileExW.CopyFileW: copies the bytes;FAIL_IF_EXISTSon an existing target isERROR_FILE_EXISTS, otherwise the copy replaces what was there. A missing source isERROR_FILE_NOT_FOUND.ReplaceFileW: gives the backup the file being replaced, then the replacement takes its name, which is the order Windows uses.GetFileType: reads the handle's own node — a disk, a character device (a console,/dev/null), or a pipe (a fifo or a socket) — andERROR_INVALID_HANDLEwithFILE_TYPE_UNKNOWNfor a handle that is no handle.CreateFileMappingA: the ANSI form ofCreateFileMappingW; a section name is not a path, so it is widened byte by byte rather than through the drive table.Tests
Three new ones in
files.rs: a file is copied (including theFAIL_IF_EXISTSrefusal and the replace-with-backup order) and moved; a file handle is a disk,/dev/nullis a character device and a garbage handle is unknown with its error; and the ANSI mapping form makes a section that maps and unmaps like the wide one.One thing the tests taught me and the code now says: the standard handles are not asserted on. This suite's stdout is a pipe when cargo pipes it and a file when it is redirected, and
FILE_TYPE_PIPEandFILE_TYPE_DISKare both right for the handle in those cases — a test that insisted on one of them failed the gate while passing when run by hand.@AnastasisKon on GitHub · 2026-11-28 15:54 UTC · original
/claim
@github-actions[bot] on GitHub · 2026-11-28 15:54 UTC · original
Claimed by @AnastasisKon. Open a draft pull request with
Refs #623in its description within 24 hours, or the claim expires.@AnastasisKon on GitHub · 2026-11-28 16:31 UTC · original
Merged with the PR that serves these calls; closing.