system badimageformatexception and its partial solution

A couple of weeks ago, my colleague called me for this exception  raised when he tried to migrate our client app from xp to vista x64.

 

  This app uses an assembly lib which is written by c++/cli. This assembly mixs COM, win32 api and .net. when i tried to to launch this app, BadImageException raised again.

 

  after googling a bit, I finally solved this problem by setting the client app target to X86. In default, the client app target is Any cpu. This setting usually works well with any pure managed code; however those unmanaged codes need to deal with offset problems, just like what i encountered. So a feasible solution is to force all target to X86.

 

  and another issues is the UAC....for better user experience, turning off it is a good choice despite of any potential security risks...

你可能感兴趣的:(C++,c,.net,XP,Security)