The LogonUser function attempts to log a user on to the local computer, that is, to the computer from which LogonUser was called. You cannot use LogonUser to log on to a remote computer. You specify the user with a user name and domain, and authenticate the user with a clear-text password. If the function succeeds, you receive a handle to a token that represents the logged-on user. You can then use this token handle to impersonate the specified user, or in most cases, to create a process running in the context of the specified user. BOOL LogonUser( LPTSTR lpszUsername, // user name LPTSTR lpszDomain, // domain or server LPTSTR lpszPassword, // password DWORD dwLogonType, // type of logon operation DWORD dwLogonProvider, // logon provider PHANDLE phToken // receive tokens handle );
LPTSTR lpszUsername, // user name
LPTSTR lpszDomain, // domain or server
LPTSTR lpszPassword, // password
DWORD dwLogonType, // type of logon operation
DWORD dwLogonProvider, // logon provider
PHANDLE phToken // receive tokens handle
);