예제 #1
0
 public void ResumeProcess(int PID)
 {
     try
     {
         Process processById = Process.GetProcessById(PID);
         if (processById.ProcessName != string.Empty)
         {
             foreach (ProcessThread thread in processById.Threads)
             {
                 IntPtr hThread = APIs.OpenThread(APIs.ThreadAccess.SUSPEND_RESUME, false, Convert.ToUInt32(thread.Id));
                 if (hThread == IntPtr.Zero)
                 {
                     break;
                 }
                 APIs.ResumeThread(hThread);
             }
         }
     }catch {}
 }
예제 #2
0
        public override void Run()
        {
            try
            {
                Process proc = Process.GetProcessById(PID);
                foreach (ProcessThread thread in proc.Threads)
                {
                    if (ID == thread.Id)
                    {
                        IntPtr hThread = IntPtr.Zero;
                        if (type == 0 || type == 1)
                        {
                            hThread = APIs.OpenThread(APIs.ThreadAccess.SUSPEND_RESUME, false, Convert.ToUInt32(thread.Id));
                        }
                        else if (type == 2)
                        {
                            hThread = APIs.OpenThread(APIs.ThreadAccess.TERMINATE, false, Convert.ToUInt32(thread.Id));
                        }

                        if (hThread == IntPtr.Zero)
                        {
                            break;
                        }

                        switch (type)
                        {
                        case 0:
                            APIs.SuspendThread(hThread);
                            break;

                        case 1:
                            APIs.ResumeThread(hThread);
                            break;

                        case 2:
                            APIs.TerminateThread(hThread, 0);
                            break;
                        }
                    }
                }
            }catch {}
        }