Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find dynamically loaded modules (the static ones) programatically in windows

Tags:

c++

c

windows

I'm trying to port the unix utility ldd to windows, because dependency walker and cygcheck don't quite give me the usage I'm looking for. (also for the learning experience)

Ive been looking all over MSDN, for a windows API that lists dll dependencies of an executable, or even the storage format in the complied exe (just to filter it out), but I've been unable to find anything.

If anyone knows what API call windows uses for listing modules to load, or what patterns I can search for in an executable to find modules to load, please help me out :) thanks!

-note: I'm not looking to profile for dynamic modules, just list the ones that are required at runtime

like image 263
Ryan Rohrer Avatar asked May 13 '26 01:05

Ryan Rohrer


2 Answers

Modules loaded with loadlibrary api cannot be found in the exe imports table. So to trace those module we have to use one of the several api monitoring tools. http://www.rohitab.com/apimonitor

www.apimonitor.com

If that is not the case you can simply get all the imports from

dumpbin /import abc.exe

(i am not exactly sure about the command line syntax)

dumpbin is a tool from windows sdk (visual studio also contains it)

like image 107
Vineel Kumar Reddy Avatar answered May 15 '26 16:05

Vineel Kumar Reddy


Personally, before I spent a lot of time trying to figure out the (likely complex) API calls for this, I would consider running Dependency Walker in console mode and seeing if I could just extract the text data I needed from there.

like image 28
Corwin Joy Avatar answered May 15 '26 15:05

Corwin Joy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!