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.
Does anything depend on this having 3 possible return values?
On Sun, Jul 18, 2010 at 1:24 AM, Nikolay Sivov nsivov@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 English austinenglish@gmail.com wrote:
- 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);
You need to add an ok() call for hFile right after the CreateFile call. If it's supposed to be INVALID_HANDLE_VALUE then CloseHandle() is redundant.