Search code examples
.netcom

How do I dig into a COM object?


I'm digging through the .NET source, and I found an interop class to a COM object. If I have the guid, how do I go about finding the DLL and class in question (and for that matter, how does .NET load the DLL based on the guid)?

Is it in the GAC somewhere?


Solution

  • COM dlls are not placed into the GAC (which is for .NET assemblies only - hence the name Global Assembly Cache).

    If you know the guid of a COM component and want to know the path to the actual binary you can figure that out using in the Registry.

    Start regedit.exe, navigate to

    HKEY_CLASSES_ROOT\CLSID\<guid value>\InprocServer32
    

    and check the default value of the key. Alternatively, for command line lovers, use the reg.exe tool:

    reg query HKEY_CLASSES_ROOT\CLSID\{0000002F-0000-0000-C000-000000000046}
    
    HKEY_CLASSES_ROOT\CLSID\{0000002F-0000-0000-C000-000000000046}\InprocServer32
       (Default)    REG_SZ    C:\Windows\System32\oleaut32.dll
       ThreadingModel    REG_SZ    Both