Regasm 将 mscoree.dll 写入注册表项 InprocServer32

发布于 2024-09-03 11:14:31 字数 364 浏览 4 评论 0原文

当我使用 regasm.exe 注册 .NET 程序集时,注册表项

HKEY_CLASSES_ROOT\CLSID{111E32AD-4BF8-495F-AB4D-6C61BD463EA4}\InprocServer32

设置为“mscoree.dll”。

但是,我试图模仿用 C 编写的现有 COM 服务器。注册此旧 COM 服务器时,InprocServer32 设置为该组件的完整路径。

不幸的是,现有系统(我无法更改的插件主机)读取并使用此值 - 被“mscoree.dll”值混淆。

我的解决方案可能是手动修补此注册表项 - 但我想了解为什么 regasm 将“mscoree.dll”写入 InprocServer32 。

When I register my .NET Assembly with regasm.exe the registry key

HKEY_CLASSES_ROOT\CLSID{111E32AD-4BF8-495F-AB4D-6C61BD463EA4}\InprocServer32

is set to "mscoree.dll".

However, I am trying to mimic an existing COM-Server that was written in C. When registering this old COM-server the InprocServer32 is set to the full path to this component.

Unfortunately the existing system (a plugin host that I can not change) reads and use this value - an is confused by the "mscoree.dll" value.

My solution might be to patch this registry entry manually - but I would like to understand why regasm writes "mscoree.dll" into InprocServer32 .

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

栖迟 2024-09-10 11:14:31

解释很简单。当您在进程内使用本机(非托管)COM 服务器时,它会被加载到消费者进程中,并且消费者进程会直接调用其函数。

对于托管代码 COM 公开的程序集来说,这不能那么容易地工作。对于托管代码,需要一个中间层来执行托管/非托管交互。 mscoree.dll 充当此中间层。因此,当使用者调用 CoCreateInstance() 时,会加载 mscoree.dll 并通过加载 COM 公开的程序集托管代码来模拟 COM 服务器,并将所有调用转发给后者。

The explanation is quite easy. When you use a native (unmanaged) COM server in-proc, it is loaded into the consumer process and the consumer process directly calls its functions.

This can't work that easily with a managed code COM-exposed assembly. In case of managed code an intermediate layer is needed that performs the managed/unmanaged interaction. mscoree.dll acts as this intermediate layer. So when the consumer calls CoCreateInstance() mscoree.dll is loaded and emulates the COM server by loading the COM-exposed assembly managed code and forwardind all calls to the latter.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文