diff --git a/trunk/CHANGELOG.txt b/trunk/CHANGELOG.txt index 3e6a21a0f..bc665eb97 100644 --- a/trunk/CHANGELOG.txt +++ b/trunk/CHANGELOG.txt @@ -11,6 +11,8 @@ Process Hacker * Process properties for DPCs and Interrupts * Disabled expanding of processes when double-clicking them + * Now shows non-existent parent PIDs + * build-and-clean script is now XP compatible 1.3.0.0 * NEW: diff --git a/trunk/HACKING.txt b/trunk/HACKING.txt index d16a14db1..cfeedbf7c 100644 --- a/trunk/HACKING.txt +++ b/trunk/HACKING.txt @@ -1,7 +1,7 @@ NOTE: Process Hacker uses a script in the Build directory named merge_and_clean.cmd. If you do not want this script to delete *.pdb files or merge Aga.Controls.dll -with ProcessHacker.exe, edit the script. +with ProcessHacker.exe, edit the script or the project settings for ProcessHacker. Note to SVN users: If you use SVN code you may encounter weird bugs. Please use releases instead. @@ -23,6 +23,8 @@ GUIDE TO DIRECTORY ORGANIZATION * ProcessHacker - contains all of Process Hacker's source code. * Asm - this contains the assembler and disassembler, converted to unsafe C# code from Oleh Yuschuk's Free Disassembler and Assembler. + * Build - contains the build-and-clean script - merges Aga.Controls.dll with + ProcessHacker.exe. * Components - contains various "user controls" like the (possibly reusable) ProcessList, ThreadList and ServiceList. It also contains third-party user controls like HexBox and VistaMenu. diff --git a/trunk/ProcessHacker/Build/merge_and_clean.cmd b/trunk/ProcessHacker/Build/merge_and_clean.cmd index a666e1d6f..9b308a9d7 100644 --- a/trunk/ProcessHacker/Build/merge_and_clean.cmd +++ b/trunk/ProcessHacker/Build/merge_and_clean.cmd @@ -1,10 +1,11 @@ @echo off set outd=%~p1 -@ check if ILMerge is present -where ilmerge -if not %errorlevel%==0 goto end +@rem check if ILMerge is present +ilmerge +if %errorlevel%==9009 goto end +:do rename "%outd%\ProcessHacker.exe" ProcessHacker_in.exe ilmerge /t:winexe /out:"%outd%\ProcessHacker.exe" "%outd%\ProcessHacker_in.exe" "%outd%\Aga.Controls.dll" del "%outd%\ProcessHacker_in.exe" diff --git a/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs b/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs index 7b700770e..9a2eda467 100644 --- a/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs +++ b/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs @@ -40,7 +40,7 @@ namespace ProcessHacker ProcessNode itemNode = new ProcessNode(item); // find this process' parent - if (_processes.ContainsKey(item.ParentPID)) + if (item.HasParent && _processes.ContainsKey(item.ParentPID)) _processes[item.ParentPID].Children.Add(itemNode); else _roots.Add(itemNode); diff --git a/trunk/ProcessHacker/Forms/HackerWindow.cs b/trunk/ProcessHacker/Forms/HackerWindow.cs index 48f4d40a5..949beaab9 100644 --- a/trunk/ProcessHacker/Forms/HackerWindow.cs +++ b/trunk/ProcessHacker/Forms/HackerWindow.cs @@ -763,7 +763,7 @@ namespace ProcessHacker ProcessItem parent = new ProcessItem(); string parentText = ""; - if (item.ParentPID != -1) + if (item.HasParent) { try { diff --git a/trunk/ProcessHacker/Forms/ProcessWindow.cs b/trunk/ProcessHacker/Forms/ProcessWindow.cs index 5bf6f3dcc..76f5ff1d0 100644 --- a/trunk/ProcessHacker/Forms/ProcessWindow.cs +++ b/trunk/ProcessHacker/Forms/ProcessWindow.cs @@ -212,7 +212,7 @@ namespace ProcessHacker textPEBAddress.Text = "(" + ex.Message + ")"; } - if (_processItem.ParentPID != -1) + if (_processItem.HasParent) { if (Program.HackerWindow.ProcessProvider.Dictionary.ContainsKey(_processItem.ParentPID)) { @@ -226,9 +226,19 @@ namespace ProcessHacker buttonInspectParent.Enabled = false; } } + else if (_processItem.ParentPID == -1) + { + // this process doesn't actually have a parent + textParent.Text = "No Parent Process"; + buttonInspectParent.Enabled = false; + } else { - textParent.Text = "No parent"; + // This process had a parent and it's dead, but + // another running process has the same PID as + // its parent. We checked their creation times + // back in ProcessSystemProvider.cs. + textParent.Text = "Non-existent Process (" + _processItem.ParentPID.ToString() + ")"; buttonInspectParent.Enabled = false; } diff --git a/trunk/ProcessHacker/Providers/ProcessSystemProvider.cs b/trunk/ProcessHacker/Providers/ProcessSystemProvider.cs index 16a0ecc19..d33580217 100644 --- a/trunk/ProcessHacker/Providers/ProcessSystemProvider.cs +++ b/trunk/ProcessHacker/Providers/ProcessSystemProvider.cs @@ -48,6 +48,7 @@ namespace ProcessHacker public bool IsVirtualizationEnabled; public long LastTime; public int SessionId; + public bool HasParent; public int ParentPID; public int IconAttempts; @@ -258,10 +259,14 @@ namespace ProcessHacker else if (pid == -2) { item.FileDescription = "Deferred Procedure Calls"; + item.ParentPID = 0; + item.HasParent = true; } else if (pid == -3) { item.FileDescription = "Hardware Interrupts"; + item.ParentPID = 0; + item.HasParent = true; } else { @@ -314,15 +319,19 @@ namespace ProcessHacker try { item.ParentPID = item.ProcessQueryLimitedHandle.GetParentPID(); + item.HasParent = true; if (!procs.ContainsKey(item.ParentPID)) { - item.ParentPID = -1; + item.HasParent = false; } else if (pid > 4 && item.ParentPID == 0) { - // the PID is 0 for processes we got Access Denied on + // the PID is 0 for processes we got Access Denied on, + // but they don't really have System Idle Process + // as their parent. item.ParentPID = -1; + item.HasParent = false; } else { @@ -331,12 +340,13 @@ namespace ProcessHacker long thisStartTime = processInfo.CreateTime; if (parentStartTime > thisStartTime) - item.ParentPID = -1; + item.HasParent = false; } } catch { item.ParentPID = -1; + item.HasParent = false; } } catch