Don't compare file handles to NULL

Michael Stefaniuc mstefani at
Fri Mar 9 16:38:00 CST 2007

Alexandre Julliard wrote:
> Michael Stefaniuc <mstefani at> writes:
>> Ok, as there are no false positives i have improved the script a little;
>> documented it on my Smatch page and added it to my daily Smatch run.
>> If you know more functions that return a file_handle i can search for
>> those too. At the moment i'm looking only for the regexp "CreateFile[AW]?".
> Probably at least CreateNamedPipe, CreateMailslot and FindFirstFile
> would be interesting to check.
Done! Added also FindFirstFileEx(); no new bug was found.

> The opposite check would be nice too, there are probably cases where a
> call that returns a NULL handle on error is tested against
Can be done but i'll need a list of functions that return HANDLEs. The
problem is Smatch looses a lot of type informations and a HANDLE is only
an "unsigned long pointer_type". And INVALID_HANDLE_VALUE is just "-1".
I have to see if i can automatically generate the list of HANDLE
returning functions by other means.

Michael Stefaniuc               Tel.: +49-711-96437-199
Sr. Network Engineer            Fax.: +49-711-96437-111
Red Hat GmbH                    Email: mstefani at
Hauptstaetterstr. 58  
D-70178 Stuttgart

More information about the wine-devel mailing list