Skip to content

Latest commit

 

History

History
61 lines (42 loc) · 1.48 KB

OpenProcessToken.md

File metadata and controls

61 lines (42 loc) · 1.48 KB

Home

Function name : OpenProcessToken

Group: Authorization - Library: advapi32


Opens the access token associated with a process.


Code examples:

How to enable the SE_SHUTDOWN_NAME privilege for the application
Reading and setting system access privileges for the current process
How to load a user profile

Declaration:

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

FoxPro declaration:

DECLARE INTEGER OpenProcessToken IN advapi32;
	INTEGER ProcessHandle,;
	LONG DesiredAccess,;
	INTEGER @TokenHandle  

Parameters:

ProcessHandle [in] A handle to the process whose access token is opened.

DesiredAccess [in] Specifies an access mask that specifies the requested types of access to the access token.

TokenHandle [out] A pointer to a handle that identifies the newly opened access token when the function returns.


Return value:

If the function succeeds, the return value is nonzero.


Comments:

The process must have the PROCESS_QUERY_INFORMATION access permission.

Close the access token handle returned through the TokenHandle parameter by calling CloseHandle.