The CertUtil program will decode Windows error codes, and in a variety of formats

Raymond

Some time ago, I noted that The NET HELPMSG command will decode Windows error codes, at least the simple ones.

Stefan Kanthak pointed out that there’s another built-in program for converting numbers to error messages, and it handles a lot more error numbers and formats than NET HELPMSG does.

certutil /error 2
certutil /error 0x80070002
certutil /error -2147024894
certutil /error 2147942402
certutil /error -0x7ff8fffe

The first one says

0x2 (WIN32: 2 ERROR_FILE_NOT_FOUND) -- 2 (2)
Error message text: The system cannot find the file specified.
CertUtil: -error command completed successfully.

The others say the same thing, but with a different error number:

0x80070002 (WIN32: 2 ERROR_FILE_NOT_FOUND) -- 2147942402 (-2147024894)
Error message text: The system cannot find the file specified.
CertUtil: -error command completed successfully.

9 comments

Comments are closed. Login to edit/delete your existing comments

      • Tim Weis

        NTSTATUS codes can be encoded as HRESULT values, though. Just like Win32 system error codes. Uniquely identifiable as such, too. While indeed not every error code is in fact an HRESULT, every error code in Windows can be encoded as an HRESULT.

  • Mike Morrison

    I prefer err.exe, but if you have to stick to the built-in tools, then it sounds like certutil is good way to go. I had no idea that it could look up error codes.

    • Peter Cooper Jr.

      Certutil is also handy if you’re looking for a way to get a hash of a file (to validate a download or the like)

      certutil -hashfile file.txt sha256

      I’m pretty sure I’ve used certutil a lot more often for things completely unrelated to certs than for anything related to them.

  • Petr Kadlec

    So, does it help for yesterday’s blogpost error for which net helpmsg does not work?

    > certutil /error 0x80070bfe
    0x80070bfe (WIN32: 3070) -- 2147945470 (-2147021826)
    Error message text: memory
    
    > certutil /error 0x80070bfd
    0x80070bfd (WIN32: 3069) -- 2147945469 (-2147021827)
    Error message text: Error 0x80070bfd (WIN32: 3069)
    

    Nope. So, I wonder – where do the error messages quoted yesterday come from?

    • Mike Morrison

      Err.exe v6.4.5 reports the following for those two hresults:
      C:\Tools>Err_6.4.5.exe 0x80070bfe
      # No results found for hex 0x80070bfe / decimal -2147021826
      # anonymous HRESULT: Severity: FAILURE (1), Facility 0x7, Code 0xbfe
      # for hex 0xbfe / decimal 3070
      BC_BLUETOOTH_VERIFIER_FAULT bugcodes.h
      SERVICE_UIC_M_MEMORY lmsvc.h
      # 2 matches found for “0x80070bfe”

      C:\Tools>Err_6.4.5.exe 0x80070bfd
      # No results found for hex 0x80070bfd / decimal -2147021827
      # anonymous HRESULT: Severity: FAILURE (1), Facility 0x7, Code 0xbfd
      # for hex 0xbfd / decimal 3069
      EVENT_GATHER_RESTORE_COMPLETE windowssearcherrors.h
      # The application was successfully restored.%1
      # 1 matches found for “0x80070bfd”

    • Joshua

      They come up for me. I’m on Windows 11.

      ╰─ certutil -error 0x80070bfe
      0x80070bfe (WIN32: 3070) -- 2147945470 (-2147021826)
      Error message text: The caller specified wait timed out before the operation completed because a host termination is in queued.
      CertUtil: -error command completed successfully.
      ╰─ certutil -error 0x80070bfd
      0x80070bfd (WIN32: 3069) -- 2147945469 (-2147021827)
      Error message text: The caller specified wait timed out before the operation completed.
      CertUtil: -error command completed successfully.