Ejemplo n.º 1
0
 private void detachFromDebuggerProcessMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         using (var phandle = new ProcessHandle(processSelectedPid, ProcessAccess.QueryInformation | ProcessAccess.SuspendResume))
         {
             using (var dhandle = phandle.GetDebugObject())
                 phandle.RemoveDebug(dhandle);
         }
     }
     catch (WindowsException ex)
     {
         if (ex.Status == NtStatus.PortNotSet)
             PhUtils.ShowInformation("The process is not being debugged.");
         else
             PhUtils.ShowException("Unable to detach the process", ex);
     }
 }