I have been able to use manifests and especially the MSBuild task GenerateApplicationManifest so that our main application uses Isolated COM. I can create all the COM objects implemented in DLLs that I need without having to register the DLLs on my client machine. But, I'm greedy...
Our application suite also has some separate applications that are invoked through COM, generally. For these, it is said that you can't do EXE to EXE isolated COM. Strictly speaking, that is true, but I have gotten 90% of the way and on other forums I have seen others giving clues to get the rest of the way there.
For my EXE server, I have a entry in the manifest with the name of the EXE server and a sub entry in that entry so that when the ATL server calls LoadRegTypeLib()
, the call will succeed. That works.
Of course, the tricky part is that you cannot put a entry for the EXE server in the client application manifest and expect CoCreateInstance()
to succeed (by launching the server EXE and doing all the other stuff COM does.)
I am able to fake quite a bit because I know what EXE server to launch. I can call CreateProcess()
and then call WaitForInputidle()
in the client app to get my server ready for CoCreateInstance() in the client app.
If I call CoCreateInstance()
and ask for the IDispatch
interface in the client app, the call succeeds and I can call Invoke()
and everything works.
Now here comes the greedy part...
It's all well and good that IDispatch works, but I want to be able to call through my dual interfaces derived from IDispatch. I want to do that because I have lots of code written that way and the syntax is simpler and the exception handling is already there.
However, when I call QueryInterface()
for the dual interface on my IDispatch
interface, I get an E_NOINTERFACE return. I have set breakpoints in my ATL server object in the server EXE and can confirm that on the server side, it finds the interface and returns S_OK. So, it seems like somehow the interface is not able to be marshalled back to the client.
So, the question is, How can I get the QueryInterface()
for my custom/dual interface to succeed? I've tried various combinations of using <comInterfaceProxyStub>
and <comInterfaceExternalProxyStub>
in my client manifest (and server manifest) to try and marshal the interface, but I am still seeing the E_NOINTERFACE
return in my client.
I saw a comment by Hans Passant from several years ago in a different forum about maybe needing a separate proxy/stub DLL to marshal the interface, but there wasn't much detail.
Is it even possible to solve this in a registration free context? Is it necessary to create a proxy/stub library? If so, what would the manifest entries look like in my client application (and/or server app and/or proxy/stub DLL)?