GetLastError()
returns a DWORD
. Is there a Windows API function that translates this DWORD
into a string, the name of the #define
? E.g. for 123
it would return "ERROR_INVALID_NAME"
. Here is a list of system error codes.
FormatMessage
doesn't seem to do the job, but the Microsoft Error Lookup Tool somehow prints the name of the #define
.
Not without creating a database of such mappings yourself. Basically a std::map<DWORD, std::wstring>
, FormatMessage
only gets you the message text, not the #define
(remember, #define
tokens disappear very early in the source processing).
The Microsoft Error Lookup Tool contains the names of the #define
's and the message texts in the .exe. You can check it with a binary viewer.