天天看点

exe/dll 文件依赖查询工具介绍原理效果下载

介绍

windows下开发exe后,本机运行正常,一旦准备部署到其他机器上,就会出现一堆问题。其中主要问题就是不知道自己缺了哪些库。一般的做法是使用depend.exe工具查看PE文件的依赖库,并进行打包。

但有时因为本机多个目录都存在相同名字的库,也不知道应该用哪个版本…等等一些问题。

因此基于个人的经验,完善了一个简易的查看库依赖的工具。

原理

  • 通过分析PE文件所有的依赖库(同depend工具)
  • 按照windows默认的dll加载顺序查找dll路径
The directory from which the application loaded.
The system directory. Use the GetSystemDirectory function to get the path of this directory. The name of this directory is System32.
The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is System.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
The directories that are listed in the PATH environment variable.
           
  • 比对dll库类型,分为
'ignor' : 可忽略的,默认都是system32目录;但有些开发库安装时也会默认安装到system32路径,导致误判为‘ignor’
'runtime':运行时库。主要是使用virtual studio 开发的应用程序,不同的vs版本对应不同的vs runtime库。最好的方法是官网下载安装。
'depend':依赖库。这部分dll是PE文件的静态依赖库,如果PE文件使用loadlibray方式显示加载的dll,工具无法检测。
           

效果

  • 橙色:表示库需要copy到PE目录
  • 灰色:表示已经在PE目录

双击某个dll,可继续查看dll的依赖,右键‘返回’上级库。

exe/dll 文件依赖查询工具介绍原理效果下载

下载

https://download.csdn.net/download/corrupt/87437292

继续阅读