开发者

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

开发者 https://www.devze.com 2022-12-27 19:12 出处:网络
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)

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 A开发者_JS百科PI 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


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)


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.


Useful links:

PE COFF Spec

X86 Disassembly/Windows Executable Files

MSDN Magazine Article Part 1

MSDN Magazine Article Part 2

Area of your interest is generally imports directory. This two also may be useful:

Tool Help Library

Debug Help Library

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号