How to use an out-of-process COM server without its tlb file
Posted
by Dbger
on Stack Overflow
See other posts from Stack Overflow
or by Dbger
Published on 2010-03-03T06:25:39Z
Indexed on
2010/03/29
3:23 UTC
Read the original article
Hit count: 602
com
|out-of-process
It is about Window COM component.
- Server.exe: an 32bit out-of-process COM server
- CLSID_Application: The GUID of a COM object in Server.exe
- Client.exe: a 64bit client application which use Server.exe in a registry-free way.
As we know, an exe can't be used as a registry-free COM component, to mimic such behavior, I start the Server.exe process myself by providing the exact path:
- CreateProcess("Server.exe")
- IClassFactory* pFactory = CoGetClassObject(CLSID_Application)
- pFactory->CreateInstance(ppAppObject);
It works if I have the Server.tlb registred, but after unregister Server.tlb, it just failed to create the ppAppObject, even though I embed manifest into both Server.exe and Client.exe:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<file name="Server.tlb">
<typelib tlbid="{DAC4A4C9-F84C-4F05-A7DC-E152869499F5}" version="1.0" helpdir=""></typelib>
</file>
<comInterfaceExternalProxyStub name="IApplication" iid="{D74208EA-71C2-471D-8681-9760B8ECE599}" tlbid="{DAC4A4C9-F84C-4F05-A7DC-E152869499F5}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
</assembly>
Do you have any idea on this?
Edit: It turns out that it really works if I specify tlbid for interfaces, and embed the manifest to both exe
© Stack Overflow or respective owner