开发者

Get user imported DLLs from DLL import table

开发者 https://www.devze.com 2023-03-13 10:56 出处:网络
I need to check for a given dll if all DLLs it depends on are present. I was able to get the list of DLLs using the code given in this question: How to programatically read native DLL imports in C#?.

I need to check for a given dll if all DLLs it depends on are present. I was able to get the list of DLLs using the code given in this question: How to programatically read native DLL imports in C#?. It gives the list of DLLs, including system 开发者_JS百科ones (like kernel32.dll and others). What I need is to remove them from this list, as I do not need to check them, I only need to check the DLLs explicitly imported by developer.

Any ideas how to do that?


There is no distinction whatsoever between Windows DLLs and 'regular' DLLs. The programmer actually did explicitly create a dependency on them, it doesn't happen by accident. And you do have to check them, it may require a DLL that is, say, only available on a later version of Windows.

More seriously, there are a lot of ways in which your approach won't work reliably. You'll never be able to figure out when it is using a DLL from the Windows side-by-side cache for example. You can't reasonably get into the business of parsing manifests. It is also very common for DLLs to have dynamic dependencies on other DLLs instead of static dependencies that you reverse-engineer from the IAT. This is true for COM as well as .NET assemblies for example.

There is only one good way to find out if the required DLLs are present. Load the DLL.

0

精彩评论

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

关注公众号