No domain available, local user. Though some funny results I have -- you'll probably be laughing :)
Look at this code:
LOCAL nToken, cProcInfo, cStartInfo, nCreationFlags, nLastError
nToken = 0
= LogonUser(cUsr, cDomain, cPwd,;
LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, @nToken)
nLastError = GetLastError()
IF nToken = 0
? "Error:", nLastError
RETURN .F.
ENDIF
When executed as
a single piece, the code returns valid error code as expected.
Even if logon error happens, the code returns zero as LastError code when executed (ATTENTION!!!)
- in Command Window
- in Debug mode (step by step)
- with an artificial delay inserted right after the LogonUser call
Looks like the LastErrorCode value does not survive long after the LogonUser call, some process quickly sets it back to zero.
I checked several times just to make sure that I was sane enough :) on Friday afternoon. Let me know if it helps.