How to Convert Hex Windows Error Codes to the Meaningful Error Message – 0x80040002 and 0x80040005 and others? – Interview Question of the Week #182

Question: How to Convert Hex Windows Error Codes to the Meaningful Error Message – 0x80040002 and 0x80040005 and others?

Answer: This blog is not specific to SQL Server, but I have recently seen hex error codes in SQL Server ERRORLOG and it took me little time to get the meaning of it. In this blog, we would learn about how to convert a hex windows error codes to meaningful error messages.

Here are the few sample error codes which can be seen in Windows:

0x80040002
0x80040003
0x80040005
0x80070005
0x80040005
0x80070490
0x8007054f
0x80070bc2
0x80070070
0x80070643

It would be humanly impossible to remember the meaning of all the codes. Here are the simple steps to get an error message. Let’s pick 0x80070070 as an example.

  • Make note of the last four numbers of the code – 0070 from the example.
  • Convert the hex number to decimal number using a calculator.
    How to Convert Hex Windows Error Codes to the Meaningful Error Message - 0x80040002 and 0x80040005 and others? - Interview Question of the Week #182 hex-2-msg-01

So, Hex 70 = Dec 112.

  • Use command prompt and use the command “NET HELPMSG ” followed by the decimal number. 112 in our example.
    How to Convert Hex Windows Error Codes to the Meaningful Error Message - 0x80040002 and 0x80040005 and others? - Interview Question of the Week #182 hex-2-msg-02

The output of the command is “There is not enough space on the disk.”

Here are some most common hex codes and their meaning, just to save some time for you.

0x80040002The system cannot find the file specified.
0x80040003The system cannot find the path specified.
0x80040005Access is denied.
0x80070005Access is denied.
0x80040005Not enough memory resources are available to process this command.
0x80070490Element not found.
0x8007054fAn internal error occurred.
0x80070bc2The requested operation is successful. Changes will not be effective until the system is rebooted.
0x80070070There is not enough space on the disk.
0x80070643Fatal error during installation.

Hope you would find this blog useful to learn the trick to covert the hex code to a meaningful message.

Reference: Pinal Dave (http://blog.SQLAuthority.com)

SQL Error Messages, SQL Server, SQL Server Security
Previous Post
How to Generate Random Password in SQL Server? – Interview Question of the Week #181
Next Post
How Old Version of SQL Server Running on Server? – Interview Question of the Week #183

Related Posts

5 Comments. Leave new

  • Wow I never knew this! I feel like Neo after his first training session “I know Kung Fu”.

    Reply
  • Hi Pinal Dave,

    There are 2 error messages given for the same Hex Windows error code (0x80040005) in the blog.

    0x80040005 – Access is denied.

    0x80040005 – Not enough memory resources are available to process this command.

    Can you please let us know which is appropriate error message from the two for 0x80040005 error code?

    Thanks,
    Srini

    Reply
  • net helpmsg works for windows error codes. It explicitly does NOT work on HRESULTs. You might get an HRESULT that is a windows error code, but they are not equivalent.

    If you want to know what an HRESULT is, the best option is to use Err.exe (which is available from https://www.microsoft.com/en-us/download/details.aspx?id=985 , where it still claims to be the “Exchange error lookup tool,” even though it works across a wide array of products).

    Reply
  • My previous comment should have included examples:

    For 0x800*4*0002:
    # for hex 0x80040002 / decimal -2147221502 :
    TAPI_E_NOITEMS tapi3err.h
    OLE_E_ENUM_NOMORE winerror.h
    # Can’t enumerate any more, because the associated data is
    # missing
    # 2 matches found for “0x80040002”

    —–

    For 0x800*7*0002:
    # for hex 0x80070002 / decimal -2147024894 :
    COR_E_FILENOTFOUND corerror.h
    # MessageText:
    DIERR_NOTFOUND dinput.h
    DIERR_OBJECTNOTFOUND dinput.h
    STIERR_OBJECTNOTFOUND stierr.h
    # 4 matches found for “0x80070002”

    Reply
  • Searching for more updates regarding Error Code 0xc0000225 as I faced this Error while trying to update Windows 7 on my Hp Notebook.

    Reply

Leave a Reply