Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ProcessWaitHandle()

Interop.Kernel32.ProcessWaitHandle.ProcessWaitHandle ( SafeProcessHandle processHandle)
inlinepackage

Definition at line 73 of file Interop.cs.

74 {
75 IntPtr currentProcess = GetCurrentProcess();
76 if (!DuplicateHandle(currentProcess, (SafeHandle)processHandle, currentProcess, out SafeWaitHandle targetHandle, 0, bInheritHandle: false, 2))
77 {
78 int hRForLastWin32Error = Marshal.GetHRForLastWin32Error();
79 targetHandle.Dispose();
80 Marshal.ThrowExceptionForHR(hRForLastWin32Error);
81 }
82 this.SetSafeWaitHandle(targetHandle);
83 }
static IntPtr GetCurrentProcess()
static bool DuplicateHandle(IntPtr hSourceProcessHandle, SafeHandle hSourceHandle, IntPtr hTargetProcess, out SafeFileHandle targetHandle, int dwDesiredAccess, bool bInheritHandle, int dwOptions)
static void ThrowExceptionForHR(int errorCode)
Definition Marshal.cs:1232

References Interop.Kernel32.DuplicateHandle(), Interop.Kernel32.GetCurrentProcess(), System.Runtime.InteropServices.Marshal.GetHRForLastWin32Error(), and System.Runtime.InteropServices.Marshal.ThrowExceptionForHR().