upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/shims/file_system.cpp
diff options
context:
space:
mode:
authorcynbun <74268930+cynbun@users.noreply.github.com>2026-11-23 15:15:23 +0100
committerGitHub <noreply@github.com>2026-11-23 08:15:23 -0600
commit6d55b156e3e0e6a0aade5274688f534d01ad72bc (patch)
treefb8274759ec0cb92138ed0f1616620b9d2286111 /runtime/shims/file_system.cpp
parent9a125c4fb000ac1cb2e4f02f5d74a28fa2105f83 (diff)
file_system test: run to its summary under Wine (RT-451) (#6313)
Squash-merged after review of PR #6313 - file_system test: run to its summary under Wine (RT-451)
Diffstat (limited to 'runtime/shims/file_system.cpp')
-rw-r--r--runtime/shims/file_system.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/runtime/shims/file_system.cpp b/runtime/shims/file_system.cpp
index bc148d12a..995f55a0b 100644
--- a/runtime/shims/file_system.cpp
+++ b/runtime/shims/file_system.cpp
@@ -1227,13 +1227,12 @@ bool fallback_supports(const COPYFILE2_EXTENDED_PARAMETERS* parameters) {
1227} 1227}
1228 1228
1229// CopyFile2 through CopyFileExW, for hosts without it (only for calls fallback_supports). The cancel flag has the 1229// CopyFile2 through CopyFileExW, for hosts without it (only for calls fallback_supports). The cancel flag has the
1230// same type in both; one already set is answered here, since Wine 9's CopyFileExW doesn't read it. A COPYFILE2 1230// same type in both (one already set is answered by copy_file2 before this runs). A COPYFILE2 progress routine has
1231// progress routine has another signature and message set, so it isn't called here. 1231// another signature and message set, so it isn't called here.
1232HRESULT copy_file2_fallback(const wchar_t* source, const wchar_t* destination, 1232HRESULT copy_file2_fallback(const wchar_t* source, const wchar_t* destination,
1233 const COPYFILE2_EXTENDED_PARAMETERS* parameters) { 1233 const COPYFILE2_EXTENDED_PARAMETERS* parameters) {
1234 const DWORD flags = parameters ? parameters->dwCopyFlags & kFallbackPassedFlags : 0; 1234 const DWORD flags = parameters ? parameters->dwCopyFlags & kFallbackPassedFlags : 0;
1235 BOOL* const cancel = parameters ? parameters->pfCancel : nullptr; 1235 BOOL* const cancel = parameters ? parameters->pfCancel : nullptr;
1236 if (cancel && *cancel) return HRESULT_FROM_WIN32(ERROR_REQUEST_ABORTED);
1237 if (::CopyFileExW(source, destination, nullptr, nullptr, cancel, flags)) return S_OK; 1236 if (::CopyFileExW(source, destination, nullptr, nullptr, cancel, flags)) return S_OK;
1238 const DWORD error = GetLastError(); 1237 const DWORD error = GetLastError();
1239 return HRESULT_FROM_WIN32(error ? error : ERROR_GEN_FAILURE); 1238 return HRESULT_FROM_WIN32(error ? error : ERROR_GEN_FAILURE);
@@ -1255,6 +1254,10 @@ HRESULT WINAPI copy_file2(PCWSTR from, PCWSTR to, COPYFILE2_EXTENDED_PARAMETERS*
1255 std::filesystem::path source, destination; 1254 std::filesystem::path source, destination;
1256 DWORD error = 0; 1255 DWORD error = 0;
1257 if (!copy_paths(from, to, fail_if_exists, source, destination, error)) return HRESULT_FROM_WIN32(error); 1256 if (!copy_paths(from, to, fail_if_exists, source, destination, error)) return HRESULT_FROM_WIN32(error);
1257 // A cancel flag already set is answered here, for the host's CopyFile2 as well as the fallback: Windows returns
1258 // ERROR_REQUEST_ABORTED and writes nothing, while Wine reads the flag in neither call (Wine 11.20's CopyFile2 logs
1259 // "pfCancel is not supported" and copies, dlls/kernelbase/file.c copy_file; Wine 9 has only CopyFileExW).
1260 if (parameters && parameters->pfCancel && *parameters->pfCancel) return HRESULT_FROM_WIN32(ERROR_REQUEST_ABORTED);
1258 if (host) return host(source.c_str(), destination.c_str(), parameters); 1261 if (host) return host(source.c_str(), destination.c_str(), parameters);
1259 return copy_file2_fallback(source.c_str(), destination.c_str(), parameters); 1262 return copy_file2_fallback(source.c_str(), destination.c_str(), parameters);
1260} 1263}