2

I have two .exe application. Each of them contains interfaces compatible with Automation and described in projects IDLs. So, I have tlb for both applications. Need to organize the call methods of the class that implements one of the interfaces from code running in another/different application. Just how it works in COM Server and COM client throw out-of-process boundary. But intrefaces is privacy and not registered in Registry, so standard CoMarshalInterface/CoUnmarshalInterface is not working. How I can do it, manualy organize marshaling (all requred data are exist: tlb, automation compatible interfaces) ?

P.S. Looks like this but without registry registration.

Community
  • 1
  • 1
23W
  • 1,162
  • 12
  • 32

2 Answers2

3

Having type library available and registered you might expect COM to create proxy/stub pairs automatically using type library information. This is however not the only way, COM will first query the object if it is capable to marshhal itself into stream, via IMarshal interface, IMarshal::MarshalInterface method.

Marshaling Details on MSDN writes:

Custom marshaling is inherently unique to the object that implements it. It uses proxies implemented by the object and provided to the system on request at run time. Objects that implement custom marshaling must implement the IMarshal interface, whereas objects that support standard marshaling do not.

By implementing custom marhshaling this way you have your COM object saving its essential information into stream, and it provides CLSID of unmarshaler to re-create the interface on the other side. The data will be passed over process boundary and your object will be instantiated and provided this stream data in order for you to re-create the interface in question.

Hence, implement IMarshal and friends and you will be able to integrate into COM processing without having your type library registered or even available.

Roman R.
  • 64,446
  • 5
  • 83
  • 139
0

To communicate two process containing COM objects, you can use ROT (Running object table), here's a sample showing how to do it.