检查可执行文件的依赖关系. [英] Examining an executables dependencies.

查看:152
本文介绍了检查可执行文件的依赖关系.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将如何以编程方式检查可执行文件的依赖项(例如dll)?

How would I go about examining an executables dependencies (e.g. dlls) programatically?

推荐答案

阅读PE格式并尝试从中提取信息. PE格式是Windows上用于.exe,.dll等的格式.
Read about the PE format and try to extract information out of it. PE format is the format on Windows for .exe, .dll etc .


使用 Dependency Walker(取决于. exe) [ ^ ]在命令行模式下:它可以完成工作您需要并将其输出发送到控制台.您需要的是产生它的过程,附加它的输出,最后解析它给您的东西.

[edit]

在互联网上搜索了一下之后,我发现了以下页面:

Use the Dependency Walker (depends.exe)[^] in command line mode: it does the work you require and send its output to the console. What you need is to spawn its process, attach its output and finally parse what it gives you.

[edit]

After searching a bit on internet, I found these pages:


  • http://www.codeguru.com/forum/archive/index.php/t-376151.html[^]
  • http://msdn.microsoft.com/en-us/library/ms809762[^]
  • http://msdn.microsoft.com/it-it/magazine/cc301805(en-us).aspx[^]


需要牢记的是,这里您可以计算出的全部时间就是加载时间或链接器支持的延迟加载依赖性.如果有人手动加载DLL,则很难检测到(尽管您可以从EXE导入LoadLibrary/GetProcAddress的事实中得知).出于相同的原因,诸如COM对象激活之类的事情也很难跟踪.

干杯,

On quick caveat to bear in mind here is that about all you''ll be able to work out are the load time or linker supported delay loaded dependencies. If someone''s manually loading a DLL then it''s a lot harder to detect (although you can get an inkling from the fact that the EXE imports LoadLibrary/GetProcAddress). Things like COM object activation are also hard to track for the same reasons.

Cheers,

Ash


这篇关于检查可执行文件的依赖关系.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆