Function IsDll(FileName : String):Boolean;<br>var<br> hFile : THandle;<br> Mem : TMemoryStream;<br> DosHeader : PImageDosHeader;<br> NtHeader : PImageNtHeaders;<br>begin<br> Result := False;<br> Mem := TMemoryStream.Create;<br> Mem.LoadFromFile(FileName);<br> DosHeader := PImageDosHeader(Mem.Memory);<br> NtHeader := PImageNtHeaders(PChar(DosHeader) + DosHeader^._lfanew);<br> Result := ((NtHeader^.FileHeader.Characteristics and IMAGE_FILE_DLL)= IMAGE_FILE_DLL);<br><br> Mem.Free;<br>end;