Error Lookup Tool


If you want to find a particular error code returned by a function, you have several options. You can look in the WinError.h file for the error codes returned by Win32 API functions. Or, you can look up an error code by typing the code in the Watch window or the QuickWatch dialog box.

0x80004004, hr

This will display E_ABBORT.

Another way is to use the ERRLOOK.EXE utility provided by Microsoft within the Visual Studio to retrieve a system error message or module error message.

Still another option is to use the FormatMessage function to format a string with information about an error. The function requires a message definition as input. The message definition can come from a buffer passed into the function. It can come from a message table resource in an already loaded module. Or, the caller can ask the function to search the system’s message table resource(s) for the message definition. In fact, using this small piece of code taken from MSDN will display the same error information as errlook.exe does.

DWORD dwError = 123; // just an example

LPVOID lpMsgBuf;
if (!FormatMessage(
(LPTSTR) &lpMsgBuf,
// Handle the error.

LocalFree( lpMsgBuf );

Additional Information and an Example on how to Load Information from a Specific Module

This small tool that I have created, ErrorOracle, is similar to ErrLook.exe from Microsoft; you can use it to get the error codes as described in MSDN for many modules (see the list below) without needing to know the module (a DLL file) in which the error messages are defined, which may not always be trivial to find.

Error Files

The error codes are described in files with the extension EFD. These files must be copied to the same directory where ErrorOracle.exe is placed. They are parsed when the application is launched. They are text files and the format is trivial, making it very easy to add new files for other modules, including application specific-error codes.


Module Name

The first line is the name of the module, which is displayed in the Section combo box. This must be followed by an empty line. After it come the error codes: The first line is the name or the error, such as LINEERR_INVALAGENTID or COMADMIN_E_APP_FILE_READFAIL, just to give some examples; the next line is the error code that can be given either in decimal or hexadecimal format. The following lines contain the error description and must be followed by an empty line. If you don’t like the format, define your own format and override the ParseSection() method from CSectionManager.

How to Add ErrorOracle to Your Tools

First, you must build the application from the source files. You can do it with either VS6.0 or VS.NET.

Copy the executable (recommended a release build) to a location of your choice and put the database files from there.

I would recommend to add it to the VS tools. You can do that this way:

  • Open the tools manager
    • VS6.0: Go to Tools, Customize, and select the Tool tab
    • VS.NET: Go to Tools, External Tools…
  • Add a new tool
  • In the Title field, write Error Oracle
  • In the Command field, give the path to ErrorOracle.exe
  • You can specify for the Initial Directory the folder where the executable is located

After adding it, you can run it directly from the Tools menu.

How to Use ErrorOracle

To look up an error description, you can use either the error code or the error name. The error code can be given either in decimal or hexadecimal format. You can either type it directly or copy the name or value and use the Clipboard button to paste it from the Clipboard.

Use the Lookup button to search for the error. You can do a lookup either in all files, if All Sections is selected in the combo box, or search a particular section, by specifying it in the combo.

If the error is found, the Value edit box will be filed with the error code in hexadecimal format and the Description edit with the name of the error and the description.

Error codes are provided in for the following errors:

  • Active Directory Service Interface (ASDI.efd)
  • Collaboration Data Objects (CDO.efd)
  • COM+ (COM+.efd)
  • DirectX Media Objects (DMO.efd)
  • Image Color Management (ICM.efd)
  • Message Queuing (MessageQueuing.efd)
  • Network Meeting (NetMeeting.efd)
  • Network Management (NetManagement.efd)
  • OpenGL (OpenGL.efd)
  • Performance Monitoring (PerformanceMonitoring.efd)
  • Quality of Service (QOS.efd)
  • Telephony API (TAPI.efd)
  • URL Moniker (URLMoniker.efd)
  • Windows Simple Network Management Protocol (WinSNMP.efd)
  • Windows Sockets (WSA.efd)

More by Author

Must Read