GetLastError()?

#1
In general, will I get accurate results calling GetLastError() after a TCC/SDK API fails?

In particular, how about AllocMem()? ... as in

Code:
LPVOID p = AllocMem(size);
if ( p == NULL )
    return error(GetLastError(), L"AllocMem");
 

rconn

Administrator
Staff member
May 14, 2008
10,321
94
#2
> In general, will I get accurate results calling GetLastError() after a
> TCC/SDK API fails?
In general, but not for APIs that don't call Windows, and not for APIs that
call Windows but then call another Windows API after the first one fails.


> In particular, how about AllocMem()? ... as in
But not for AllocMem(), which doesn't call Windows (except for the first
allocation).

The only way AllocMem() will fail is if Windows is out of memory.

Rex Conn
JP Software