1

I have my own custom.dll (C++, Windows) library which depends on : zlib.dll, iconv.dll, etc. The custom.dll is loaded by custom.exe.

Is there way in C++/WinAPI to find list of modules custom.dll depends in runtime?

There is function EnumProcessModules which works for process.

Is there something for dynamic library loaded by process? As sample, the dependecy walker utility, fileInfo plugin display this information properly.

Denis Solovov
  • 199
  • 2
  • 12
  • Have a look at [Programmically finding the dependencies (C#)] http://stackoverflow.com/questions/450039/how-to-programmatically-get-dll-dependencies. This qn. is for C#, but there are some useful links in the answer. – PermanentGuest Feb 23 '12 at 10:02
  • Sure, use EnumProcessModules(). Twice, before and after you LoadLibrary() the DLL. The difference is presumably what you're interested in. Very hard to see the point of doing this btw. – Hans Passant Feb 23 '12 at 10:35
  • @HansPassant: That misses shared dependencies. E.g. `Kernel32.DLL` won't show up. – MSalters Feb 23 '12 at 11:00
  • Are you familiar with the different types of dependencies? E.g. delay-loaded DLL's ? – MSalters Feb 23 '12 at 11:01

1 Answers1

4

Take a look at dependency walker. It does exactly what you're asking for. http://www.dependencywalker.com

JimR
  • 15,513
  • 2
  • 20
  • 26
  • 1
    Denis Solovov ask for runtime solution, but +1, this is really cool utility, I used it for several years. – rkosegi Feb 23 '12 at 10:20
  • Are you trying to find dynamic loads? eg: LoadLibrary? depends does that... Otherwise, I didn't read thoroughly... – JimR Feb 23 '12 at 10:23