2

I implemented an out-of-proc COM server (implemented in a Service). I don't want other applications to access all the functionality in the COM server, so I developed an in-proc server (DLL) which would talk to the out-of-proc server.

Because I don't want the interfaces in the out-of-proc COM server to be accessed directly, I don't embed the type library with the Service so I thought I could use #import and have access to the COM server through the TLB. However, when I try in my in-proc-server to create an instance of a class implemented in the service, I get an E_NOINTERFACE back. I guess this is due to marshalling, but I couldn't figure out how to overcome this.

Any idea on how to communicate from the in-proc-server with my out-of-proc server without exposing the interface details of the out-of-proc server?

Mark Zimmers
  • 133
  • 3
  • In addition to my possibly wrong answer I asked the following question http://stackoverflow.com/questions/4311997/does-proxy-stub-expose-the-interface – sharptooth Nov 30 '10 at 09:00
  • I went with the proxy/stub method. I read your question and that's what I"m also interested in: does the proxy/stub expose the interface? I saw that you answered your own question, but the answer is not clear yet. – Mark Zimmers Dec 01 '10 at 22:59

1 Answers1

0

I'm not sure about how this will help to conseal the interfaces, but there're three ways to make marshalling working and typelib is one of them. The other quite easy way is a proxy/stub - a bunch of code in a separate in-proc COM server that will automagically do the marshalling once it has been registered in Windows registry. Again, I'm not sure how this will help conseal the interface, but it looks more covert then a type library that just exposes teh interface to anyone with OLEView.

Community
  • 1
  • 1
sharptooth
  • 167,383
  • 100
  • 513
  • 979
  • What do you mean by early binding? How can I do that? I use the ATL Simple Object Wizard to create new COM objects. – Mark Zimmers Dec 01 '10 at 15:39
  • @Mark Zimmers: You declare a COM interface that inherits from `IUnknown` (not `IDispatch`) and don't embed the typelib into resources. Now the client program uses Visual C++ `#import` directive to investigate the interfaces and generate C++ equivalents of the interface. Done - since there's not a typelib anywhere (except the build process) noone can find what interfaces are there without thorough reverse engineering. – sharptooth Dec 01 '10 at 15:45
  • @Mark Zimmers: Once you have any specific problems you should ask a question here. – sharptooth Dec 02 '10 at 05:23