winapierror-handling

Is there a comprehensive list of Win32 functions that indicate error with `INVALID_HANDLE_VALUE`?


The Win32 CreateFile function is well-known for returning INVALID_HANDLE_VALUE rather than NULL in the case of failure. This has apparently been a source of confusion for programmers.

Is there a comprehensive list of Win32 API functions that return INVALID_HANDLE_VALUE instead of NULL to indicate failure? (Functions like GetCurrentProcess, which can return a pseudo-handle whose value happens to equal INVALID_HANDLE_VALUE which doesn't indicate failure, are not counted.)


Solution

  • There is no list of Win32 functions that indicate error with INVALID_HANDLE_VALUE.

    I suggest you could refer to the blog: Why are HANDLE return values so inconsistent?