On 03/15/2011 03:48, Oto BREZINA wrote:
> Dear Jens,
>
> On 2011-03-15 10:23, Jens Geyer wrote:
>>> I just read some articels about NULL vs. INVALID_HANDLER_VALUE and
>>> author states that all new (not existing in WIN16) methods are NULL on
>>> error.
>> The author is probably wrong here.
>>
>> If in doubt, which values are returned, I would suggest to ask MSDN about that.
>> Although there are also quite a few errors in there, this is the reference I would start with.
> I use MSDN as first point to get info about parameters and returned
> values of course. If INVALID_HANDLE_VALUE is just for compatibility with
> win16 code or not, is only side question.
> Main questions (already anwsered) were:
> Can be NULL valid? Can be INVALID_HANDLE_VALUE valid?
>
> Just side question:
> Do you know any method which has been added to win32 with returning
> INVALID_HANDLE_VALUE (or not NULL) on error?
> Do known any Win16 method returning handle to do return NULL (or not
> INVALID_HANDLE_VALUE) on error?
Neither NULL nor INVALID_HANDLE_VALUE are ever a valid value for
a handle (in fact, no odd number is ever a valid handle value.)
CreateFile() return INVALID_HANDLE_VALUE to indicate failure.
Other APIs return NULL to indicate failure (CreateEvent for example.)
I believe this implies that anything handling handles in a generic
fashion would need to check for either INVALID_HANDLE_VALUE or
NULL to indicate an invalid handle.
CloseHandle() should never be called with either INVALID_HANDLE_VALUE or
NULL.
Thanks,
Joseph
>
>> BTW, it's INVALID_HANDLE_VALUE, not INVALID_HANDLER_VALUE.
> sorry I forgot tried to write it instead of copy-paste. My e-mail client
> won't compile with any value ;)
>> JensG
> Oto
>
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=2711708
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2011-03-15 18:39:28 CET