If the 32-bit version fails but 64-bit works → .
using System.Diagnostics; using System.Runtime.InteropServices; var pid = int.Parse(args[0]); var process = Process.GetProcessById(pid); try
Console.WriteLine("Error: " + ex.Message);
foreach (ProcessModule m in process.Modules) if (m.ModuleName.Equals("kernel32.dll", StringComparison.OrdinalIgnoreCase)) Console.WriteLine("Found at " + m.FileName);