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.