In addition to the descriptions in the <winerror.h> header, the
`FormatMessage` API function produces a textual description from a
message DLL. The default message DLL has the descriptions in
`<winerror.h>` plus some more (the descriptions in the header are valid
input to the mc message compiler in order to produce a message DLL).
Some other message DLLs reside in the Windows system folder.
`FormatMessage` is the underlying engine of Microsoft's `errlook`
utility. Unfortunately that's a little GUI program, so it's less than
generally useful. It's been that way since the late 1990s.
In the command line you can use the more limited facilities of
Powershell to get a description, e.g. using a batch file like this:
--------------------------------------------------------------------
echo off
if "%1"=="" (
echo Usage: %0 NUMBER 1>&2
exit /b 1
)
if "%1"=="1" (
echo Something failed ^(could also be "Incorrect function" or
"S_FALSE"^).
) else (
powershell -command "[ComponentModel.Win32Exception] %1" 2>nul ^
|| echo "%1" must be a number. 1>&2
)
--------------------------------------------------------------------
The reason for the special treatment of code 1 is the unreasonable
convention of all extant Windows C and C++ implementations of defining
EXIT_FAILURE as code 1, when code 1 already has two meanings, widening
that ambiguity to /three/ possible meanings.
It's IMO just so needlessly braindead.
Anyway, hope this helps.
- Alf