DLL Dependency Question (C++)

Is there a way I can get all dependent DLL's of another DLL ?

#267523

this works pretty well...

#267524

yeah I know that :) i'm curious how to do that in code :)

Are there some API functions I missed ?

#267528

oh, you mean like it says in the title? ::doh!::

#267530

Raduking,

The basics is not all that out of the ordinary... there are a few APIs and structures in the SDK that can be used to retrieve that information, by basically walking the structructures of the PE file format, which is documented in the Platform SDK. In particular, in this case, one would start by loading the library (LoadLibraryEx()), and then following the headers until one arrives at the IMPORTS section (you'll find one entry there for every function name and ordinal imported from each library).

That said, Depends.exe does far more than that, like dealing with delayloading and a few other "advanced" features.

Matt Pietrek wrote quite a few articles on the old MSJ (what is now known as MSDN Magazine) on the PE File format, which are quite good.

I have a few samples that deal with the PE file format directly and indirectly on my website, which might be useful, and let me know if you need any specific information

#267535

Another hint:

Search for "HookImportedFunctionsByName" on google.

#267687