Hi Fabian,
Since the com simplification with the macros is probably not feasible, here an approach that reuses an old idea - using widl to generate a classfactory.
Other than that, you introduce wine/debug.h dependency in widl generated sources, which makes it usable only for Wine internals. Introducing something only for Wine internals in widl could be fine if justified, but I'm not sure that's the case.
This implementation does not allow DLLs to mix custom class
factories and generated ones in the same DLL. Some class factories
need for example additional interfaces. Those will have to be
implemented from scratch, which is fine. But if other class
factories from the same DLL could use generic implementation, they
can't because of how DllGetClassObject is generated.