如何检测dll的类型? (COM,.NET,WIN32) [英] How can I detect the type of a dll? (COM, .NET, WIN32)

查看:195
本文介绍了如何检测dll的类型? (COM,.NET,WIN32)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在一个文件夹中处理一些dll和exe文件,并确定我处理的文件类型:.NET,COM,Win32或一些其他外星人生命形式。

I need to process a number of dll's and exe files in a folder and determine what type of file I am dealing with: .NET, COM, Win32 or some other alien life form.

我一直在试图确定检测DLL类型的最简单方法,你觉得如何:

I've been trying to determine the easiest way to detect the type of a DLL, what do you think of this:


  1. COM dll
    =>我为 DllRegisterServer 执行LoadLibrary,然后执行GetProcAddress。

  1. COM dll => I do a LoadLibrary, then GetProcAddress for "DllRegisterServer". If I get a valid return, it's a COM file.

.NET dll
=>如果dll依赖 MSCOREE.DLL 始终是.NET dll?

.NET dll => If the dll depends on MSCOREE.DLL it's always a .NET dll?

Win32 dll
= >

Win32 dll => If both the above tests fail, it's a Win32 dll?

当然,必须有一个更好的方法来检测什么类型的dll我们正在处理。以上是非常笨重,不会为EXE文件工作?必须有一些我不在想的其他方式。

Surely there must be a better way to detect what type of dll we are dealing with. The above is very clunky, and won't work for EXE files? There must be some other way that I am not thinking of.

理想情况下,我希望能够让解析器确定编译文件的编译器,

Ideally I'd like to be able to make the parser determine what compiler the file was compiled with, and what features it uses such as MFC, Atl, Stl etc... But I doubt that's possible in the pre-reflection era?

推荐答案

深入了解Win32可移植可执行文件格式

.NET文件格式

Portable Executable

这篇关于如何检测dll的类型? (COM,.NET,WIN32)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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