16.6.3 Setting NTSTATUS Values in Error Log Packets

Both the ErrorCode and FinalStatus members of the error log packet are of type NTSTATUS. Figure 16.5 shows the layout for NTSTATUS values.

Figure 16.5 NTSTATUS layout

NT drivers must set an NTSTATUS-type IO_ERR_XXX value for ErrorCode and a STATUS_XXX value for FinalStatus in each error log packet.

The system supplies a set of public IO_ERR_XXX constants for setting the ErrorCode in an error log packet. For example, NT drivers can use the following system-defined constants:

IO_ERR_RETRY_SUCCEEDED

IO_ERR_INSUFFICIENT_RESOURCES

IO_ERR_CONFIGURATION_ERROR

IO_ERR_INCORRECT_IRQL

IO_ERR_INVALID_IOBASE

IO_ERR_DRIVER_ERROR

IO_ERR_PARITY

: :

IO_ERR_OVERRUN_ERROR

IO_ERR_TIMEOUT

IO_ERR_CONTROLLER_ERROR

IO_ERR_INTERNAL_ERROR

The system also supplies a set of public STATUS_XXX values that NT drivers can use to set FinalStatus in error log packets and can return from their standard driver routines for NTSTATUS. For example, NT drivers can return the following system-defined constants for NTSTATUS from their standard driver routines, can set any of the following in the I/O status block of IRPs, and can set some of the following for FinalStatus in error log packets:

STATUS_SUCCESS

STATUS_DEVICE_CONFIGURATION_ERROR

STATUS_DRIVER_INTERNAL_ERROR

STATUS_INVALID_DEVICE_STATE

STATUS_IO_DEVICE_ERROR

: :

STATUS_DEVICE_BUSY

STATUS_DEVICE_DOES_NOT_EXIST

STATUS_ADAPTER_HARDWARE_ERROR

Public IO_ERR_XXX and STATUS_XXX constants are system resources, and each such STATUS_XXX is mapped to a corresponding Win32 constant by the system. Because they are built into Windows NT, public IO_ERR_XXX and STATUS_XXX constants can be added to the system only with the cooperation of Microsoft Corporation.