tags:

views:

52

answers:

2

I am trying to debug some exe in windbg. Now its calling some thirdparty com dll which is exposing DLLGetClassObject function.

DLLGetClassObject signature is

HRESULT __stdcall DllGetClassObject(
  __in   REFCLSID rclsid,
  __in   REFIID riid,
  __out  LPVOID *ppv
);

Looking at stack trace and arguments I can find out the class id and interface id using commands

dt GUID [address]

When I try to search these guids in registry , I am not able to find anything.

Is there something wrong? I should be able to see the com classes and interfaces id in regsitry. Any ideas?

+1  A: 

Probably... If you follow the callstack, is DllGetClassObject invoked by any COM runtime function (CoCreateInstance, CoGetClassObject)?

If so, your CLSID should be found under HKEY_CLASSES_ROOT/CLSID. The interfaces aren't necessarily registered.

Note that there's nothing to prevent an app from loading a DLL and calling DllGetClassObject manually, as long as it knows the threading model requirements of the object to be created.

Kim Gräsman
so it means that if DllGetClassObject is not called by COM functions then it is not a COM object?and the input parameters can be anything other than clsid or interface ids.
Alien01
Sort of. It is still a COM object, it's just that it doesn't allow the client to use standard COM activation to instantiate it.
Kim Gräsman
It's also possible that COM APIs did invoke DllGetClassObject, but the DLL implementing the COM objects is using registration-free COM. In this case, you won't necessarily find any registrations in the registry either...
Reuben
Good point, Reuben. In that case you should be able to find a manifest next to the application's .exe, describing where the server is and what its threading model requirements are, right?
Kim Gräsman
+1  A: 

I have another, unrelated, theory -- do you have symbols for the third-party DLL?

If not, the entry in the callstack for a call into said module is usually shown as the offset of the first export in the module + some large offset.

If DllGetClassObject is elected as the "base export" for the module, and the .exe calls a COM method hosted in the module, the callstack will show something like:

  DllGetClassObject + 0x112313
  UseThirdPartyCOMThing + 0x20

where 0x112313 is larger than what you'd expect the code size of DllGetClassObject to be.

So, it could be a red herring -- you might just be seeing a call into the DLL at some offset that isn't matched in your available symbols, and the debugger shows it using whatever information it has available.

Kim Gräsman
+1 for asking to check for large offset: In a DLL exposing COM objects, traces with any of the "trivially" exported functions is usually a red-herrying: `DllCanUnloadNow`, `DllGetClassObject`, `DllInstall`, `DllRegisterServer`, and `DllUnregisterServer`.
Ashutosh Mehra