如何调用ICorDebug [英] How to Invoke ICorDebug
问题描述
在"MDbg Sample.zip"项目中,通过以下方式从COM模块调用该函数: [ComImport,Guid("3D6F5F61-7538-11D3-8D5B-00104B35E7EF",InterfaceType((short)1)]公共接口ICorDebug {...}问题是在哪里可以找到Guid("3D6F5F61-7538-11D3- 8D5B-00104B35E7EF),我在regedit中找不到它,但是如何将ICoreDebug接口与COM模块连接?
In "MDbg Sample.zip" projects, invoke the function from COM Module as: [ComImport, Guid("3D6F5F61-7538-11D3-8D5B-00104B35E7EF"), InterfaceType((short) 1)] public interface ICorDebug { ... } The question is where to find the Guid("3D6F5F61-7538-11D3-8D5B-00104B35E7EF"), i can not find it in the regedit, but how to connect the ICoreDebug interface with the COM module?
推荐答案
它不在注册表中.该GUID是IID,ICorDebug不支持远程访问,因此没有理由在该接口上注册存根/代理.
It's not in the registry. That guid is the IID, ICorDebug doesn't support remote access so there is no reason to register a stub/proxy against the interface.
如何获取实例取决于安装的运行时版本,但是最近每个人"都安装了CLRv4,因此您可以通过ICLRMetaHost进行访问.
How you get an instance depends on what versions of the runtime are installed, but these days "everyone" has CLRv4 installed, so you access via the ICLRMetaHost.
- 使用 CLRCreateInstance 获取 ICLRMetaHost 的实现>
- 使用ICLRMetaHost查找 ICLRRuntimeInfo 获取所需的运行时版本.
- 使用 ICLRRuntimeInfo.GetInterface 请求使用CLSID_CLRDebuggingLegacy实现ICorDebug.
- Use CLRCreateInstance to get an implementation of ICLRMetaHost
- Use ICLRMetaHost to find the ICLRRuntimeInfo for the desired version of the runtime.
- Use ICLRRuntimeInfo.GetInterface to request an implementation of ICorDebug using CLSID_CLRDebuggingLegacy.
这篇关于如何调用ICorDebug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!