Search code examples
winapicommarshallingwin32-process

Double hop marshaling in COM


Consider the following.

  • Process A is a COM client. It creates an object in process B
  • The object has a method that returns an interface pointer
  • The implementation in B creates an object in process C and returns that to A

After this, will calls from A to C go through B? If the process B quits, will the object proxy in A error on method calls?


Solution

  • Tested. As of Windows 10 19044, COM short circuits the double hop. Killing B doesn't break the channel.

    Here are the samples. Build a.cpp, b.cpp, and c.cpp as three separate Windows GUI apps in Visual Studio. Run B and C in either order, then A. The A program has some UI to drive the test.