Re: INVALID_HANDLE_VALUE vs. NULL

Tech-Archive recommends: Fix windows errors by optimizing your registry




"qfel" <[q_tmp]@[aster.pl]> wrote in message
news:42865947$0$27735$f69f905@xxxxxxxxxxxxxxxxxx
> From CloseHandle:
> This function will throw an exception if either a handle value that is not
> valid (or 0)
> It implies 0 (NULL) is not valid for any handle closeable by CloseHandle, so
> actually all kernel handles, right?

Wrong. Where do you see that? I don't.

0 is a valid handle and passing it to CloseHandle does not cause an
exception.

--
-GJC [MS Windows SDK MVP]
-Software Consultant (Embedded systems and Real Time Controls)
- http://www.mvps.org/ArcaneIncantations/consulting.htm
-gchanson@xxxxxxxx


.



Relevant Pages

  • Re: INVALID_HANDLE_VALUE vs. NULL
    ... The app raised a exception. ... >> It implies 0 is not valid for any handle closeable by CloseHandle, ... where you find in documentation of CloseHandle that ... > to be thrown, so perhaps that is what the documentation was referring to. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Exceptions in API
    ... > Functions that release resources should not have failure modes ... Does it mean that CloseHandle always returns true? ... just wanted to report deallocation error to user. ... > a SEH exception instead of returning FALSE. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: INVALID_HANDLE_VALUE vs. NULL
    ... > It implies 0 is not valid for any handle closeable by CloseHandle, ... > CloseHandle does not cause an exception. ... where you find in documentation of CloseHandle that 0 ... to be thrown, so perhaps that is what the documentation was referring to. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: INVALID_HANDLE_VALUE vs. NULL
    ... This function will throw an exception if either a handle value that is not ... It implies 0 is not valid for any handle closeable by CloseHandle, ... -Software Consultant (Embedded systems and Real Time Controls) ...
    (microsoft.public.win32.programmer.kernel)
  • Re: INVALID_HANDLE_VALUE vs. NULL
    ... where you find in documentation of CloseHandle that ... It really does say CloseHandle will throw an exception when ... No exception was ... > to be thrown, so perhaps that is what the documentation was referring to. ...
    (microsoft.public.win32.programmer.kernel)