Enum Modules For Pid

image_pdfimage_print
   
  

using System;
using System.Diagnostics;

class MainClass {
    static void Main(string[] args) {
        int pID = 12345;
        Process theProc;
        try { theProc = Process.GetProcessById(pID); } catch {
            Console.WriteLine("bad PID!");
            return;
        }
        Console.WriteLine("Here are the loaded modules for: {0}", theProc.ProcessName);
        try {
            ProcessModuleCollection theMods = theProc.Modules;
            foreach (ProcessModule pm in theMods) {
                Console.WriteLine(string.Format("-> Mod Name: {0}", pm.ModuleName));
            }
        } catch { Console.WriteLine("No mods!"); }

    }
}