mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 20:08:37 +00:00
Review on #3655 (kacper-serewis, daemosofchaos, on Windows 11): - A parameter block shorter than COPYFILE2_EXTENDED_PARAMETERS (dwSize 0, 4, 31) made the fallback copy and return S_OK, where the host's CopyFile2 returns E_INVALIDARG and writes nothing. Both paths now check it first, before copy_paths prepares the destination. - The fallback silently dropped COPY_FILE_SKIP_ALTERNATE_STREAMS and copied the stream. Its flags are now sorted: passed on (the ones both calls define), dropped (requests that leave the contents as CopyFileExW writes them: no offload, compressed traffic, sparse copy, ...), or refused with ERROR_NOT_SUPPORTED before anything is written (SKIP_ALTERNATE_STREAMS, DIRECTORY, OPEN_AND_COPY_REPARSE_POINT, IGNORE_SOURCE_ENCRYPTION, unknown bits, a longer V2 block). - A cancel flag already set is answered by the fallback itself, since Wine 9's CopyFileExW doesn't read it. rt::fs::force_copy_file2_fallback lets the test run the fallback on Windows, where the host has CopyFile2 (Maraco91 noted it couldn't be reached there). file_system_test runs its CopyFile2 checks both ways: no block, short blocks, fail-if-exists with a hint flag, a set cancel flag, and in the fallback the refused flags and block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GN11jcpJWD4phrXJyDgED6
35 lines
1.9 KiB
C++
35 lines
1.9 KiB
C++
// Console (GDK) file paths for a mapped title.
|
|
//
|
|
// A title's file API sees the console's drives: "GAME:\\data\\shaders\\x.sps" is a file inside the installed game
|
|
// folder. ivall/xcl (GPL-2.0-only; facts only here) documents for Xbox Series GDK titles that GAME: names the game
|
|
// folder and that writes go to a writable overlay rather than to the package, which is read-only. gta6rt does the
|
|
// same:
|
|
// GAME:<rest> a read opens the overlay copy when one exists, else <game dir>\<rest>;
|
|
// an open that can write opens <overlay dir>\<rest>, copying the package file there first when the
|
|
// disposition keeps its contents, so the package is never modified;
|
|
// a delete leaves a marker in the overlay instead of removing a package file.
|
|
// anything else is a host path and is passed through unchanged.
|
|
// A GAME: path that climbs above the root with ".." or names another drive is refused with ERROR_INVALID_NAME.
|
|
//
|
|
// The shims that use this live in file_system.cpp: CreateFile*, FindFirstFile*/FindNextFile*/FindClose,
|
|
// GetFileAttributes*/GetFileAttributesEx*, DeleteFile*, CreateDirectory*/RemoveDirectory*, MoveFile*/MoveFileEx*,
|
|
// CopyFile*/CopyFileEx*/CopyFile2 and SetFileAttributes* (the rules for each are in docs/runtime_imports.md).
|
|
#pragma once
|
|
|
|
#include <filesystem>
|
|
|
|
namespace rt::fs {
|
|
|
|
// Sets the roots. main.cpp calls this once, before anything is mapped; the test calls it per case. The overlay is
|
|
// created on the first write, not here.
|
|
void configure(const std::filesystem::path& game_dir, const std::filesystem::path& overlay_dir);
|
|
|
|
std::filesystem::path game_dir();
|
|
std::filesystem::path overlay_dir();
|
|
|
|
// For tests: true makes the CopyFile2 shim use its CopyFileExW fallback even where the host has CopyFile2, so the
|
|
// path Wine 9 takes can be checked on Windows. Off by default; main.cpp never sets it.
|
|
void force_copy_file2_fallback(bool force);
|
|
|
|
} // namespace rt::fs
|