80

如果我有一个 Windows 可执行文件,我如何找出它将加载哪些 dll?

我只是在谈论哪些将静态加载,而不是可能使用 LoadLibrary 之类的动态加载。

4

10 回答 10

65

dumpbin是 VC++ 自带的一个工具。

要查看程序将导入哪些 DLL:

  • 打开 Visual Studio
  • 菜单项工具 | Visual Studio 命令提示符
  • cd 到包含可执行文件的文件夹
  • 垃圾箱/从属任何东西.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

要查看它将导入哪些函数(和 DLL),请使用

C:\> dumpbin /imports whatever.exe
于 2009-01-24T01:55:27.463 回答
37

有一些实用程序可以为您执行此操作。

过去我使用过(我认为)VB 附带的 MS 工具(depends.exe)。:
VS2010 VS2012 VS2013 VS2015 Current

还有这个: http:
//dependencywalker.com/

可能还有其他人。

于 2009-01-24T00:12:07.203 回答
20

打开命令提示符,然后键入以下命令

任务列表 /m /fi "imagename eq netbeans.exe"

键入 netbeans.exe,无论您的 exe 文件名如何。

于 2014-09-08T04:45:59.040 回答
13

Dependency Walker可以帮助您确定将加载哪个 .dll。

于 2009-01-24T00:12:36.783 回答
12

只需转到命令提示符并键入tasklist /m,您将看到特定程序使用的 dll 文件列表。

于 2012-03-12T08:30:46.340 回答
3

Microsoft .Net 的解决方案:

foreach (AssemblyName a in Assembly.ReflectionOnlyLoadFrom("SAMPLE.EXE").GetReferencedAssemblies()) 
{
    MessageBox.Show(a.Name); 
}
于 2012-05-30T15:13:56.713 回答
1

progfr 简单实用:[ http://members.fortunecity.com/michaelmoser/tip11.htm]

于 2009-01-24T00:20:15.143 回答
1

有一个名为 NDepend 的方便工具,它将为您提供所有 DLL 依赖项。

于 2009-01-24T02:00:04.257 回答
1

Dependencies - 一个开源的现代 Dependency Walker显示 Windows 可执行文件将加载哪些 DLL,并且它在现代 Windows 10 中运行良好。

它不如Dependency Walker强大,但后者可能会或可能不会在 Windows 10 中工作,因为它最后一次更新是在 2006 年。(较新版本的 Dependency Walker 与 Windows 10 的某些版本的 Windows Development Kit 捆绑在一起,但不是更多。)

于 2021-01-28T12:41:34.867 回答
0

Process Explorer 随附 SysInternals Suite https://docs.microsoft.com/en-us/sysinternals/downloads/sysinternals-suite

好处:允许探索已经运行的进程(我还没有找到将依赖walker附加到现有进程的方法)

于 2020-01-16T15:59:40.027 回答