Is it possible to enumerate the AppDomains in a remote process?

不想你离开。 提交于 2019-12-24 19:13:58

问题


I have seen this question and a number of blog posts related to using mscoree.CorRuntimeHostClass.EnumDomains method to enumerate the AppDomains within the current process, but I'm wondering if there's a way to enumerate the AppDomains within a separate process on the same machine.

I'd like to be able to write a simple console or even WinForms app that could take a process ID and be able to give me some information about the AppDomains within that process. Is this even possible? I assume it is to some degree given that Process Explorer can give you a list of the AppDomains for a .NET process. I just want to know how to accomplish this with C# code.


回答1:


It is possible, but you would need to use the debugging API to do it. This is broadly similar to the post you link to, but you use different APIs and interfaces. See Publishing Processes in the Debugging API for an overview and links.

In particular, see the CorpubPublish coclass and the ICorPublish interface, then track down through ICorPublish::GetProcess and ICorPublishProcess::EnumAppDomains.




回答2:


I guess this post 'Enumerating Managed Processes' by Mike Stall should solve the problem.



来源:https://stackoverflow.com/questions/1863962/is-it-possible-to-enumerate-the-appdomains-in-a-remote-process

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!