Esempio n. 1
0
        private void butAttach_Click(object sender, EventArgs e)
        {
            if (listProcess.SelectedIndices.Count == 0)
            {
                return;
            }

            ListViewItem selItem = listProcess.SelectedItems[0];

            // Get Process ID and attach
            int  pid    = Convert.ToInt32(selItem.SubItems[0].Text, 16);
            bool attach = _manager.Attach(pid);

            // Update ICommuncator's Ready property and, if atached, update lastPID
            if (attach)
            {
                _communicator.lastPID = pid;
                _manager.ContinueProcess();
            }
            _communicator.Ready = attach;
        }
        public bool Reconnect()
        {
            // Make sure our reconnect variables are valid
            if (_manager == null)
            {
                return(false);
            }
            if (lastPID <= 0)
            {
                return(false);
            }

            // Get current process state, attach process, return process to original state
            Types.ProcessState state = GetProcessState();
            bool attach = _manager.Attach(lastPID);

            if (attach)
            {
                SetProcessState(state);
            }
            return(attach);
        }