Commit 02faaea9 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

kernelbase: Reset last error on success in CopyFileExW().

parent d72d5960
......@@ -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());
......
......@@ -588,6 +588,7 @@ done:
HeapFree( GetProcessHeap(), 0, buffer );
CloseHandle( h1 );
CloseHandle( h2 );
if (ret) SetLastError( 0 );
return ret;
}
......
......@@ -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");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment