OpenProcessToken

  BOOL OpenProcessToken(ProcessHandle, DesiredAccess, TokenHandle)    
  HANDLE ProcessHandle;    
  DWORD DesiredAccess;    
  PHANDLE TokenHandle;    

The OpenProcessToken function opens a token object associated with a process. The function obtains a handle that may be used to access that token.

Parameters

ProcessHandle

Handle that specifies the process whose token is to be opened.

DesiredAccess

An access mask that specifies the desired types of access to the token. These desired access types are reconciled against the token's discretionary access control list (ACL) to determine which accesses are granted or denied.

TokenHandle

Pointer to a handle that the function will set to the handle of the newly-opened token.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

See Also

AdjustTokenGroups, AdjustTokenPrivileges, GetTokenInformation, OpenThreadToken, SetTokenInformation