Click or drag to resize
Xcalibur Systems LLC Logo

ProcessHelperDuplicateHandle Method

Duplicates an object handle.

DuplicateHandle function


Namespace: Xcalibur.NativeMethods.V2.Processes
Assembly: Xcalibur.NativeMethods.V2 (in Xcalibur.NativeMethods.V2.dll) Version: 1.0.1.0
Syntax
[DllImportAttribute("kernel32.dll", SetLastError = true)]
public static bool DuplicateHandle(
	IntPtr sourceProcessHandle,
	IntPtr sourceHandle,
	IntPtr targetProcessHandle,
	out IntPtr targetHandle,
	uint desiredAccess,
	bool inheritHandle,
	uint options
)

Parameters

sourceProcessHandle  IntPtr
A handle to the process with the handle to be duplicated.
sourceHandle  IntPtr
The handle to be duplicated. This is an open object handle that is valid in the context of the source process. For a list of objects whose handles can be duplicated, see the following Remarks section.
targetProcessHandle  IntPtr
A handle to the process that is to receive the duplicated handle. The handle must have the access right.
targetHandle  IntPtr
A pointer to a variable that receives the duplicate handle. This handle value is valid in the context of the target process.
desiredAccess  UInt32
The access requested for the new handle.
inheritHandle  Boolean
A variable that indicates whether the handle is inheritable. If TRUE, the duplicate handle can be inherited by new processes created by the target process. If FALSE, the new handle cannot be inherited.
options  UInt32
Optional actions. This parameter can be zero, or any combination of the following values.

Return Value

Boolean
If the function fails, the return value is zero. To get extended error information, call .
See Also