Solved

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

Posted on 2000-03-24
3
574 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
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MaxPosPhaseCorrection setting 3 43
Access bios on restart 11 66
Pay to 支付宝 12 56
Window 10 upgrade crashes ssd again 44 84
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

839 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