* based on an idea by Alf Borrmann CLEAR LOCAL lnOK, lnHandle DECLARE Long LogonUser IN WIN32API ; String, String, String, Long, Long, Long@ DECLARE LONG GetLastError IN WIN32API lnHandle = 0 * SeNetworkLogonRight * SeTcbPrivilege (Windows 2000 and prior) lnOK = LogOnUser( "username", "domain", "password", 3, 0, @lnHandle ) IF m.lnOK == 0 ? "Error in LogOnUser ", GetLastError() RETURN ENDIF DECLARE Long ImpersonateLoggedOnUser IN WIN32API Long DECLARE Long RevertToSelf IN WIN32API ? SYS(0) lnOK = ImpersonateLoggedOnUser( lnHandle ) IF m.lnOK == 0 ? "Impersonation failed" ELSE ? SYS(0) RevertToSelf() ? SYS(0) ENDIF DECLARE Long CloseHandle IN WIN32API Long CloseHandle(lnHandle)