0

我需要验证可执行文件的依赖项是否存在,如果可能的话,该依赖项的正确版本。包括依赖项的依赖项。使用 dumpbin.exe,我可以收集 exe 或 dll 的依赖项。例如

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin>dumpbin.exe /dependents  "C:\Program Files (x86)\Notepad++\notepad++.exe"
Microsoft (R) COFF/PE Dumper Version 14.00.24215.1
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file C:\Program Files (x86)\Notepad++\notepad++.exe

File Type: EXECUTABLE IMAGE

  Image has the following dependencies:

    COMCTL32.dll
    SHLWAPI.dll
    SHELL32.dll
    KERNEL32.dll
    USER32.dll
    GDI32.dll
    COMDLG32.dll
    ADVAPI32.dll
    ole32.dll

  Summary

       20000 .data
       52000 .rdata
       13000 .reloc
       86000 .rsrc
      10F000 .text

我正在通过 C# 中的 Process.Start() 读取 dumpbin.exe 的输出并解析返回数据,没问题。我还可以验证文件是否存在,很容易......但是,完全有可能系统上存在多个依赖项的依赖项。您将如何验证是否存在正确的依赖项或所述依赖项的版本?这变得很重要,因为验证依赖项的依赖项也存在。如果有办法超越就好了

"C:\Windows\System32\ole32.dll" 

对此有什么想法吗?提前致谢!(PS-如果我在dll位置方面完全错误,比如它只能存在于.exe的执行路径或system32中,请告诉我,谢谢)

4

1 回答 1

0

您正在测试的节点上多个库的加载顺序会影响哪个库。

运行时方法是:

使用 sysinternals procmon 加载依赖项。

通过从 windbg 启动程序来使用 windbg 以查看加载程序消息。

于 2019-06-08T19:38:27.557 回答