On Sun, Jul 18, 2010 at 1:24 AM, Nikolay Sivov <nsi...@codeweavers.com> wrote:
>  On 7/18/2010 10:17, Austin English wrote:
>>
>> Passed all the vm's on wtb.
>
> Hi, Austin. This looks strange:
>
>> +
>> +    hFile = CreateFileA("c:\\*.*",
>> GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL
>> );
>> +    ok(GetLastError() == ERROR_INVALID_NAME || broken(GetLastError() ==
>> ERROR_FILE_NOT_FOUND) || broken(GetLastError() == ERROR_PATH_NOT_FOUND),
>> +       "CreateFileA should have returned ERROR_INVALID_NAME on %s, but
>> got %u\n", filename, GetLastError());
>> +    CloseHandle( hFile );
>
> If a call failed then you should test for null hFile I suppose and remove
> CloseHandle().  Also when testing for last error a common rule is to set it
> first before the call.

Hi Nikolay, thanks for the feedback. How's this look?

> Does anything depend on this having 3 possible return values?

There was a testcase made in
http://bugs.winehq.org/show_bug.cgi?id=3028. Apparently EVE Online did
something similar. I tested the testcase on windows/wine and found a
difference between Wine and XP, but futher investigation showed the
return value is different across windows versions. Therefore, it
doesn't seem like the bug was caused by wine giving returning the
wrong error here, but something else. I wanted to go ahead and send
the testcase, though, so the work is not lost.

-- 
-Austin
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index c0a36c7..29aece6 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -1151,6 +1151,14 @@ static void test_CreateFileA(void)
     }
     else
         win_skip("GetVolumeNameForVolumeMountPointA not found\n");
+
+    SetLastError(0xdeadbeef);
+    hFile = CreateFileA("c:\\*.*", GENERIC_READ, FILE_SHARE_READ, NULL, 
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+    ok(GetLastError() == ERROR_INVALID_NAME || 
+        broken(GetLastError() == ERROR_FILE_NOT_FOUND), /* Win98 */
+        "LastError should have been ERROR_INVALID_NAME or ERROR_FILE_NOT_FOUND 
but got %u\n", GetLastError());
+    if(hFile != INVALID_HANDLE_VALUE)
+        CloseHandle(hFile);
 }
 
 static void test_CreateFileW(void)


Reply via email to