Kernel32OpenThread(ThreadAccessRights, Boolean, UInt32) Method

Opens an existing thread object.

When done, don't forget to call CloseHandle(IntPtr) function.

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", SetLastError = true)]
public static SafeAccessTokenHandle OpenThread(
	ThreadAccessRights desiredAccess,
	bool inheritHandle,
	uint threadId
)

Parameters

desiredAccess  ThreadAccessRights
The access to the thread object.

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

inheritHandle  Boolean
If this value is , processes created by this process will inherit the handle.

Otherwise, the processes do not inherit this handle.

threadId  UInt32
The identifier of the thread to be opened.

Return Value

SafeAccessTokenHandle
If the function succeeds, the return value is an open handle to the specified thread.

If the function fails, the return value is Zero.

To get extended error information, call GetLastWin32Error.

Remarks

See Also