Regasm writes the mscoree.dll file to the InprocServer32 registry key

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

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

set to "mscoree.dll".

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

Unfortunately, the existing system (the host plugin I cannot change) reads and uses this value - this confuses the value of "mscoree.dll".

My solution might be to fix this registry entry manually, but I would like to understand why regasm writes "mscoree.dll" in InprocServer32.

+4
source share
1 answer

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

This cannot work so easily with a managed COM build. In the case of managed code, an intermediate layer is required that performs controlled / unmanaged interaction. mscoree.dll acts like this intermediate level. Therefore, when the consumer calls CoCreateInstance() mscoree.dll , the COM server loads and emulates, loading the COM-exposed managed assembly code and forwards all calls to the latter.

+5
source

Source: https://habr.com/ru/post/1311192/


All Articles