msdn 中的:
The following figure shows the layout for NTSTATUS values.
NTSTATUS Layout
313029 28 16 15 0
// +----+--+-------------------------+-------------------------------+
// |Sev|C |R| Facility | Code |
// +----+--+-------------------------+-------------------------------+
The Sev field shown in the NTSTATUS Layout figure indicates the severity code, which must be one of the following system-defined values:
-
STATUS_SEVERITY_SUCCESS
- Indicates a successful NTSTATUS value, such as STATUS_SUCCESS, or the value IO_ERR_RETRY_SUCCEEDED in error log packets. STATUS_SEVERITY_INFORMATIONAL
- Indicates an informational NTSTATUS value, such as STATUS_SERIAL_MORE_WRITES. STATUS_SEVERITY_WARNING
- Indicates a warning NTSTATUS value, such as STATUS_DEVICE_PAPER_EMPTY. STATUS_SEVERITY_ERROR
- Indicates an error NTSTATUS value, such as STATUS_INSUFFICIENT_RESOURCES for a FinalStatus value or IO_ERR_CONFIGURATION_ERROR for an ErrorCodevalue in error log packets.
即在上图中:
Sev - is the severity code
00 - Success
01 - Informational
10 - Warning
11 - Error
C - is the Customer code flag
Facility - is the facility code
Code - is the facility's status code
参考:
MessageIdTypedef=NTSTATUS
SeverityNames=(Success=0x0:STATUS_SEVERITY_SUCCESS
Informational=0x1:STATUS_SEVERITY_INFORMATIONAL
Warning=0x2:STATUS_SEVERITY_WARNING
Error=0x3:STATUS_SEVERITY_ERROR
)
FacilityNames=(System=0x0
RpcRuntime=0x2:FACILITY_RPC_RUNTIME
RpcStubs=0x3:FACILITY_RPC_STUBS
Io=0x4:FACILITY_IO_ERROR_CODE
DEVclass=0x05:FACILITY_DEVCLASS_ERROR_CODE
)
MessageId=0x3296 Facility=DEVclass Severity=Warning SymbolicName=DEVCLASS_HIGH_TEMPERATURE
Language=English
The temperature of the device %1 is too high .
如果想添加自定义的Error Messege,
需要设置C以区别Microsoft 和Customer定义的错误信息,
0:Microsoft 1:Customer