IRAPISession::CeGetLastError (Windows Embedded CE 6.0)

1/6/2010

This method returns the calling thread's last-error code value related to RAPI2 method calls.

Syntax

DWORD CeGetLastError( void );

Parameters

None.

Return Value

The calling thread's last-error code value indicates success. Functions set this value by calling the SetLastError function. The Return Value section of each reference page notes the conditions under which the function sets the last-error code.

Remarks

You should call the IRAPISession::CeGetLastError function 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 RAPI2 functions in the 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.

Error codes are 32-bit values (bit 31 is the most significant bit). Bit 29 is reserved for application-defined error codes; no system error code has this bit set. If you are defining an error code for your application, set this bit to one. That indicates that the error code has been defined by an application, and ensures that your error code does not conflict with any error codes defined by the system.

IRAPISession::CeGetLastError is not considered thread-safe. If your application creates multiple client threads, they all make RAPI2 calls using the same session object. Since the last-error code value is shared globally, a failed RAPI2 call can overwrite the last-error code value written by a RAPI2 call on another thread..

To obtain an error string for system error codes, use the FormatMessage function. For a complete list of error codes, see Error Values or the SDK header file WINERROR.H.

Requirements

Header rapi2.h
Library ole32.lib, rapiuuid.lib
Windows Embedded CE Windows Embedded CE 6.0 and later

See Also

Reference

IRAPISession