8

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

Dmitry
  • 2,989
  • 2
  • 24
  • 34
Baiyan Huang
  • 6,463
  • 8
  • 45
  • 72

1 Answers1

3

Is the <comInterfaceExternalProxyStub> element sufficient? Don't you need the <comClass> and <typelib> elements as well?

Ants
  • 2,628
  • 22
  • 35
  • I've tried , which doesn't work. and could only used in a tag, but in my case, the executable is an exe, it is not supported by registry free COM – Baiyan Huang Mar 03 '10 at 08:32
  • @bay Why did you accept this answer then if it doesn't solve your problem? This is not how Stack Overflow is intended to work. – IInspectable Dec 09 '21 at 06:45