开发者

Catching DLL dependencies in Win32 application

How can I catch a missing DLL in a depe开发者_运维技巧ndent 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.


I'm not entirely clear what your use case is here, but can't your application call LoadLibrary to check if the DLLs are available before launching the "external tool", and if it fails report that the DLL(s) are missing?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜