private void ReloadNativeProcessInfo() { foreach (List <ProcessViewItem> list in loadedProcessTable.Values) { list.Clear(); } Process[] processes = Process.GetProcesses(); foreach (Process p in processes) { ProcessViewItem item = new ProcessViewItem(); try { item.Detail = new ProcessDetail(p.Id); if (item.Detail.CanReadPeb && item.Detail.CommandLine != null) { item.CmdLineArgs = Utility.SplitArgs(item.Detail.CommandLine); item.DisplayCmdLine = GetFilteredCommandLineString(item.CmdLineArgs); } item.MachineType = item.Detail.MachineType; } catch (Exception) { // Generally speaking, an exception here means the process is privileged and we cannot // get any information about the process. For those processes, we will just display the // information that the Framework gave us in the Process structure. } // If we don't have the machine type, its privilege level is high enough that we won't be // able to attach a debugger to it anyway, so skip it. if (item.MachineType == LowLevelTypes.MachineType.UNKNOWN) { continue; } item.ProcessId = p.Id; item.SessionId = p.SessionId; item.Title = p.MainWindowTitle; item.Exe = p.ProcessName; if (item.CmdLineArgs != null) { item.Category = DetermineProcessCategory(item.Detail.Win32ProcessImagePath, item.CmdLineArgs); } Icon icon = item.Detail.SmallIcon; List <ProcessViewItem> items = loadedProcessTable[item.Category]; item.Group = processGroups[item.Category]; items.Add(item); } }
private void ReloadNativeProcessInfo() { foreach (List<ProcessViewItem> list in loadedProcessTable.Values) { list.Clear(); } Process[] processes = Process.GetProcesses(); foreach (Process p in processes) { ProcessViewItem item = new ProcessViewItem(); try { item.Detail = new ProcessDetail(p.Id); if (item.Detail.CanReadPeb && item.Detail.CommandLine != null) { item.CmdLineArgs = Utility.SplitArgs(item.Detail.CommandLine); item.DisplayCmdLine = GetFilteredCommandLineString(item.CmdLineArgs); } item.MachineType = item.Detail.MachineType; } catch (Exception) { // Generally speaking, an exception here means the process is privileged and we cannot // get any information about the process. For those processes, we will just display the // information that the Framework gave us in the Process structure. } // If we don't have the machine type, its privilege level is high enough that we won't be // able to attach a debugger to it anyway, so skip it. if (item.MachineType == LowLevelTypes.MachineType.UNKNOWN) continue; item.ProcessId = p.Id; item.SessionId = p.SessionId; item.Title = p.MainWindowTitle; item.Exe = p.ProcessName; if (item.CmdLineArgs != null) item.Category = DetermineProcessCategory(item.Detail.Win32ProcessImagePath, item.CmdLineArgs); Icon icon = item.Detail.SmallIcon; List<ProcessViewItem> items = loadedProcessTable[item.Category]; item.Group = processGroups[item.Category]; items.Add(item); } }