コード例 #1
0
        private void DetachFromProcess(int rowIndex)
        {
            string processName = ProcessesListDataGridView.Rows[rowIndex].Cells[0].Value.ToString();
            int    pid         = Convert.ToInt32(ProcessesListDataGridView.Rows[rowIndex].Cells[1].Value);

            OrbisDbg.SetProcess(processName);
            if (mainForm.AllowDetach())
            {
                mainForm.SetButtonsEnabled(false);

                if (mainForm.memoryForm != null)
                {
                    mainForm.memoryForm.Close();
                }

                if (mainForm.disassemblyForm != null)
                {
                    mainForm.disassemblyForm.Close();
                }

                if (mainForm.breakpointForm != null)
                {
                    mainForm.breakpointForm.Close();
                }

                if (mainForm.registersForm != null)
                {
                    mainForm.registersForm.Close();
                }

                if (Convert.ToBoolean(ProcessesListDataGridView.Rows[rowIndex].Cells[2].Value))
                {
                    ProcessesListDataGridView.Rows[rowIndex].Cells[2].Value = false;

                    for (int i = 0; i < mainForm.pList.Count; i++)
                    {
                        if (mainForm.pList[i].pid == pid)
                        {
                            mainForm.pList[i].attached = 0;
                            break;
                        }
                    }

                    OrbisDbg.DetachProcess();
                }
            }
            else
            {
                MessageBox.Show("Please clear breakpoints before detaching from this process", "Process can't detach");
            }
        }