OpenProcess (kernel32)
Last changed: -82.217.243.244

.
Summary

C# Signature:

[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr OpenProcess(
     uint processAccess,
     bool bInheritHandle,
     int processId
);
public static IntPtr OpenProcess(Process proc, ProcessAccessFlags flags)
{
     return OpenProcess(flags, false, proc.Id);
}

VB.NET Signature:

Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As ProcessAccessFlags, bInheritHandle As Boolean, processId As UInt32) As IntPtr

Boo Signature:

[DllImport("kernel32.dll")]
def OpenProcess(dwDesiredAccess as UInt32, bInheritHandle as bool, dwProcessID as UInt32) as IntPtr:
     pass

User-Defined Types:

    [Flags]
    public enum ProcessAccessFlags : uint
    {
        All = 0x001F0FFF,
        Terminate = 0x00000001,
        CreateThread = 0x00000002,
        VirtualMemoryOperation = 0x00000008,
        VirtualMemoryRead = 0x00000010,
        VirtualMemoryWrite = 0x00000020,
        DuplicateHandle = 0x00000040,
        CreateProcess = 0x000000080,
        SetQuota = 0x00000100,
        SetInformation = 0x00000200,
        QueryInformation = 0x00000400,
        QueryLimitedInformation = 0x00001000,
        Synchronize = 0x00100000
    }

    <Flags>
    Public Enum ProcessAccessFlags As UInteger
    All = &H1F0FFF
    Terminate = &H1
    CreateThread = &H2
    VirtualMemoryOperation = &H8
    VirtualMemoryRead = &H10
    VirtualMemoryWrite = &H20
    DuplicateHandle = &H40
    CreateProcess = &H80
    SetQuota = &H100
    SetInformation = &H200
    QueryInformation = &H400
    QueryLimitedInformation = &H1000
    Synchronize = &H100000
    End Enum

Notes:

See also CloseHandle,