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

◆ GetProcessHandle() [2/2]

SafeProcessHandle System.Diagnostics.Process.GetProcessHandle ( int access,
bool throwIfExited = true )
inlineprivate

Definition at line 1972 of file Process.cs.

1973 {
1975 {
1976 if (throwIfExited)
1977 {
1978 using global::Interop.Kernel32.ProcessWaitHandle processWaitHandle = new global::Interop.Kernel32.ProcessWaitHandle(_processHandle);
1979 if (processWaitHandle.WaitOne(0))
1980 {
1981 throw new InvalidOperationException(_haveProcessId ? System.SR.Format(System.SR.ProcessHasExited, _processId.ToString()) : System.SR.ProcessHasExitedNoId);
1982 }
1983 }
1985 }
1986 EnsureState((State)3);
1987 SafeProcessHandle safeProcessHandle = ProcessManager.OpenProcess(_processId, access, throwIfExited);
1988 if (throwIfExited && ((uint)access & 0x400u) != 0 && global::Interop.Kernel32.GetExitCodeProcess(safeProcessHandle, out _exitCode) && _exitCode != 259)
1989 {
1991 }
1992 return safeProcessHandle;
1993 }
SafeProcessHandle _processHandle
Definition Process.cs:98
void EnsureState(State state)
Definition Process.cs:1006
static string ProcessHasExited
Definition SR.cs:32
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
Definition SR.cs:7

References System.Diagnostics.Process._exitCode, System.Diagnostics.Process._haveProcessHandle, System.Diagnostics.Process._haveProcessId, System.Diagnostics.Process._processHandle, System.Diagnostics.Process._processId, System.Runtime.InteropServices.SafeHandle.DangerousGetHandle(), System.Runtime.Serialization.Dictionary, System.Diagnostics.Process.EnsureState(), System.SR.Format(), System.Diagnostics.ProcessManager.OpenProcess(), System.SR.ProcessHasExited, and System.SR.ProcessHasExitedNoId.