![Xcalibur Systems LLC Logo](../icons/logo.png) |
ProcessHelperDuplicateHandle Method |
Namespace: Xcalibur.NativeMethods.V2.ProcessesAssembly: 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
)
<DllImportAttribute("kernel32.dll", SetLastError := true>]
Public Shared Function DuplicateHandle (
sourceProcessHandle As IntPtr,
sourceHandle As IntPtr,
targetProcessHandle As IntPtr,
<OutAttribute> ByRef targetHandle As IntPtr,
desiredAccess As UInteger,
inheritHandle As Boolean,
options As UInteger
) As Boolean
public:
[DllImportAttribute(L"kernel32.dll", SetLastError = true)]
static bool DuplicateHandle(
IntPtr sourceProcessHandle,
IntPtr sourceHandle,
IntPtr targetProcessHandle,
[OutAttribute] IntPtr% targetHandle,
unsigned int desiredAccess,
bool inheritHandle,
unsigned int options
)
[<DllImportAttribute("kernel32.dll", SetLastError = true)>]
static member DuplicateHandle :
sourceProcessHandle : IntPtr *
sourceHandle : IntPtr *
targetProcessHandle : IntPtr *
targetHandle : IntPtr byref *
desiredAccess : uint32 *
inheritHandle : bool *
options : uint32 -> bool
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
BooleanIf the function fails, the return value is zero. To get extended error
information, call .
See Also