Implement IMarshal by default?

I am trying to inject open source COM code in my code (I can’t use COM access without registering through the application manifest, since it works only at exe level): I create a static class that loads the COM COM library, calls DllGetClassObject, then IClassFactory :: CreateInstance ().

Works great. Implementation details are at http://www.dimastr.com/redemption/security.htm#redemptionloader

But if I create an instance of a COM object from several threads (for example, first in the main thread, then from the secondary), Net starts asking for my objects for IMarshal, which I do not implement.

If the COM library is registered in the registry, everything works fine. If the library is not registered in the registry (which is the whole point of doign all this), Net asks IMarshal.

Is there any way to get the standard IMarshal implementation that COM uses internally? Or prevent it from crashes if my object does not implement IMarshal?

Thanks!


+4
source share
1 answer

CoGetStandardMarshal is used for the default implementation; however, this method is not documented - you have to look for it to get its prototype.

However, if you do not provide an IMarshal interface, the standard implementation is used . Therefore, I believe that the problem lies elsewhere.

+4
source

All Articles