Skip to content

Commit 4f7f523

Browse files
committed
[KERNEL32_WINETEST] Add some ReactOS-specific tests for CopyFileEx
Cover the fix in PR reactos#9133 / CORE-20647.
1 parent 529f3c6 commit 4f7f523

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

  • modules/rostests/winetests/kernel32

‎modules/rostests/winetests/kernel32/file.c‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,52 @@ static void test_CopyFileEx(void)
12371237
ok(!retok, "CopyFileExA unexpectedly succeeded\n");
12381238
ok(GetLastError() == ERROR_PATH_NOT_FOUND, "expected ERROR_PATH_NOT_FOUND, got %ld\n", GetLastError());
12391239

1240+
#ifdef __REACTOS__
1241+
/* Cover ReactOS bug in CORE-20647 */
1242+
retok = CopyFileExA(source, dest, NULL, NULL, FALSE, 0);
1243+
ok(retok, "CopyFileExA unexpectedly failed\n");
1244+
ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", GetLastError());
1245+
1246+
retok = CopyFileExA(source, dest, NULL, NULL, FALSE, 0);
1247+
ok(retok, "CopyFileExA unexpectedly failed\n");
1248+
ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", GetLastError());
1249+
1250+
DeleteFileA(dest);
1251+
1252+
retok = CopyFileExA(source, dest, NULL, NULL, FALSE, COPY_FILE_FAIL_IF_EXISTS);
1253+
ok(retok, "CopyFileExA unexpectedly failed\n");
1254+
ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", GetLastError());
1255+
1256+
retok = CopyFileExA(source, dest, NULL, NULL, FALSE, COPY_FILE_FAIL_IF_EXISTS);
1257+
ok(!retok, "CopyFileExA unexpectedly succeeded\n");
1258+
ok(GetLastError() == ERROR_FILE_EXISTS, "expected ERROR_FILE_EXISTS, got %ld\n", GetLastError());
1259+
1260+
retok = CopyFileExA(source, dest, NULL, NULL, FALSE, COPY_FILE_RESTARTABLE);
1261+
ok(retok, "CopyFileExA unexpectedly failed\n");
1262+
ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", GetLastError());
1263+
1264+
retok = CopyFileExA(source, dest, NULL, NULL, FALSE, COPY_FILE_ALLOW_DECRYPTED_DESTINATION);
1265+
ok(retok, "CopyFileExA unexpectedly failed\n");
1266+
ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", GetLastError());
1267+
1268+
retok = CopyFileExA(source, dest, NULL, NULL, FALSE, COPY_FILE_RESTARTABLE | COPY_FILE_ALLOW_DECRYPTED_DESTINATION);
1269+
ok(retok, "CopyFileExA unexpectedly failed\n");
1270+
ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", GetLastError());
1271+
1272+
retok = CopyFileExA(source, dest, NULL, NULL, FALSE, COPY_FILE_FAIL_IF_EXISTS | COPY_FILE_RESTARTABLE);
1273+
ok(!retok, "CopyFileExA unexpectedly succeeded\n");
1274+
ok(GetLastError() == ERROR_FILE_EXISTS, "expected ERROR_FILE_EXISTS, got %ld\n", GetLastError());
1275+
1276+
retok = CopyFileExA(source, dest, NULL, NULL, FALSE, COPY_FILE_FAIL_IF_EXISTS | COPY_FILE_ALLOW_DECRYPTED_DESTINATION);
1277+
ok(!retok, "CopyFileExA unexpectedly succeeded\n");
1278+
ok(GetLastError() == ERROR_FILE_EXISTS, "expected ERROR_FILE_EXISTS, got %ld\n", GetLastError());
1279+
1280+
retok = CopyFileExA(source, dest, NULL, NULL, FALSE, COPY_FILE_FAIL_IF_EXISTS | COPY_FILE_RESTARTABLE | COPY_FILE_ALLOW_DECRYPTED_DESTINATION);
1281+
ok(!retok, "CopyFileExA unexpectedly succeeded\n");
1282+
ok(GetLastError() == ERROR_FILE_EXISTS, "expected ERROR_FILE_EXISTS, got %ld\n", GetLastError());
1283+
1284+
DeleteFileA(dest);
1285+
#endif
12401286
ret = DeleteFileA(source);
12411287
ok(ret, "DeleteFileA failed with error %ld\n", GetLastError());
12421288
ret = DeleteFileA(dest);

0 commit comments

Comments
 (0)