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

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!!
 
G

Guest

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.
 
W

William DePalo [MVP VC++]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top