GregH
GregH

Reputation: 12858

Utility for viewing which files/dlls are loaded by an executable image

I know there is a utility for this because I used to use it...just can't remember the name. I'm looking for a Windows (Windows-7) utility that will allow me to select an executable image running and have it tell me what files/dlls that program has loaded and from what directory. I am writing software in Visual Studio and would like to verify at runtime which dlls my program is loading.

Upvotes: 9

Views: 23086

Answers (5)

shluvme
shluvme

Reputation: 863

A very useful tool worth mentioning is https://www.dependencywalker.com/ which for each module found, it lists all the functions that are exported by that module. enter image description here

Upvotes: 0

Heelara
Heelara

Reputation: 979

Instead of installing any third-party tools, we could use Microsoft's tasklist. E.g., to display the loaded DLLs for a program using its name, do this:

C:\>tasklist /m /fi "imagename eq PacketAnalyzerPlus.exe"

Image Name                     PID Modules
========================= ======== ============================================
PacketAnalyzerPlus.exe        3904 ntdll.dll, wow64.dll, wow64win.dll,
                                   wow64cpu.dll

where the specified options are as below:

/m <module> - Lists all tasks with DLL modules loaded that match the given pattern name. If the module name is not specified, this option displays all modules loaded by each task.

/fi <filter> - Specifies the types of processes to include in or exclude from the query. You can use more than one filter or use the wildcard character () to specify all tasks or image names.

If it is a Windows service, use filter services. E.g. to find all DLLs for service Winmgmt, use this:

C:\>tasklist /m /fi "services eq Winmgmt"

Image Name                     PID Modules
========================= ======== ============================================
svchost.exe                    872 ntdll.dll, kernel32.dll, KERNELBASE.dll,
                                   msvcrt.dll, sechost.dll, RPCRT4.dll,
                                   ole32.dll, GDI32.dll, USER32.dll, LPK.dll,
                                   USP10.dll, IMM32.DLL, MSCTF.dll,...

Upvotes: 4

Hans Passant
Hans Passant

Reputation: 941218

Visual Studio does it well. Use Tools > Attach to Process, Debug > Break All. Then Debug > Windows > Modules. For VS2015+ start that with Debug > Attach to Process.

Upvotes: 23

chappjc
chappjc

Reputation: 30579

The command line route is ListDLLs from Sysinternals.

It can list DLLs loaded by a process, or list processes that loaded a given DLL.

Upvotes: 4

RoboAlex
RoboAlex

Reputation: 5015

use Process Monitor or Process Explorer.

Upvotes: 14

Related Questions