Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Get/Read DLL Imports Used

Tags:

c#

import

get

dll

  1. Hey, my question is simple but I can't find a way to do this.

What I try to do is: I try to get all the DLL Imports and the functions used from an EXE or DLL.

So let's say I make a program with the: SendMessage (DLL Import) Then the code would manage to read that.

And return like:

DLL: user32.dll

Function: SendMessage

I have tried using the: Assembly. But no luck getting correct data from it.

(I did look at: How to programatically read native DLL imports in C#? But didn't get it to work there either, I got 1 import, but nothing more)

like image 879
GhostHax Avatar asked Jan 29 '26 01:01

GhostHax


1 Answers

The DUMPBIN program examines the DLL PE Header and lets you determine this info.

I don't know of any C# wrapper but these articles should show you how to examine the header and dump out the exports yourself

  • An In-Depth Look into the Win32 Portable Executable File Format
  • Peering Inside the PE: A Tour of the Win32 Portable Executable File Format

As a lateral thought - why not wrap dumpbin.exe /exports with a .net System.Process call and parse the results?

like image 82
Preet Sangha Avatar answered Jan 30 '26 14:01

Preet Sangha



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!