How can I detect the type of a dll? (COM, .NET, WIN32)

后端 未结 3 1122
野趣味
野趣味 2020-12-05 19:37

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.

I\'

相关标签:
3条回答
  • 2020-12-05 19:42

    DllRegisterServer is not required, the only required export for a COM dll is DllGetClassObject

    0 讨论(0)
  • 2020-12-05 19:52

    I don't see a better way of doing it. However, at 2., actually the answer is no. Runtime hosts will almost certainly also depend on mscoree.dll, and those are not necessarily .Net assemblies.

    .Net dlls have a COM descriptor, which you can find using dumpbin. I don't know how to get this information from code.

    If you are programming in .Net, one way of determining if the assembly is a .Net assembly is by trying to call Assembly.LoadFrom(...).

    Well, this isn't a real answer, but a set of tips of things I'd look into.

    0 讨论(0)
  • 2020-12-05 20:03

    You must check the PE Header of these files. All DLL and executables, Win32 and .NET, have a PE header.

    An In-Depth Look into the Win32 Portable Executable File Format

    The .NET File Format

    Portable Executable

    0 讨论(0)
提交回复
热议问题