1

(Note: Names and GUID have been changed from original values)

While debugging an application, I found that a likely culprit for a bug I had was in a library my application was linking with, in the function

pAgent->raw_Open()

agent is declared in our C++ code as

XX::IAgentPtr pAgent

All Visual Studio can tell me about IAgentPtr is that its type is

_com_ptr_t<_com_IIID<XX::IAgent,&_GUID_deadbeef_1234_1234_1234_1234deadbeef> >

And my debugger cannot step into the code of agent->raw_Open() to see what's going on. I'd like to know which DLL defines XX:IAgent, as I may be able to get debugging information or source code for that DLL.

I've figured out that IAgent is a COM interface, and through searching elsewhere, I found that I might be able to find the location of the DLL file by looking in the registry (HKEY_CLASSES_ROOT\CLSID\{guid}). However, I could not find the GUID I'm looking for there.

How might I find the DLL that contains the definition for IAgent given that I know IAgent's GUID?

(Note: Although they have similar titles, this question is not a duplicate of this question, as the asker of the linked question knows the DLL which defines the interface with the GUID)

5
  • Look towards the top of the source code file, there should be an #import directive there. That should at least narrow down what kind of COM component you are using. We cannot otherwise help you find the DLL or the owner of the code. Commented Jun 13, 2013 at 17:43
  • Is there an easy way or utility to find all the files #imported by a file, files it #includes, files #included by #included files, etc? Also, I was able to find the DLL given just the GUID (and knowing which directory probably contained the DLL just made it faster; I could have searched the whole hard drive.) Commented Jun 13, 2013 at 18:42
  • Wrong mental image. It imports a type library and auto-generates C++ declarations from it. You'll find the .tli and .tlh files back in the build directory after building. You can look at them with a text editor. Truly understanding what's going here requires understanding how COM Automation works. Commented Jun 13, 2013 at 18:49
  • Okay, if I'm understanding you correctly, are you implying that in general, knowing which DLL has certain definitions is no more useful than knowing which imported type library contains certain symbols, and so I should be looking for the type library instead of the DLL? Or is it that finding the DLL is difficult enough compared to finding the TLB that effort would be better spend finding the TLB? Commented Jun 13, 2013 at 19:14
  • Sure, if you want to use a DLL then you need declarations of the functions in that DLL. A type library provides those declarations. It is often embedded in the DLL as a resource, sometimes it is provided as a separate .tlb file. The actual DLL doesn't play a role until you run your program. Commented Jun 13, 2013 at 19:26

1 Answer 1

2

A program that can search through binary files to find plain text data will work.

I used Windows Grep and searched all DLL files for "deadbeef-1234-1234-1234-1234deadbeef" and found the DLL which defined IAgent.

However, there is a better way to find this information. HKEY_CLASSES_ROOT\CLSID\ has subkeys for objects, but IAgent is an interface. If you know the GUID of the interface, you can look in HKEY_CLASSES_ROOT\Interface\{guid}. There, if you find a key TypeLib, the default value is a GUID that you can find in HKEY_CLASSES_ROOT\TypeLib, and from there you can find the path to the dll. If that isn't there, the default value in a key called ProxyStubClsid or ProxyStubClsid32 is a GUID that can be found in HKEY_CLASSES_ROOT\CLSID.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.