简体   繁体   中英

Catching DLL dependencies in Win32 application

How can I catch a missing DLL in a dependent DLL?

For example: Application is loading a DLL A.

DLL A is loading DLL B.

So if DLL B is not available, application just shows me: DLL A not found.

Any hints where I could find a solution?

At the moment I use dependency-walker to solve this issue, but I need something inside the application, so that the customers must not launch the external tool whenever a DLL is missing.

我尚不清楚您的用例在哪里,但是您的应用程序无法在启动“外部工具”之前调用LoadLibrary来检查DLL是否可用,并且如果失败,则报告缺少DLL?

You could explicitly load the DLL. You'll get an error/exception if you have a missing dependency.

Perhaps you can statically compile the code in the DLL so the problem is eliminated?

If you're fighting with " DLL Hell " you might also be able to place the DLL's in the file system so windows will load the DLL's you want.

You can parse IAT and implement an algorithm similar with the one used by LoadLibrary to check if dll wil be found. A start in implementing this is ImageNtHeader

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM