The simple answer is: I donβt think I have ever seen any code anywhere that checks the return value of CloseHandle, and CloseHandle does not work, has never been the cause of any error that I have ever seen in 15+ years Windows Programming (YMMV).
The real answer: Of course, you should check the error return (from all the methods that could return a failure, all the time), assuming that your application has a constant error handling structure already in place, you will simply work with it. Failure to consistently check return values ββand assume success is a recipe for larger, often more difficult to understand, crashes later in the code.
That said: I'm worried that CloseHandle fails while shutting down the application? Probably no. But this is only my 2 cents.
source share