如何以编程方式确定Windows可执行文件DLL依赖关系? [英] How to determine a windows executables DLL dependencies programatically?
问题描述
如何确定什么DLL的二进制取决于使用编程方法?
要明确的是,我不是想确定运行的exec的DLL依赖,而是任何任意的exec(可能会丢失一个必需的DLL)。我正在寻找一个解决方案在C / C ++应用程序中实现。这是需要由我的应用程序在运行时完成的,不能由第三方应用程序(如depends)完成。
请查看 IMAGE_LOAD_FUNCTION > code>
API。它将返回指向 LOADED_IMAGE
结构,您可以使用它来访问PE文件的各个部分。
您可以找到一些描述结构布局方式的文章此处和此处。您可以下载此处的文章的源代码。
我认为这应该给你需要的一切。
更新:
$ b
我刚刚下载文章的源代码。如果你打开 EXEDUMP.CPP
,看看 DumpImportsSection
它应该有你需要的代码。
How to determine what DLL's a binary depends on using programmatic methods?
To be clear, I am not trying to determine the DLL dependencies of the running exec, but of any arbitrary exec (that may be missing a required DLL). I'm looking for a solution to implement in a C/C++ application. This is something that needs to be done by my application at runtime and can't be done by a third party app (like depends).
Take a look at the IMAGE_LOAD_FUNCTION
API. It will return a pointer to a LOADED_IMAGE
structure, which you can use to access the various sections of a PE file.
You can find some articles that describe how the structures are laid out here, and here. You can download the source code for the articles here.
I think this should give you everything you need.
Update:
I just downloaded the source code for the article. If you open up EXEDUMP.CPP
and take a look at DumpImportsSection
it should have the code you need.
这篇关于如何以编程方式确定Windows可执行文件DLL依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!