Once again I meet an issue today when starting a software on my Win7 64bit platform. It's not the 1st time that when I start a soft, it crash immediately with a 0xe0434f4d error/exception code, but everything I'm wondering why ?
In fact if you see that behavior,, it could means that you are running a .Net executable build to start on "Any CPU" but that native win32/x86 DLL are require. On an old 32bit only windows system it work fine, but on a 64bit XP or Win7, the .Net process don't start in WoW64 and will not be able to load the x86 DLL.
To check and fix that issue, you need CorFlags. It's a simple executable that you can find for example in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin.
For example using: CorFlags proc.exe
I got:
Version : v2.0.50727
CLR Header: 2.5
PE : PE32
CorFlags : 1
ILONLY : 1
32BIT : 0
Signed : 0
As the 32BIT flags is set to 0 and that the ILONLY is set to 1, that process can start as a 32bit executable on a 32bit only PC or as a 64bit executable on a 64bit PC.
To change that state you can update the PE header with: CorFlags /32BIT+ proc.exe
Run again: CorFlags proc.exe
Version : v2.0.50727
CLR Header: 2.5
PE : PE32
CorFlags : 3
ILONLY : 1
32BIT : 1
Signed : 0
Now you can start proc.exe on any CPU and OS, 32bit only or 64bit, It will always start as a 32bit executable (WoW64 mode on a 64 bit Windows OS).
From Visual Studio if you want to exactly specify the target, you can use the C#/.Net Project page.
Aucun commentaire :
Enregistrer un commentaire