I am trying to use any DLL in Windows 7 64 bit version. It give me exception "BadImageFormatException was unhandled". The same .dll works fine with Windows XP. The .dll was written in ASM and built using AnyCPU platform. I tried to build my project as "AnyCPU", x86 and 64 bit, results are always the same

Here is the call in project:

[DllImport("library.dll")] static extern bool MyFunction(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);

I used CORFLAGS. After call: CorFlags.exe library.dll I have:

Error CF008 : The specified file does not have a valid managed header

Anyone has come across it, is there a way to resolve it?

Best regards.