Kernel32OpenProcess(ProcessAccessRights, Boolean, Int32) Method

Opens an existing local process object.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static SafeProcessHandle OpenProcess(
	ProcessAccessRights desiredAccess,
	bool inheritHandle,
	int pid
)

Parameters

desiredAccess  ProcessAccessRights
The access to the process object.

This access right is checked against the security descriptor for the process.

inheritHandle  Boolean
If this value is , processes created by this process will inherit the handle. Otherwise, the processes do not inherit this handle.
pid  Int32
The identifier of the local process to be opened

Return Value

SafeProcessHandle
If the function succeeds, the return value is an open handle to the specified process.

If the function fails, the return value is Zero.

To get extended error information, call GetLastWin32Error.

Remarks

See Also