Structure of COM Error Codes

A 2013 comment on this StackOverflow question was enlightening:  by converting a long decimal error (in this case 2147942667) to hex (0x8007010B), you can break out the actual error code from the last four bytes (010B), convert it back to decimal (267), and search here for the meaning (“The directory name is invalid”).

Now another commenter on that post has pointed me to this Microsoft developer article which goes into more detail:  Structure of COM Error Codes.

Error Codes

If I’m reading this right, an HRESULT of 0x8007010B breaks down as follows:

Hex: 8007010B
Binary:  10000 00000000111 0000000100001011
The high-order “1” (bit 31) means SEVERITY_ERROR, i.e. failure.
Bits 27-30 are reserved.
The Facility (bits 16-26) = 7 = FACILITY_WIN32.
The Code (bits 0-15) = 0x010B = 267. The meaning can be found in the list of System Error Codes.

I see there is also a command-line tool for looking up errors described here. Haven’t tried that.

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.