internal ProcessWaitHandle(SafeProcessHandle processHandle)
{
SafeWaitHandle waitHandle = null;
SafeProcessHandle currentProcHandle = Interop.Kernel32.GetCurrentProcess();
bool succeeded = Interop.Kernel32.DuplicateHandle(
currentProcHandle,
processHandle,
currentProcHandle,
out waitHandle,
0,
false,
Interop.Kernel32.HandleOptions.DUPLICATE_SAME_ACCESS);
if (!succeeded)
{
Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
}
this.SetSafeWaitHandle(waitHandle);
}
}