GetProcessHandle() private method

Gets a short-term handle to the process, with the given access. If a handle exists, then it is reused. If the process has exited, it throws an exception.
private GetProcessHandle ( ) : SafeProcessHandle
return Microsoft.Win32.SafeHandles.SafeProcessHandle
Esempio n. 1
0
 static SafeProcessHandle SafeGetHandle(Process process)
 {
     try
     {
         return(process.GetProcessHandle(Interop.Advapi32.ProcessOptions.PROCESS_QUERY_LIMITED_INFORMATION, false));
     }
     catch (Win32Exception)
     {
         return(SafeProcessHandle.InvalidHandle);
     }
 }