[PATCH v2 2/4] kernel32/tests: Correct ReplaceFileW error checking

Brock York twunknown at gmail.com
Thu Aug 30 06:01:13 CDT 2018


Check that ReplaceFileW returned 0 indicating
failure and that the error code was access denied.
This corrects the error checking for the test case
where ReplaceFileW should fail with ACCESS_DENIED
on a file with the READ_ONLY attribute set.

Tested on a Windows 10 and Windows XP vm and
also passed on all vm's on the wine test bot

Signed-off-by: Brock York <twunknown at gmail.com>
---
 dlls/kernel32/tests/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index d496e9273b..8e4a994142 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -3666,7 +3666,7 @@ static void test_ReplaceFileA(void)
      */
     SetLastError(0xdeadbeef);
     ret = pReplaceFileA(replaced, replacement, backup, 0, 0, 0);
-    ok(ret != ERROR_UNABLE_TO_REMOVE_REPLACED, "ReplaceFileA: unexpected error %d\n", GetLastError());
+    ok(ret == 0 && GetLastError() == ERROR_ACCESS_DENIED, "ReplaceFileA: unexpected error %d\n", GetLastError());
     /* make sure that the replacement file still exists */
     hReplacementFile = CreateFileA(replacement, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
     ok(hReplacementFile != INVALID_HANDLE_VALUE ||
-- 
2.18.0




More information about the wine-devel mailing list