Python's test_tempfile.py unit test fails because it (ultimately) expects CreateFile() to fail with ERROR_PATH_NOT_FOUND when the path contains a directory which doesn't exist, and we fail with ERROR_DIRECTORY instead.
Signed-off-by: Damjan Jovanovic damjan.jov@gmail.com --- dlls/kernel32/tests/file.c | 9 +++++++++ dlls/kernelbase/file.c | 2 ++ 2 files changed, 11 insertions(+)
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=70237
Your paranoid android.
=== w1064v1809_zh_CN (32 bit report) ===
kernel32: file.c:2819: Test failed: FindFirstFile failed (err=5) file.c:2820: Test failed: First entry should be '.', is file.c:2823: Test failed: Fetching second file failed file.c:2824: Test failed: Second entry should be '..' is file.c:2827: Test failed: Fetching third file failed file.c:2828: Test failed: Invalid third entry - file.c:2843: Test failed: Fetching fourth file failed file.c:2844: Test failed: Invalid fourth entry - file.c:2847: Test failed: Fetching fifth file failed file.c:2848: Test failed: Invalid fifth entry - file.c:2871: Test failed: Unexpected error 5, expected valid handle file.c:2819: Test failed: FindFirstFile failed (err=5) file.c:2820: Test failed: First entry should be '.', is file.c:2823: Test failed: Fetching second file failed file.c:2824: Test failed: Second entry should be '..' is file.c:2827: Test failed: Fetching third file failed file.c:2828: Test failed: Invalid third entry - file.c:2843: Test failed: Fetching fourth file failed file.c:2844: Test failed: Invalid fourth entry - file.c:2847: Test failed: Fetching fifth file failed file.c:2848: Test failed: Invalid fifth entry - file.c:2865: Test failed: Unexpected error 5, expected valid handle or ERROR_PATH_NOT_FOUND file.c:2819: Test failed: FindFirstFile failed (err=5) file.c:2820: Test failed: First entry should be '.', is file.c:2823: Test failed: Fetching second file failed file.c:2824: Test failed: Second entry should be '..' is file.c:2827: Test failed: Fetching third file failed file.c:2828: Test failed: Invalid third entry - file.c:2843: Test failed: Fetching fourth file failed file.c:2844: Test failed: Invalid fourth entry - file.c:2847: Test failed: Fetching fifth file failed file.c:2848: Test failed: Invalid fifth entry - file.c:2871: Test failed: Unexpected error 5, expected valid handle file.c:2819: Test failed: FindFirstFile failed (err=5) file.c:2820: Test failed: First entry should be '.', is file.c:2821: Test failed: FindFirstFile unexpectedly returned an alternate filename file.c:2823: Test failed: Fetching second file failed file.c:2824: Test failed: Second entry should be '..' is file.c:2825: Test failed: FindFirstFile unexpectedly returned an alternate filename file.c:2827: Test failed: Fetching third file failed file.c:2828: Test failed: Invalid third entry - file.c:2829: Test failed: FindFirstFile unexpectedly returned an alternate filename file.c:2843: Test failed: Fetching fourth file failed file.c:2844: Test failed: Invalid fourth entry - file.c:2845: Test failed: FindFirstFile unexpectedly returned an alternate filename file.c:2847: Test failed: Fetching fifth file failed file.c:2848: Test failed: Invalid fifth entry - file.c:2849: Test failed: FindFirstFile unexpectedly returned an alternate filename file.c:2871: Test failed: Unexpected error 5, expected valid handle file.c:2819: Test failed: FindFirstFile failed (err=5) file.c:2820: Test failed: First entry should be '.', is file.c:2823: Test failed: Fetching second file failed file.c:2824: Test failed: Second entry should be '..' is file.c:2827: Test failed: Fetching third file failed file.c:2828: Test failed: Invalid third entry - file.c:2843: Test failed: Fetching fourth file failed file.c:2844: Test failed: Invalid fourth entry - file.c:2847: Test failed: Fetching fifth file failed file.c:2848: Test failed: Invalid fifth entry - file.c:2871: Test failed: Unexpected error 5, expected valid handle file.c:2819: Test failed: FindFirstFile failed (err=5) file.c:2820: Test failed: First entry should be '.', is file.c:2823: Test failed: Fetching second file failed file.c:2824: Test failed: Second entry should be '..' is file.c:2827: Test failed: Fetching third file failed file.c:2828: Test failed: Invalid third entry - file.c:2843: Test failed: Fetching fourth file failed file.c:2844: Test failed: Invalid fourth entry - file.c:2847: Test failed: Fetching fifth file failed file.c:2848: Test failed: Invalid fifth entry - file.c:2865: Test failed: Unexpected error 5, expected valid handle or ERROR_PATH_NOT_FOUND file.c:2819: Test failed: FindFirstFile failed (err=5) file.c:2820: Test failed: First entry should be '.', is file.c:2823: Test failed: Fetching second file failed file.c:2824: Test failed: Second entry should be '..' is file.c:2827: Test failed: Fetching third file failed file.c:2828: Test failed: Invalid third entry - file.c:2843: Test failed: Fetching fourth file failed file.c:2844: Test failed: Invalid fourth entry - file.c:2847: Test failed: Fetching fifth file failed file.c:2848: Test failed: Invalid fifth entry - file.c:2871: Test failed: Unexpected error 5, expected valid handle file.c:2819: Test failed: FindFirstFile failed (err=5) file.c:2820: Test failed: First entry should be '.', is file.c:2821: Test failed: FindFirstFile unexpectedly returned an alternate filename file.c:2823: Test failed: Fetching second file failed file.c:2824: Test failed: Second entry should be '..' is file.c:2825: Test failed: FindFirstFile unexpectedly returned an alternate filename file.c:2827: Test failed: Fetching third file failed file.c:2828: Test failed: Invalid third entry - file.c:2829: Test failed: FindFirstFile unexpectedly returned an alternate filename file.c:2843: Test failed: Fetching fourth file failed file.c:2844: Test failed: Invalid fourth entry - file.c:2845: Test failed: FindFirstFile unexpectedly returned an alternate filename file.c:2847: Test failed: Fetching fifth file failed file.c:2848: Test failed: Invalid fifth entry - file.c:2849: Test failed: FindFirstFile unexpectedly returned an alternate filename file.c:2871: Test failed: Unexpected error 5, expected valid handle
Damjan Jovanovic damjan.jov@gmail.com wrote:
- wsprintfW(temp_filename, dir_fileW, filename, prefix);
While wsprintf() works of course, it's easier to use lstrcpyW()+lstrcatW().
- hFile = CreateFileW(temp_filename, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, 0);
- ok(hFile == INVALID_HANDLE_VALUE && (GetLastError() == ERROR_PATH_NOT_FOUND),
"hFile %p, last error %u\n", hFile, GetLastError());
A usual practice is to set last error to 0xdeadbeef before testing for exact API error cases.
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c index 9ca184a5d0..1492778119 100644 --- a/dlls/kernelbase/file.c +++ b/dlls/kernelbase/file.c @@ -602,6 +602,8 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateFileW( LPCWSTR filename, DWORD access, DWO */ if (status == STATUS_OBJECT_NAME_COLLISION) SetLastError( ERROR_FILE_EXISTS );
else if (status == STATUS_NOT_A_DIRECTORY)
SetLastError( ERROR_PATH_NOT_FOUND );
Probably NtCreateFile() should be fixed instead.