This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
Re: Problems on accessing Windows network resources
On Sat, Jul 12, 2003 at 09:37:37AM -0400, Pierre A. Humblet wrote:
> 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.
>
> Corinna,
>
> 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.
What I don't like is that tokens can get both values now. Most of the
time they are initialized to INVALID_HANDLE_VALUE, your code introduces
additionally NULL values. At one point we will suddenly get a problem
because a `if (!foo_token)' doesn't handle the INVALID_HANDLE_VALUE case.
Regardless if INVALID_HANDLE_VALUE or NULL is the correct value, I want
to see only one of them used in Cygwin internally.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:cygwin@cygwin.com
Red Hat, Inc.