In listings of Win32 error codes, each error has three components:
- The numeric error code
- A descriptive message
- An identifier consisting of capitalized words separated by underscores
According to the documentation, the term "message identifier" refers to the descriptive message, but it doesn't say what the term is for the capitalized error name, and I haven't been able to find that anywhere. These identifiers appear to be analogous to what's called the "Error Id" in a PowerShell ErrorRecord object, but googling for "win32 error id" and "win32 error identifier" didn't lead to an answer.
For example, in the following error:
ERROR_TOO_MANY_OPEN_FILES
4 (0x4)
The system cannot open the file.
4
is the error code.The system cannot open the file.
is the message identifier.ERROR_TOO_MANY_OPEN_FILES
is the __________?
Also, how can this text value be determined, given an error code? I can easily determine the message identifier associated with a given error code like this:
string MessageIdentifier = new Win32Exception(ErrorCode).Message;
However, the Win32Exception class doesn't appear to have a property that corresponds to these capitalized error names (analogous to the ErrorRecord class's ErrorId property).
In some listings I've seen these kinds of identifiers referred to as "constants", but if they're constants, where are they defined/enumerated and how do you access them from a program?
The system cannot open the file
. But the term forERROR_TOO_MANY_OPEN_FILES
remains a mystery. – GadoliniteERROR_...
names are logically defined by the Win32 API and used/documented all the other place. But how your compiler knows what they are is a different story. For C/C++, they are defined in thewinerror.h
file. In Delphi, they are defined in theWinapi.Windows
unit. For other programming languages, they are defined other ways. – Selfexpression