kernel32: add a test for CreateFileA()

Dmitry Timoshkov dmitry at codeweavers.com
Sun Jul 18 23:09:28 CDT 2010


Austin English <austinenglish at 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.

-- 
Dmitry.



More information about the wine-devel mailing list