How to find the DLL dependency of an EXE file with VC codes?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi. Do you guys know how can I find all the DLL file names
being used by an EXE within a visual c++ program? I know
there's a tool called Dependency Walker can do this but I need
the source codes or knowing how to do it.

I am using Visual C++ 6.0.

Thanks very much!!
 
Or if anyone can give me a rough and high-level idea about how this can be
done, that would be also very helpful.

I have been looking for the solution in different directions: Win32 APIs,
EXE header format, and so on. But none of them looks like the right way.
 
Cachaca said:
Hi. Do you guys know how can I find all the DLL file names
being used by an EXE within a visual c++ program? I know
there's a tool called Dependency Walker can do this but I need
the source codes or knowing how to do it.

To do that statically, you might want to start by reading these two
(somewhat old) articles:

http://msdn.microsoft.com/msdnmag/issues/02/02/PE/

http://msdn.microsoft.com/msdnmag/issues/02/03/PE2/

The articles discuss of utility of the author, Matt Pietrek, called PEDUMP.
It dumps Win32 "portable executable" files.

I'd suggest that you look closely at the import address table (IAT) which is
where much of the import information is stored. The twist is that an
executables are linked to potentially many DLLs and they can have imports,
too.

To do that dynamically, check the docs for EnumProcessModules().

Regards,
Will
 
Back
Top