[PATCH 1/4] gameux: initial implementation of loading game statistics
Alexandre Julliard
julliard at winehq.org
Tue Sep 28 10:11:22 CDT 2010
Mariusz Pluciński <vshader at gmail.com> writes:
> +static BOOL GAMEUX_isFileExists(LPCWSTR sFile)
> +{
> + HANDLE hFile;
> +
> + hFile = CreateFileW(sFile, GENERIC_READ, 0,
> + NULL, OPEN_EXISTING, 0, NULL);
> +
> + if(hFile == INVALID_HANDLE_VALUE)
> + return FALSE;
> +
> + CloseHandle(hFile);
> + return TRUE;
> +}
This sort of thing is not a good idea in general, even if it had a more
grammatically correct function name ;-) If you need to load a file you
have to open it anyway, so you can check for errors at that point.
Checking for existence beforehand is only doing duplicate work.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list