问题描述
我想获得加载一个指定进程的所有DLL的列表。我目前使用的的.NET Framework 4.0 。我知道,有一个的。 (只列出托管DLL)。我需要一种以编程方式检索所有这些DLL
过程[] = myProcess Process.GetProcessesByName(MyProcess);
如果(myProcess.Count()0)
{
的foreach(ProcessModule processModule在myProcess [0] .Modules)
//获取信息
$} b $ b
编辑:我感兴趣的是这个过程是不是在当前的AppDomain
$ b $。 bNo, that's not a bug. It was an intentional design change in CLR v4, Microsoft did not keep that a secret. Previous versions of the CLR made an effort to emulate loaded assemblies as though they were unmanaged DLLs. But that just stopped making sense when they implemented the side-by-side in-process CLR versioning feature. It's gone and won't come back.
This isn't exactly a major problem, getting the list of loaded assemblies in another process is well supported by the debugging interface. ICorDebugAppDomain::EnumerateAssemblies() is the ticket. Well, not exactly as easy to use as Process.Modules. Use the MDbg sample to find out how to use it.
这篇关于获取进程的所有DLLS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!