GetLastError

GetLastError returns the calling thread's last-error code value. The last-error code is maintained on a per-thread basis. Multiple threads do not overwrite each other's last-error code.

Syntax

DWORD GetLastError(VOID);

Parameters

This function has no parameters.

Return Value

The calling thread's last-error code value.

Functions set this value by calling SetLastError.

Remarks

Call GetLastError immediately when a function's return value indicates that such a call will return useful data. That is because some functions call SetLastError(0) when they succeed, wiping out the error code set by the most recently failed function.

Most functions provided in RTX64 that set the thread's last error code value set it when they fail; a few functions set it when they succeed. Function failure is typically indicated by a return value error code such as FALSE, NULL, 0XFFFFFFFF, or -1. Some functions call SetLastError under conditions of success; those cases are noted in each function's reference page.

The GetLastError function should always return correct information in the RTSS environment. When a Windows RTX64 call fails, GetLastError may not return the correct error code if the API reference does specify the use of GetLastError.

Requirements

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

See Also:

SetLastError