SetLastError

SetLastError sets the last-error code for the calling thread.

Syntax

VOID SetLastError(
    DWORD ErrCode
);

Parameters

ErrCode

The last error code for the thread.

Return Value

This function does not return a value.

Remarks

Error codes are 64-bit values. (Bit 63 is the most significant bit.) Bit 61 is reserved for application-defined error codes; no RTAPI error code has this bit set. If you are defining an error code for your application, set this bit to indicate that the error code has been defined by your application and ensure that your error code does not conflict with any system-defined error codes.

Most functions provided in RTX64 call SetLastError when they fail. Function failure is typically indicated by a return value error code such as FALSE, NULL, 0XFFFFFFFF, or -1.

Applications can retrieve the value saved by this function by using GetLastError. The use of GetLastError is optional; an application can call it to find out the specific reason for a function failure.

The last error code is kept in thread local storage so that multiple threads do not overwrite each other's values.

Requirements

Minimum Supported Version RTX64 2013
Header windows.h
Library Rtx_Rtss.lib

See Also:

GetLastError