Solved

Translating numbers into human readable mneonic strings ie. errlookup.exe

Posted on 2000-03-24
3
567 Views
Last Modified: 2013-12-28
errlookup.exe when given an error code returns a description.  Is there
any interface/DLL in NT which when given an error code returns a
short corresponding NT name for the error, and a longer description.
It seems unbelievable that errlookup.exe would exist, but a program
could not utilize its functionality.

Partial answer.. for OLE/DB use the extended error capabilities.. log the
error, and then immediately read back the answer.. but this doesn't
presumably cover all error codes, and gives no short name eg. E_FAIL
0
Comment
Question by:ijdavis
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
pjknibbs earned 100 total points
Comment Utility
You can use the API function FormatMessage() to translate Win32 error codes to strings as follows:

LPVOID lpMsgBuf;
FormatMessage(
    FORMAT_MESSAGE_ALLOCATE_BUFFER |
    FORMAT_MESSAGE_FROM_SYSTEM |
    FORMAT_MESSAGE_IGNORE_INSERTS,
    NULL,
    GetLastError(),
    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
    (LPTSTR) &lpMsgBuf,
    0,
    NULL
);
// Process any inserts in lpMsgBuf.
// ...
// Display the string.
MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
// Free the buffer.
LocalFree( lpMsgBuf );

Hope that helps!
0
 

Author Comment

by:ijdavis
Comment Utility
Thanks for the response..

The problem is that: FormatMessage(E_FAIL)

Returns "Unspecified Error" but not
"E_FAIL"...

FormatMessage(DB_SEC_E_AUTH_FAILED)
which is an OLE/DB error code
returns nothing..

But you pointed me in the right direction and I worked out what the error module is for OLE/DB.  It is not well documented but it is:

\program files\common files\system\
ole db\msdaerr.dll
0
 

Author Comment

by:ijdavis
Comment Utility
If anyone wishes to discuss this
issue further please email me at:
ijdavis@solo.uwaterloo.ca
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now