Forum Discussion

forderud_ge's avatar
forderud_ge
Copper Contributor
Feb 11, 2022
Solved

How to query COM class Version for packaged COM extension points?

I work on a plugin-based application that is currently scanning the Windows registry for compatible COM servers that expose certain "Implemented Categories" entries. This works well for "regular" COM...
  • Aditi_Narvekar's avatar
    Mar 11, 2022

    forderud_ge thank you for your question. I asked some folks to try and get the best answer for you.

     

    The OLE registration APIs (e.g. OleRegGetUserType) can provide the same properties for Packaged COM classes as they do for CLSID keys in the registry. The APIs don’t cover the full set of subkeys/values that are meaningful for CLSIDs though, and in particular not Version (assuming this refers to the Version (COM) - Win32 apps | Microsoft Docs subkey) or InprocServer32/LocalServer32.

    For the most part these API omissions are intentional and reflect the intended usage, though the specific rationale varies, e.g.:

    • Version is part of a convention for a very narrow purpose (along with TypeLib, which is not mentioned in CLSID Key - Win32 apps | Microsoft Docs, but see ActiveX Controls Registry Information - Win32 apps | Microsoft Docs). TypeLib/Version enable late binding of type definitions for scripts calling class-specific interfaces, which historically was part of Internet Explorer’s model for hosting ActiveX controls, but not a generally recommendable pattern due to security and versioning difficulties. These have never been meaningful to COM activation or OLE so most class registrations don’t have this subkey, and for many that do at least among OS-provided registrations it appears this likely in error. I would caution against repurposing this even for the classic registry data contract, where of course an application could read it, because it is likely to be inconsistent with the original purpose.
    • InrprocServer32/LocalServer32 are intended as implementation details for activation, and other applications directly using them breaks the abstraction. Even for applications that have successfully used these details for unpackaged CLSID registrations in the registry – usage that we have never recommended in official documentation, though it is widely described elsewhere on the web – these techniques don’t generally work for Packaged COM registrations so it would be misleading to expose equivalents.

Resources