我正在寻找一种从正在运行的进程中获取DLL名称的方法,不幸的是,如果我表达的不好,就可以了。
I'm seeking for a way to get DLL names from a running process, sorry if I'm poorly expressing myself though.
我需要连接通过它的名称或PID进行此过程,并检索其使用的DLL名称,如果可能的话。
I need to "connect" to this process via it's name or PID and retrieve the DLL names that it's using if that's possible.
请问。
推荐答案是的,这是可能的。您可以使用进程类。它有一个 Modules 属性,列出所有加载的模块。
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.Name); Console.WriteLine("Modules:"); foreach(ProcessModule module in process.Modules) { Console.WriteLine(module.FileName); } }您当然可以检查对于您想要的PID的Process.Id
有关更多信息,请查看此类的文档: -
For more information check out the documentation for this class:-
http:// msdn .microsoft / en-us / library / system.diagnostics.process.aspx
注意:此代码可能会对某些系统感到不安您将无权访问的进程。
更多推荐
从运行进程获取DLL名称可能吗?
发布评论