BOOL ImpersonateSelf(ImpersonationLevel) | |||
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; |
The ImpersonateSelf function may be used to obtain an Impersonation token representing your own process's context. This may be useful for enabling a privilege for a single thread rather than for the entire process; or changing the default DACL for a single thread.
The token is assigned to the callers thread.
ImpersonationLevel
The level to make the impersonation token.
The return value is TRUE if the function was successful, or FALSE if an error occurred. To obtain extended error information, use the GetLastError function.