Get DLL names from running process, possible?

后端 未结 1 2007
迷失自我
迷失自我 2020-12-20 03:19

I\'m seeking for a way to get DLL names from a running process, sorry if I\'m poorly expressing myself though.

I need to \"connect\" to this process via it\'s name o

相关标签:
1条回答
  • 2020-12-20 03:56

    Yes it is possible. You can use the Process class. It has a Modules property that lists all the loaded modules.

    For example, to list all processes and all modules to the console:

    Process[] processes = Process.GetProcesses();
    
    foreach(Process process in processes) {
        Console.WriteLine("PID:  " + process.Id);
        Console.WriteLine("Name: " + process.ProcessName);
        Console.WriteLine("Modules: ");
    
        foreach(ProcessModule module in process.Modules) {
            Console.WriteLine(module.FileName);
        }
    }
    

    You can of course check Process.Id for the PID you would like etc.

    For more information check out the documentation for this class:-

    http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx

    Note: This code might get upset for certain system processes which you will not have access permission to.

    0 讨论(0)
提交回复
热议问题