How to Invoke ICorDebug

蹲街弑〆低调 提交于 2019-12-25 18:34:12

问题


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?


回答1:


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.

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.

  • 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.


来源:https://stackoverflow.com/questions/40908763/how-to-invoke-icordebug

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