从运行进程获取DLL名称可能吗?

编程入门 行业动态 更新时间:2024-10-27 10:31:41
本文介绍了从运行进程获取DLL名称可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在寻找一种从正在运行的进程中获取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名称可能吗?

本文发布于:2023-11-16 02:13:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1600067.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:进程   名称   DLL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!