依赖遍历器如何知道使用了模块中的哪些函数?
它可以列出导出函数中使用的函数。
它是如何做到这一点的呢?
It can list the functions that's used among the exported functions.
How does it do the trick?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
关键是每个 Windows 模块(可执行文件和库)都包含一个导入表,其中列出了它所依赖的所有其他模块。该表由链接器构建,操作系统内部使用它来确定模块的依赖关系并加载适当的库。
因此,Dependency Walker 所要做的就是递归遍历所有这些模块(象征性地“遍历”它们),构建在各自导入表中指定的模块的列表。
它不显示所有运行时依赖项(例如使用
GetProcAddress
函数加载的依赖项),因为这些依赖项未在导入表中列出。它仅显示加载时(或静态)依赖关系。您可以在此处和此处。
The key is that every Windows module (both executables and libraries) contains an import table that lists all of the other modules that it depends on. This table is built by the linker and is used by the operating system internally to determine the dependencies of the module and load the appropriate libraries.
So all that Dependency Walker has to do is recurse through all of those modules (figuratively, "walking" through them), building a list of the modules specified in their respective import tables.
It does not display all of the run-time dependencies (such as those loaded with the
GetProcAddress
function), as those are not listed in the import table. It only shows the load-time (or static) dependencies.You can find more information about how Dependency Walker works here and here.