private void AddProcess(uint id) { if (_processTable.ContainsKey(id)) { return; } var p = Process.GetProcessById((int)id); _processTable.Add(id, p); DebugProcess parent; try { parent = FindProcess(Processes, (uint)p.GetParentId()); } catch { parent = null; } var dp = new DebugProcess(p, parent); if (parent != null) { parent.Children.Add(dp); } else { Processes.Add(dp); } }
public void Detach(DebugProcess process) { foreach (var p in process.Children) { Detach(p); } DetachNode(process); }
private void DetachNode(DebugProcess process) { var result = Kernel32.DebugActiveProcessStop((uint)process.Process.Id); if (!result) { throw new InvalidOperationException("Could not detach"); } lock (_loaderBreakpointTable) { _loaderBreakpointTable.Remove((uint)process.Process.Id); } }
private void Kill(DebugProcess process) { foreach (var p in process.Children) { Kill(p); } try { DetachNode(process); } catch { } try { process.Process.Kill(); } catch { } process.Process.WaitForExit(); }
public DebugProcess(Process process, DebugProcess parent) { Process = process; Parent = parent; Children = new List <DebugProcess>(); }