[PATCH 1/4] gameux: initial implementation of loading game statistics
Mariusz Pluciński
vshader at gmail.com
Thu Sep 30 10:13:03 CDT 2010
W dniu 28.09.2010 17:11, Alexandre Julliard pisze:
> 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.
OK, I'll redesign process of loading these data. Thanks for advice.
--
Best regards
Mariusz Pluciński
More information about the wine-devel
mailing list