ShootBlues.Win32.ResumeThread C# (CSharp) Méthode

ResumeThread() private méthode

private ResumeThread ( IntPtr hThread ) : int
hThread System.IntPtr
Résultat int
        public static extern int ResumeThread(IntPtr hThread);

Usage Example

        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);
                }
            }));
        }