Flag: Tornado! Hurricane!

 Forums >>  Target Specific - General  >>  WinAPI: Get loaded modules from library (DLL/EXE)

Topic created on: March 5, 2011 10:26 CST by rootop .

I'm working on a tool to view and edit PE/COFF information.
Yes, I am very aware that there are tons of these already, I'm merely building it to fit my own needs and use of simplicity.

As the title says I want to be able to list modules loaded by a specified program. Much like dependency walker.

My first approach was to LoadLibraryEx() the library and then use DbgHelp:s function EnumerateLoadedModules on the result. But to my big disappointment it turned out that the HINSTANCE that gets enumerated must be loaded as a process.

So, any ideas on how to approach this? I know I could build an application that loads the DLL:s DllMain function and go from there but I wish to limit down to a single DLL when it gets compiled.

~

  prot0man   March 8, 2011 09:02.50 CST
I'm not sure if I fully understand what you're trying to do, but you can statically parse out the DLL's that an executable loads into it's process space from the import table. To get a more comprehensive view of what's being loaded into the process, you should additionally look at the imported DLL's imports. For example, if an executable imports wsock32.dll, then you'll want to look at its imported modules too.

Look for the function GetImportFunctionNamesByModule at http://www.skynet.ie/~caolan/pub/winresdump/winresdump/doc/pefile2.html for a good example of how to parse out the import modules.

  corehook     March 8, 2011 21:26.21 CST
Hi!

You must parse PE header, and get information from IMAGE_IMPORT_DESCRIPTOR ( google it

  corehook     March 8, 2011 21:28.44 CST
tuts

Note: Registration is required to post to the forums.

There are 29,893 total registered users.


Recently Created Topics
Decompiling raw bina...
May/22
Incorrect bitness wh...
May/20
PaiMei stalker modul...
May/19
Attach to program us...
May/13
IDA PRO how to make ...
May/12
FACT: OpenRCE is dead.
May/08
Int 3 anti debug?
May/05
help needed - Beginn...
May/03
Attaching IDA Pro to...
Apr/27
File type
Apr/21


Recent Forum Posts
Ollydbg 2.0 - Plugin...
openrce...
IDA PRO how to make ...
codeinject
FACT: OpenRCE is dead.
codeinject
IDA Resource Viewer ...
r2x64
FACT: OpenRCE is dead.
djnemo
FACT: OpenRCE is dead.
codeinject
FACT: OpenRCE is dead.
pedram
help needed - Beginn...
araujo
Attaching IDA Pro to...
codeinject
Int 3 anti debug?
codeinject


Recent Blog Entries
nfljerseysmart
May/23


nfljerseysmart
May/23


laangels
May/22
The Reason You Need A Mark ...

laangels
May/22
Buy Albert Pujols Jersey an...

lowpriority
Apr/13
OllyMigrate Plugin for Olly...

More ...


Recent Blog Comments
clarisonic on:
Apr/03
New version of Ollydbg!

clarisonic on:
Apr/03
New version of Ollydbg!

trackerx90 on:
Mar/04
SuppressDebugMsg As Anti-De...

coachfactory on:
Feb/25
Portable Executable Format ...

coachfactory on:
Feb/25
A new Anti-Olly trick.

More ...


Imagery
SoySauce Blueprint
Jun 6, 2008

[+] expand

View Gallery (11) / Submit