Signed-off-by: Paul Gofman pgofman@codeweavers.com --- v2: - added patch.
dlls/kernel32/tests/file.c | 7 +++++++ dlls/kernelbase/file.c | 1 + dlls/msvcp140/tests/msvcp140.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c index 4f8fb92c96b..485ed9e7d30 100644 --- a/dlls/kernel32/tests/file.c +++ b/dlls/kernel32/tests/file.c @@ -899,8 +899,15 @@ static void test_CopyFileW(void) ok(!ret && GetLastError() == ERROR_FILE_EXISTS, "CopyFileW: unexpected error %ld\n", GetLastError());
+ SetLastError(0xdeadbeef); ret = CopyFileW(source, dest, FALSE); ok(ret, "CopyFileW: error %ld\n", GetLastError()); + ok(GetLastError() == ERROR_SUCCESS, "Unexpected error %lu.\n", GetLastError()); + + SetLastError(0xdeadbeef); + ret = CopyFileExW(source, dest, NULL, NULL, NULL, 0 ); + ok(ret, "CopyFileExW: error %ld\n", GetLastError()); + ok(GetLastError() == ERROR_SUCCESS, "Unexpected error %lu.\n", GetLastError());
ret = DeleteFileW(source); ok(ret, "DeleteFileW: error %ld\n", GetLastError()); diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c index faf8fa42969..0b1656ac4bf 100644 --- a/dlls/kernelbase/file.c +++ b/dlls/kernelbase/file.c @@ -588,6 +588,7 @@ done: HeapFree( GetProcessHeap(), 0, buffer ); CloseHandle( h1 ); CloseHandle( h2 ); + if (ret) SetLastError( 0 ); return ret; }
diff --git a/dlls/msvcp140/tests/msvcp140.c b/dlls/msvcp140/tests/msvcp140.c index 423c4c652b9..1df2f058424 100644 --- a/dlls/msvcp140/tests/msvcp140.c +++ b/dlls/msvcp140/tests/msvcp140.c @@ -1619,7 +1619,7 @@ static void test_Copy_file(void) SetLastError(0xdeadbeef); ret = p_Copy_file(L"wine_test_dir/f1", L"wine_test_dir/f3"); ok(ret == ERROR_SUCCESS, "Got unexpected ret %lu.\n", ret); - todo_wine ok(GetLastError() == ret, "Got unexpected err %lu.\n", GetLastError()); + ok(GetLastError() == ret, "Got unexpected err %lu.\n", GetLastError());
SetLastError(0xdeadbeef); ret = p_Copy_file(L"wine_test_dir/missing", L"wine_test_dir/f3");