获取进程 C# 中当前加载的 DLL 列表 [英] Getting a list of DLLs currently loaded in a process C#

查看:23
本文介绍了获取进程 C# 中当前加载的 DLL 列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在进程资源管理器中,我可以查看所选进程加载的所有 dll(和 dll 详细信息).如何以编程方式做到这一点?

In Process Explorer I can view all the dlls (and dll details) loaded by a process selected. How can do this programmatically?

我可以获得这样的特定流程详细信息.但不确定从这里去哪里?

I can get a specific process details like this. But unsure where to go from here?

Process[] processlist = Process.GetProcesses();

foreach(Process theprocess in processlist){
Console.WriteLine("Process: {0} ID: {1}", theprocess.ProcessName, theprocess.Id);
}

推荐答案

存在Process.Modules 属性,您可以枚举进程加载的所有模块(exe 和 .dll).

There exists the Process.Modules property which you can enumerate all Modules (exe and .dll's) loaded by the process.

foreach (var module in proc.Modules)
{
   Console.WriteLine(string.Format("Module: {0}", module.FileName));
}

根据 ProcessModule 类,它为您提供特定模块的属性.

Per the ProcessModule class which gives you the properties of a specific module.

这篇关于获取进程 C# 中当前加载的 DLL 列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆