OpenThread() private méthode

private OpenThread ( ThreadAccessFlags dwDesiredAccess, bool bInheritHandle, int dwThreadId ) : IntPtr
dwDesiredAccess ThreadAccessFlags
bInheritHandle bool
dwThreadId int
Résultat System.IntPtr
        public static Finally SuspendProcess(Process process)
        {
            var suspendedThreads = new HashSet <IntPtr>();

            foreach (ProcessThread thread in process.Threads)
            {
                var hThread = Win32.OpenThread(ThreadAccessFlags.SuspendResume, false, thread.Id);
                if (hThread != IntPtr.Zero)
                {
                    suspendedThreads.Add(hThread);
                    Win32.SuspendThread(hThread);
                }
                else
                {
                    Console.WriteLine("Could not open thread {0}", thread.Id);
                }
            }

            return(Finally.Do(() => {
                foreach (IntPtr hThread in suspendedThreads)
                {
                    Win32.ResumeThread(hThread);
                    Win32.CloseHandle(hThread);
                }
            }));
        }