OpenProcessToken (advapi32)
Last changed: -

The OpenProcessToken function opens the access token associated with a process, using this function we can get a handle to the access token assosiated to the process, if needed we can use this hanle with GetTokenInformation Api function to get SID and other informations inside that token.

C# Signature:

[DllImport("advapi32.dll", SetLastError=true)]
static extern bool OpenProcessToken(IntPtr ProcessHandle,
   UInt32 DesiredAccess, out IntPtr TokenHandle);

VB Signature:

Declare Function OpenProcessToken Lib "advapi32.dll" (ProcessHandle As IntPtr, _
   DesiredAccess As Integer, ByRef TokenHandle As IntPtr) As Boolean



Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Alternative Managed API:

Do you know one? Please contribute it!