Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 1.13 KB

ImpersonateLoggedOnUser.md

File metadata and controls

47 lines (31 loc) · 1.13 KB

Home

Function name : ImpersonateLoggedOnUser

Group: Security - Library: advapi32


The ImpersonateLoggedOnUser function lets the calling thread impersonate the security context of a logged-on user. The user is represented by a token handle.


Code examples:

How to run FoxPro application under different user name (impersonating user)

Declaration:

BOOL ImpersonateLoggedOnUser(
  HANDLE hToken
);  

FoxPro declaration:

DECLARE INTEGER ImpersonateLoggedOnUser IN advapi32;
	INTEGER hToken  

Parameters:

hToken [in] Handle to a primary or impersonation access token that represents a logged-on user.


Return value:

If the function succeeds, the return value is nonzero.


Comments:

hToken can be a token handle returned by a call to LogonUser, CreateRestrictedToken, DuplicateToken, DuplicateTokenEx, OpenProcessToken, or OpenThreadToken functions.