Better fix for SoftICE detection

Mike Hearn mike at navi.cx
Tue Jul 6 15:33:31 CDT 2004


Mike Hearn <mike at navi.cx>
Correct error code returned by CreateFile when given a 
non-existant VxD on NT, add a test case.

Index: dlls/kernel/vxd.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/vxd.c,v
retrieving revision 1.13
diff -u -p -r1.13 vxd.c
--- dlls/kernel/vxd.c   1 May 2004 05:25:08 -0000       1.13
+++ dlls/kernel/vxd.c   6 Jul 2004 20:30:08 -0000
@@ -182,7 +182,7 @@ HANDLE VXD_Open( LPCWSTR filenameW, DWOR
  
     if (!(GetVersion() & 0x80000000))  /* there are no VxDs on NT */
     {
-        SetLastError( ERROR_INVALID_PARAMETER );
+        SetLastError( ERROR_FILE_NOT_FOUND );
         return 0;
     }
  
Index: dlls/kernel/tests/file.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/tests/file.c,v
retrieving revision 1.40
diff -u -p -r1.40 file.c
--- dlls/kernel/tests/file.c    25 May 2004 00:20:50 -0000      1.40
+++ dlls/kernel/tests/file.c    6 Jul 2004 20:30:11 -0000
@@ -637,6 +637,7 @@ static void test_CreateFileW(void)
     WCHAR filename[MAX_PATH];
     static const WCHAR emptyW[]={'\0'};
     static const WCHAR prefix[] = {'p','f','x',0};
+    static const WCHAR bogus[] = { '\\', '\\', '.', '\\', 'B', 'O', 'G', 'U', 'S', 0 };
     DWORD ret;
  
     ret = GetTempPathW(MAX_PATH, temp_path);
@@ -665,6 +666,15 @@ static void test_CreateFileW(void)
                         CREATE_NEW, FILE_FLAG_RANDOM_ACCESS, 0);
     ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND,
        "CreateFileW(\"\") returned ret=%p error=%ld\n",hFile,GetLastError());
+
+    if (!(GetVersion() & 0x80000000)) {
+        /* test the result of opening a non-existant driver name on NT */
+        CreateFileW(bogus, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
+                    OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+        ok(GetLastError() == ERROR_FILE_NOT_FOUND,
+           "CreateFileW returned GLE %ld on invalid VxD name\n", GetLastError());
+    }
+
 }
  
 static void test_GetTempFileNameA()





More information about the wine-patches mailing list