8 instantiations of SafeProcessHandle
aspire (2)
Processes\IsolatedProcess.Windows.cs (2)
109SafeProcessHandle? processHandle = new(pi.hProcess, ownsHandle: true); 229SafeProcessHandle? processHandle = new(pi.hProcess, ownsHandle: true);
PresentationCore (1)
MS\Internal\DpiUtil\DpiUtil+ProcessDpiAwarenessHelper.cs (1)
103using (var hProcess = new SafeProcessHandle(UnsafeNativeMethods.OpenProcess(NativeMethods.PROCESS_ALL_ACCESS, false, windowThreadProcessId), true))
System.Diagnostics.Process (5)
Microsoft\Win32\SafeHandles\SafeProcessHandle.cs (1)
28internal static readonly SafeProcessHandle InvalidHandle = new SafeProcessHandle();
Microsoft\Win32\SafeHandles\SafeProcessHandle.Unix.cs (3)
102processHandle = new SafeProcessHandle(waitStateHolder); 316return new SafeProcessHandle(waitStateHolder!); 501return new SafeProcessHandle(waitStateHolder!);
System\Diagnostics\Process.Unix.cs (1)
425return new SafeProcessHandle(_waitStateHolder!.IncrementRefCount());
74 references to SafeProcessHandle
aspire (11)
Processes\IsolatedProcess.Windows.cs (8)
109SafeProcessHandle? processHandle = new(pi.hProcess, ownsHandle: true); 137var capturedProcessHandle = processHandle ?? throw new InvalidOperationException("Windows process handle was not initialized."); 229SafeProcessHandle? processHandle = new(pi.hProcess, ownsHandle: true); 236var capturedProcessHandle = processHandle ?? throw new InvalidOperationException("Windows process handle was not initialized."); 266private static bool GetHasExited(SafeProcessHandle processHandle) 281private static int GetExitCode(SafeProcessHandle processHandle) 305private static Task WaitForProcessHandleExitAsync(SafeProcessHandle processHandle, CancellationToken cancellationToken) 311private static void ThrowIfDisposed(SafeProcessHandle processHandle, string memberName)
Processes\WindowsProcessInterop.cs (3)
190public static partial bool GetExitCodeProcess(SafeProcessHandle hProcess, out uint lpExitCode); 193public static partial uint WaitForSingleObject(SafeProcessHandle hHandle, uint dwMilliseconds); 667public static async Task WaitForExitAsync(SafeProcessHandle processHandle, CancellationToken cancellationToken)
netstandard (1)
netstandard.cs (1)
13[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.Win32.SafeHandles.SafeProcessHandle))]
PresentationCore (1)
MS\Internal\DpiUtil\DpiUtil+ProcessDpiAwarenessHelper.cs (1)
103using (var hProcess = new SafeProcessHandle(UnsafeNativeMethods.OpenProcess(NativeMethods.PROCESS_ALL_ACCESS, false, windowThreadProcessId), true))
System (1)
src\runtime\src\libraries\shims\System\ref\System.cs (1)
9[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.Win32.SafeHandles.SafeProcessHandle))]
System.Diagnostics.PerformanceCounter (11)
_generated\0\LibraryImports.g.cs (5)
478internal static partial bool GetProcessTimes(global::Microsoft.Win32.SafeHandles.SafeProcessHandle handle, out long creation, out long exit, out long kernel, out long user) 491global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeProcessHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new(); 676internal static partial global::Microsoft.Win32.SafeHandles.SafeProcessHandle OpenProcess(int access, bool inherit, int processId) 683global::Microsoft.Win32.SafeHandles.SafeProcessHandle __retVal = default; 686global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeProcessHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.GetProcessTimes.cs (1)
15SafeProcessHandle handle, out long creation, out long exit, out long kernel, out long user);
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.OpenProcess.cs (1)
13internal static partial SafeProcessHandle OpenProcess(
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.ProcessWaitHandle.cs (1)
15internal ProcessWaitHandle(SafeProcessHandle processHandle)
System\Diagnostics\SharedPerformanceCounter.cs (3)
49using (SafeProcessHandle procHandle = Interop.Kernel32.OpenProcess(Interop.Advapi32.ProcessOptions.PROCESS_QUERY_INFORMATION, false, pid)) 1303using (SafeProcessHandle procHandle = Interop.Kernel32.OpenProcess(Interop.Advapi32.ProcessOptions.PROCESS_QUERY_INFORMATION, false, pid)) 1335using (SafeProcessHandle procHandle = Interop.Kernel32.OpenProcess(Interop.Advapi32.ProcessOptions.SYNCHRONIZE, false, pid))
System.Diagnostics.Process (49)
Microsoft\Win32\SafeHandles\SafeProcessHandle.cs (10)
28internal static readonly SafeProcessHandle InvalidHandle = new SafeProcessHandle(); 63/// <returns>A <see cref="SafeProcessHandle"/> that represents the opened process.</returns> 86public static SafeProcessHandle Open(int processId) 90if (!TryOpenCore(processId, out SafeProcessHandle? handle, out int lastError)) 102/// <param name="processHandle">When this method returns <see langword="true"/>, contains the <see cref="SafeProcessHandle"/> for the opened process; otherwise, <see langword="null"/>.</param> 125public static bool TryOpen(int processId, [NotNullWhen(true)] out SafeProcessHandle? processHandle) 148/// <returns>A <see cref="SafeProcessHandle"/> representing the started process.</returns> 157public static SafeProcessHandle Start(ProcessStartInfo startInfo) 167internal static SafeProcessHandle Start(ProcessStartInfo startInfo, bool fallbackToNull) 451var (handle, tcs) = ((SafeProcessHandle, TaskCompletionSource<bool>))state!;
Microsoft\Win32\SafeHandles\SafeProcessHandle.Unix.cs (9)
77private static bool TryOpenCore(int processId, [NotNullWhen(true)] out SafeProcessHandle? processHandle, out int lastError) 202private delegate SafeProcessHandle StartWithShellExecuteDelegate(ProcessStartInfo startInfo, SafeFileHandle? stdinHandle, SafeFileHandle? stdoutHandle, SafeFileHandle? stderrHandle, out ProcessWaitState.Holder? waitStateHolder); 205private static SafeProcessHandle StartCore(ProcessStartInfo startInfo, SafeFileHandle? stdinHandle, SafeFileHandle? stdoutHandle, SafeFileHandle? stderrHandle, SafeHandle[]? inheritedHandlesSnapshot = null) 208internal static SafeProcessHandle StartCore(ProcessStartInfo startInfo, SafeFileHandle? stdinHandle, SafeFileHandle? stdoutHandle, 246internal static unsafe SafeProcessHandle StartWithCallback(ProcessStartInfo startInfo, SafeFileHandle? stdinFd, SafeFileHandle? stdoutHandle, SafeFileHandle? stderrHandle, 356private static SafeProcessHandle StartWithShellExecute(ProcessStartInfo startInfo, SafeFileHandle? stdinHandle, SafeFileHandle? stdoutHandle, 390SafeProcessHandle processHandle = ForkAndExecProcess( 411SafeProcessHandle result = ForkAndExecProcess( 428private static SafeProcessHandle ForkAndExecProcess(
System\Diagnostics\Process.cs (14)
31private SafeProcessHandle? _processHandle; 121public SafeProcessHandle SafeHandle 1213private SafeProcessHandle GetOrOpenProcessHandle() 1229private void SetProcessHandle(SafeProcessHandle processHandle) 1784/// <inheritdoc cref="SafeProcessHandle.Signal(PosixSignal)"/> 1801/// <inheritdoc cref="SafeProcessHandle.WaitForExit()"/> 1824if (SafeProcessHandle.TryOpen(_processId, out SafeProcessHandle? processHandle)) 1836/// <inheritdoc cref="SafeProcessHandle.TryWaitForExit(TimeSpan, out ProcessExitStatus?)"/> 1860if (SafeProcessHandle.TryOpen(_processId, out SafeProcessHandle? processHandle)) 1871/// <inheritdoc cref="SafeProcessHandle.WaitForExitAsync(CancellationToken)"/> 1894if (SafeProcessHandle.TryOpen(_processId, out SafeProcessHandle? processHandle))
System\Diagnostics\Process.Scenarios.cs (6)
54using SafeProcessHandle processHandle = SafeProcessHandle.Start(startInfo, fallbackToNull: true); 109using SafeProcessHandle processHandle = SafeProcessHandle.Start(startInfo); 174using SafeProcessHandle processHandle = SafeProcessHandle.Start(startInfo);
System\Diagnostics\Process.Unix.cs (6)
412private SafeProcessHandle GetProcessHandle() 430SafeProcessHandle startedProcess = SafeProcessHandle.StartCore(startInfo, stdinHandle, stdoutHandle, stderrHandle, inheritedHandles, out ProcessWaitState.Holder? waitStateHolder); 436SafeProcessHandle startedProcess = SafeProcessHandle.StartWithCallback(startInfo, stdinHandle, stdoutHandle, stderrHandle, callback, out ProcessWaitState.Holder? waitStateHolder); 440private bool SetProcessHandle(SafeProcessHandle startedProcess, ProcessWaitState.Holder waitStateHolder)
System\Diagnostics\ProcessStartInfo.cs (4)
153/// The process will not begin execution until <see cref="SafeProcessHandle.Resume" /> is called 154/// on the <see cref="SafeProcessHandle" /> returned by <see cref="SafeProcessHandle.Start(ProcessStartInfo)" />. 362SafeProcessHandle.EnsureShellExecuteFunc();