title: How can I detect the type of a dll? (COM, .NET, WIN32)
body: <p>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.</p>
  
  <p>I've been trying to determine the easiest way to detect the type of a DLL, what do you think of this:</p>
  
  <ol>
  <li><p><strong>COM dll</strong>
  => I do a LoadLibrary, then GetProcAddress for "<strong>DllRegisterServer</strong>". If I get a valid return, it's a COM file.</p></li>
  <li><p><strong>.NET dll</strong>
  => If the dll depends on <strong>MSCOREE.DLL</strong> it's always a .NET dll?</p></li>
  <li><p><strong>Win32 dll</strong>
  => If both the above tests fail, it's a Win32 dll?</p></li>
  </ol>
  
  <p>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.</p>
  
  <p>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?</p>