tools/VsIdeHostAdapter/TargetAddIn/Common/ProcessUtil.cs
/// <summary>
/// Throws if the process with given PID does not exist.
/// </summary>
Throws if the process with given PID does not exist.
Throws if the process with given PID does not exist .
private static void EnsureProcessExists(int processId)
        {
            IntPtr process = IntPtr.Zero;
            try
            {
                process = NativeMethods.OpenProcess(NativeMethods.PROCESS_QUERY_INFORMATION, false, (uint)processId);
                if (process == IntPtr.Zero)
                {
                    throw Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error());
                }
            }
            finally
            {
                if (process != IntPtr.Zero)
                {
                    NativeMethods.CloseHandle(process);
                }
            }
        }
private static void EnsureProcessExists ( int processId ) { IntPtr process = IntPtr . Zero ; try { process = NativeMethods . OpenProcess ( NativeMethods . PROCESS_QUERY_INFORMATION , false , ( uint ) processId ) ; if ( process == IntPtr . Zero ) { throw Marshal . GetExceptionForHR ( Marshal . GetHRForLastWin32Error ( ) ) ; } } finally { if ( process != IntPtr . Zero ) { NativeMethods . CloseHandle ( process ) ; } } }
Throws if the process with given PID does not exist.
Throws if the process with given PID does not exist .
// It process itself does not exist, we throw.
processId
int