Problems on accessing Windows network resources

Pierre A. Humblet
Sat Jul 12 14:58:00 GMT 2003

At 10:31 AM 7/12/2003 +0200, Corinna Vinschen wrote:

>thanks for the patch but it has a problem.  You're comparing tokens against
>NULL while the correct "NULL" value for tokens is INVALID_HANDLE_VALUE. 


That's by design, using of Chris' astute observations. As he once
pointed out, INVALID_HANDLE_VALUE is the value returned in case of error
but NULL is not a legal handle value either, as implied by CreateFile
itself. Microsoft is using NULL handle values all the time. For the 
specific case of a NULL token handle, see SetThreadToken.

So I do like Microsoft and I use NULL to denote the legitimate absence 
of a token. I also use INVALID_HANDLE_VALUE in the error case.


More information about the Cygwin-patches mailing list