July 2nd, 2025
heart1 reaction

Unintended yet somehow entirely expected consequences of marking a COM interface as local

A customer was adding an interface to their out-of-process COM server. They added their interface to the project’s existing IDL file and recompiled the resulting proxy stub DLL. But when they tried to connect to the server, the connection failed with error 0x80040155, also known as REGDB_E_IID­NOT­REG: Interface not registered.

They realized that they forgot to register the interface’s proxy, so they added an entry to [HKCR\Interface\{iid}\ProxyStubClsid32] so that COM knew where to find the proxy stub. (They didn’t have to create a new CLSID entry for the proxy DLL because they were adding an interface to their existing IDL, so the proxy DLL was itself already registered by whoever set up that IDL file initially.)

Upon trying again, the connection still failed. This time with the error 0x80004002, the often-encountered E_NO­INTERFACE: No such interface supported.

We learned that one cause of this is a missing marshaler.

“But that doesn’t apply in this case, because I registered the interface and pointed it to the proxy DLL that holds the marshaler!”

Does that proxy DLL hold the marshaler?

We looked at the interface declaration.

[
    object,
    local,
    uuid(iid)
]
interface IWidgetFactory : IUnknown
{
    ⟦ ... ⟧
}

The interface is marked as local. A local interface is one that never leaves its home apartment and therefore never needs to be marshalled. The IDL compiler does not generate marshallers for local interface because they would never be needed.

I don’t know the history here. It’s possible that this interface started out as local because it was originally designed as an in-apartment object, but then the team decided to move the widget factory out of process (which now requires a marshaller) and forgot to remove the local attribute.

Or maybe the local was just a copy-pasta from elsewhere in the IDL file that they forgot to remove. (Or they didn’t realize what it meant.)

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

1 comment

  • Motti Lanzkron

    As the old saying goes, anything that can be explained by a copy/paste error requires no further explanation.