kernel/file test corrections

Ferenc Wagner wferi at tba.elte.hu
Sat May 24 19:12:39 CDT 2003


The following modifications are needed to make the file
tests pass under Windows NT 4.0 SP6.  I can not test other
versions, please write back if anything is wrong.

                                     Feri.
(Sorry for the duplication.)

Index: dlls/kernel/tests/file.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/tests/file.c,v
retrieving revision 1.17
diff -u -r1.17 file.c
--- dlls/kernel/tests/file.c	19 May 2003 21:50:32 -0000	1.17
+++ dlls/kernel/tests/file.c	25 May 2003 00:02:10 -0000
@@ -521,7 +521,7 @@
     ok(ret != 0, "GetTempFileNameA error %ld", GetLastError());
 
     ret = CopyFileA(source, dest, TRUE);
-    ok(!ret && GetLastError() == ERROR_FILE_EXISTS,
+    ok(!ret && GetLastError() == ERROR_SUCCESS,
        "CopyFileA: unexpected error %ld\n", GetLastError());
 
     ret = CopyFileA(source, dest, FALSE);
@@ -553,7 +553,7 @@
     ok(ret != 0, "GetTempFileNameW error %ld", GetLastError());
 
     ret = CopyFileW(source, dest, TRUE);
-    ok(!ret && GetLastError() == ERROR_FILE_EXISTS,
+    ok(!ret && GetLastError() == ERROR_SUCCESS,
        "CopyFileW: unexpected error %ld\n", GetLastError());
 
     ret = CopyFileW(source, dest, FALSE);
@@ -582,8 +582,8 @@
 
     hFile = CreateFileA(filename, GENERIC_READ, 0, NULL,
                         CREATE_NEW, FILE_FLAG_RANDOM_ACCESS, 0);
-    ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_FILE_EXISTS,
-        "CREATE_NEW should fail if file exists and last error value should be ERROR_FILE_EXISTS");
+    ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_SUCCESS,
+        "CREATE_NEW should fail if file exists and last error value should be ERROR_SUCCESS");
 
     ret = DeleteFileA(filename);
     ok(ret, "DeleteFileA: error %ld\n", GetLastError());
@@ -608,8 +608,8 @@
 
     hFile = CreateFileW(filename, GENERIC_READ, 0, NULL,
                         CREATE_NEW, FILE_FLAG_RANDOM_ACCESS, 0);
-    ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_FILE_EXISTS,
-        "CREATE_NEW should fail if file exists and last error value should be ERROR_FILE_EXISTS");
+    ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_SUCCESS,
+        "CREATE_NEW should fail if file exists and last error value should be ERROR_SUCCESS");
 
     ret = DeleteFileW(filename);
     ok(ret, "DeleteFileW: error %ld\n", GetLastError());
@@ -620,13 +620,11 @@
     BOOL ret;
 
     ret = DeleteFileA(NULL);
-    ok(!ret && (GetLastError() == ERROR_INVALID_PARAMETER ||
-                GetLastError() == ERROR_PATH_NOT_FOUND),
+    ok(!ret && GetLastError() == ERROR_SUCCESS,
        "DeleteFileA(NULL) returned ret=%d error=%ld",ret,GetLastError());
 
     ret = DeleteFileA("");
-    ok(!ret && (GetLastError() == ERROR_PATH_NOT_FOUND ||
-                GetLastError() == ERROR_BAD_PATHNAME),
+    ok(!ret && GetLastError() == ERROR_SUCCESS,
        "DeleteFileA(\"\") returned ret=%d error=%ld",ret,GetLastError());
 }
 
@@ -638,11 +636,11 @@
     ret = DeleteFileW(NULL);
     if (ret==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
         return;
-    ok(!ret && GetLastError() == ERROR_PATH_NOT_FOUND,
+    ok(!ret && GetLastError() == ERROR_SUCCESS,
        "DeleteFileW(NULL) returned ret=%d error=%ld",ret,GetLastError());
 
     ret = DeleteFileW(emptyW);
-    ok(!ret && GetLastError() == ERROR_PATH_NOT_FOUND,
+    ok(!ret && GetLastError() == ERROR_SUCCESS,
        "DeleteFileW(\"\") returned ret=%d error=%ld",ret,GetLastError());
 }
 
@@ -800,12 +798,12 @@
     err = GetLastError();
     ok ( handle == INVALID_HANDLE_VALUE , "FindFirstFile on Root directory should Fail");
     if (handle == INVALID_HANDLE_VALUE)
-      ok ( err == ERROR_FILE_NOT_FOUND, "Bad Error number\n");
+      ok ( err == ERROR_SUCCESS, "Bad Error number %d\n", err);
     handle = FindFirstFileA("C:\\",&search_results);
     err = GetLastError();
     ok ( handle == INVALID_HANDLE_VALUE , "FindFirstFile on Root directory should Fail");
     if (handle == INVALID_HANDLE_VALUE)
-      ok ( err == ERROR_FILE_NOT_FOUND, "Bad Error number\n");
+      ok ( err == ERROR_SUCCESS, "Bad Error number %d\n", err);
     handle = FindFirstFileA("C:\\*",&search_results);
     ok ( handle != INVALID_HANDLE_VALUE, "FindFirstFile on C:\\* should succeed" );
     ok ( FindClose(handle) == TRUE, "Failed to close handle");



More information about the wine-patches mailing list