Skip to content

Commit

Permalink
Added fallback in GetProcessName if we can't open the process directly.
Browse files Browse the repository at this point in the history
  • Loading branch information
James Forshaw committed Feb 22, 2018
1 parent 282cc7f commit 0f2d0aa
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions FindZombieHandles/Program.cs
Expand Up @@ -65,6 +65,17 @@ static string GetProcessName(int process_id, bool verbose)
else
return process.Result.Name;
}
else
{
try
{
return Process.GetProcessById(process_id).ProcessName;
}
catch (ArgumentException)
{
}
}

return "Unknown";
}
}
Expand Down

0 comments on commit 0f2d0aa

Please sign in to comment.