In the Microsoft® Windows® operating system, error codes are returned as signed 32-bit HRESULT values that indicate the status of an operation. The high-order sign bit indicates success or failure of the particular method function call.
Interpreting HRESULTs
The HRESULT data type is composed of fields depicted by the following diagram:
The 32-bit value is used to describe an error or warning and is composed of a 1-bit code that indicates the severity (S) of the condition; 0 for success and 1 for failure. The severity code is followed by 4 reserved bits depicted as R, C, N, and r, and then by an 11-bit facility code that indicates responsibility for the error or warning that is defined in the method implementation.
The Facility codes and Error codes are defined by the Winerror.h header file. The following table lists some typical HRESULT values:
Return value/code | Description |
---|---|
0x00000000 | Operation successful |
0x80004001 | Not implemented |
0x80004002 | Interface not supported |
0x80004004 | Operation aborted |
0x80004005 | Unspecified failure |
0x80070057 | One or more arguments are invalid |
For more information about HRESULT, Facility Codes (Codes in FACILITY_ITF), and mapping Win32 error values (HRESULT_FROM_WIN32) into an HRESULT, see Microsoft Developer Network (MSDN).
Note Because error codes are implementation specific, two identical HRESULTs that are returned from two different interfaces can have different meanings.
No comments:
Post a Comment