Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2000-03-24
3
Medium Priority
?
604 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 400 total points
ID: 2656618
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
ID: 2656954
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
ID: 2657615
If anyone wishes to discuss this
issue further please email me at:
ijdavis@solo.uwaterloo.ca
0

Featured Post

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
This article shows how to use a free utility called 'Parkdale' to easily test the performance and benchmark any Hard Drive(s) installed in your computer. We also look at RAM Disks and their speed comparisons.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

916 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