85

If I have a Windows executable, how can I find out which dlls it will load?

I'm just talking about which ones that will be loaded statically, not ones it might load dynamically with something like LoadLibrary.

David Norman
  • 19,396
  • 12
  • 64
  • 54

10 Answers10

70

dumpbin is a tool that comes with VC++.

To see what DLLs a program will import:

  • Open Visual Studio
  • Menu Item Tools | Visual Studio Command prompt
  • cd to folder containing executable
  • dumpbin /dependents whatever.exe
Dump of file whatever.exe

File Type: EXECUTABLE IMAGE

  Image has the following dependencies:

    AIOUSB.DLL
    sqlite3.dll
    wxmsw293u_core_vc_custom.dll
    wxbase293u_vc_custom.dll
    KERNEL32.dll
    ole32.dll
    OLEAUT32.dll
    MSVCP90.dll
    MSVCR90.dll

To see what functions (and DLLs) it will import, use

C:\> dumpbin /imports whatever.exe
Pau Coma Ramirez
  • 4,261
  • 1
  • 20
  • 19
Graeme Perrow
  • 56,086
  • 21
  • 82
  • 121
38

There are utilities that will do this for you.

In the past I've used the MS tool (depends.exe) that came with (I think) VB.:
VS2010 VS2012 VS2013 VS2015 Current

and there's this as well:
http://dependencywalker.com/

and probably others as well.

Pau Coma Ramirez
  • 4,261
  • 1
  • 20
  • 19
gkrogers
  • 8,126
  • 3
  • 29
  • 36
  • 7
    The "depends.exe" that's installed with Visual Studio/VB/... and the "depends.exe" that one can download from http://dependencywalker.com/ are exactly the same tool (only different versions). ;) – Paul Groke Jul 25 '11 at 22:01
  • 2
    The link is dead. – ice1000 Nov 28 '19 at 09:57
23

Open the command prompt and then type below command

tasklist /m /fi "imagename eq netbeans.exe"

Type instead netbeans.exe whatever name your exe file name.

LOKESH
  • 1,303
  • 1
  • 16
  • 29
  • 1
    i used this and its not giving me full list of dlls that its using, there are a bunch of crystalreports dlls that my exe is using but i dont see any mentioned in the list printed through that command. Any ideas? – user734028 Feb 14 '18 at 06:50
  • 1
    I think this needs the application to be running – Bitterblue Feb 03 '23 at 10:53
13

Dependency Walker can help you determine which .dll will be loaded.

SuB
  • 2,250
  • 3
  • 22
  • 37
David Segonds
  • 83,345
  • 10
  • 45
  • 66
  • Nice GUI program. `Dependency Walker` try to find DLLs and their hierarchical dependencies. – SuB Nov 02 '16 at 04:59
12

Just go to the command prompt and type tasklist /m, you will see the list of dll files used by specific program.

Waynn Lue
  • 11,344
  • 8
  • 51
  • 76
Subek Shakya
  • 595
  • 4
  • 10
  • 28
  • Yeah, this does what you say, however, if an executable start multiple processes, you will never find out from command line which process was started by the executables, hence you will not know all the dependent dll's of the executable. – Fazi Jul 19 '13 at 08:00
  • Doesn't load the paths. – Josué Zatarain Nov 05 '20 at 20:30
3

Solution for Microsoft .Net:

foreach (AssemblyName a in Assembly.ReflectionOnlyLoadFrom("SAMPLE.EXE").GetReferencedAssemblies()) 
{
    MessageBox.Show(a.Name); 
}
htc
  • 54
  • 3
2

There is a handy tool called NDepend that will give you all DLL dependencies.

FlySwat
  • 172,459
  • 74
  • 246
  • 311
1

progfr is simple and useful: [http://members.fortunecity.com/michaelmoser/tip11.htm]

1

Dependencies - An open-source modern Dependency Walker shows which DLLs a Windows executable will load and it works well in modern Windows 10.

It is a little less powerful than Dependency Walker, but the latter may or may not work in Windows 10 as it was last updated in 2006. (Newer versions of Dependency Walker were bundled with some versions of Windows Development Kit for Windows 10, but not any more.)

mrts
  • 16,697
  • 8
  • 89
  • 72
0

Process Explorer Comes with SysInternals Suite https://learn.microsoft.com/en-us/sysinternals/downloads/sysinternals-suite

Benefits: allows to explore the process that is already running (I have not found a was to attach the dependency walker to the existing process)