Platform SDK: Access Control |
The OpenProcessToken function opens the access token associated with a process.
BOOL OpenProcessToken( HANDLE ProcessHandle, // handle to process DWORD DesiredAccess, // desired access to process PHANDLE TokenHandle // handle to open access token );
For a list of access rights for access tokens, see Access Rights for Access-Token Objects.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remember to close the access token handle returned through the TokenHandle parameter by calling CloseHandle.
Windows NT/2000: Requires Windows NT 3.1 or later.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Advapi32.lib.
Access Control Overview, Access Control Functions, AdjustTokenGroups, AdjustTokenPrivileges, GetTokenInformation, OpenThreadToken, SetTokenInformation