You are mistaken again, since all system errors in almost all systems return 0, and successful and nonzero return values indicate an error code, using this technique, we can report a different error with only one return value. But for HRESULT we have >= 0 for success and <0 for error, so the value 1 from the HRESULT view is successful not an error. in HRESULT > 0 indicate a warning or information about the function, 0 means absolute success, and <0 indicates an error. HRESULT Layout:
3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 +-+-+-+-+-+
As you can see, this is one of the best projects with very reasonable support for custom error codes, warnings and information.
source share