Returns the last nonzero error code, and sets the error code to zero.

The current error code is reset to zero.

In multiple thread applications where there are multiple anchor blocks, errors are stored in the anchor block created by the WinInitialize function of the thread invoking a call. The last error for the process and thread on which this function call is made will be returned.

The returned error code is a 32-bit quantity. The high order 16 bits is a severity code. The low order 16 bits is the error code.

The severity codes are defined as follows:

#define SEVERITY_NOERROR            0x0000
#define SEVERITY_WARNING            0x0004
#define SEVERITY_ERROR              0x0008
#define SEVERITY_SEVERE             0x000C
#define SEVERITY_UNRECOVERABLE      0x0010

Error codes are described in

Two macros have been defined to simplify extracting severity codes and error codes from the returned ERRORID value.

/* Extract severity from an errorid */
#define ERRORIDSEV(errid)              (HIUSHORT(errid))

/* Extract error number from an errorid */
#define ERRORIDERROR(errid)            (LOUSHORT(errid))


[Back] [Next]