How to Convert HRESULT Decimal (DEC) Values to Hexadecimal (HEX)

How to convert HRESULT decimal values to hexadecimal

In the Windows operating system, when an exception is generated it is delivered with an HRESULT value. The HRESULT value is essentially a “reason code” that describes the underlying cause of the exception. In BatchPatch the HRESULT values are generally included in the text of any error, but HRESULTs will be in decimal format, which is not always optimal. In order to figure out what they mean we sometimes need to convert them to hexadecimal first. It’s especially the case for google searching the HRESULT value. If you enter a DEC HRESULT into google you probably won’t find much, but if you convert it to HEX first and then search the HEX value you’ll end up with more useful results, which in turn means you’ll likely have a much higher degree of success in figuring out what it means. The easiest way to perform the DEC to HEX conversion is with your Windows calculator app. Go to ‘Start > Run‘ and type calc.exe to launch the Windows calculator application. Once it is open, switch to the ‘Programmer’ calculator by clicking the button in the upper left corner of the calculator window, and then choose ‘Programmer’ from the drop-down menu.

In the Programmer calculator select DEC by simply clicking on it. With DEC selected, copy your HRESULT value to the clipboard (CTRL-C), and then paste the value from the clipboard into the calculator (CTRL-V). Yes, you can type it manually instead of using copy/paste, but just note that the HRESULT values are negative integers. Therefore if you type a positive integer into the calculator, the conversion will be incorrect, so you must type the complete HRESULT value with the negative symbol. It’s usually easier to just copy and paste it. Once you’ve done that you can immediately then see the HEX value appear directly above the DEC value in the calculator. In this example I’ve pasted DEC value -2147012867, and we can see the HEX value is 80072EFD.

Once you have the HEX representation of the HRESULT, you can look it up here to see what it means: Windows Update Error Code List. Unfortunately that list isn’t a complete list of every possible HRESULT, so if you don’t find it in that list try entering it into a google search to see what comes up. You may also enter it into the search box in the upper right section of this page as well as in our support forum.

This entry was posted in Blog, General, Tutorials and tagged , , , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.