开发者

builduing on windows 7 running on windows 2008: Unable to initialize application 0xc0000005. Using a reference to a Wrapper on C# library

开发者 https://www.devze.com 2023-03-02 01:44 出处:网络
I am building a C++/MFC (I know it\'s an old technology, but need to maintain it) under VS2010 and Windows 7 (x86). Running the application under Windows 2008 R2 (x64) is fine, the application start w

I am building a C++/MFC (I know it's an old technology, but need to maintain it) under VS2010 and Windows 7 (x86). Running the application under Windows 2008 R2 (x64) is fine, the application start with success.

But when I am trying to run the application under Windows 2008 (x86) or Windows Server 2003 it fails, I'm getting the same error on both systems : "The application failed to initialize properly (0xc0000005). Click Ok to close the Application".

It looks very stange to me since the app is built under a x86 system but runs only on built system (win7 x86) and on x64 system !

And secondly what does mean the exception code 0xc0000005?

Any tips find what is missing in the x86 systems that m开发者_JAVA百科ake the application unstartable?

here is the log from WinDbg:

Microsoft (R) Windows Debugger Version 6.11.0001.404 X86
Copyright (c) Microsoft Corporation. All rights reserved.

CommandLine: "C:\Documents and Settings\Administrator\Desktop\BINTest\C****.exe"
Symbol search path is: *** Invalid ***
****************************************************************************
* Symbol loading may be unreliable without a symbol search path.           *
* Use .symfix to have the debugger choose a symbol path.                   *
* After setting your symbol path, use .reload to refresh symbol locations. *
****************************************************************************
Executable search path is: 
ModLoad: 00400000 00581000   C*******.exe
ModLoad: 7c800000 7c8c2000   ntdll.dll
ModLoad: 77e40000 77f43000   C:\WINDOWS\system32\kernel32.dll
ModLoad: 77b90000 77b98000   C:\WINDOWS\system32\VERSION.dll
ModLoad: 77ba0000 77bfa000   C:\WINDOWS\system32\msvcrt.dll
ModLoad: 10000000 1001a000   C:\Documents and Settings\Administrator\Desktop\BINTest\S*****************.dll
ModLoad: 79000000 79046000   C:\WINDOWS\system32\mscoree.dll
ModLoad: 78aa0000 78b5d000   C:\Documents and Settings\Administrator\Desktop\BINTest\MSVCR100.dll
ModLoad: 78050000 780b9000   C:\Documents and Settings\Administrator\Desktop\BINTest\MSVCP100.dll
ModLoad: 003a0000 003c0000   C:\Documents and Settings\Administrator\Desktop\BINTest\R*********.dll
ModLoad: 003d0000 003d8000   C:\Documents and Settings\Administrator\Desktop\BINTest\Ch*****.dll
ModLoad: 78520000 785c3000   C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_D08D0375\MSVCR90.dll
ModLoad: 78b60000 78f8c000   C:\Documents and Settings\Administrator\Desktop\BINTest\mfc100.dll
ModLoad: 77380000 77412000   C:\WINDOWS\system32\USER32.dll
ModLoad: 77c00000 77c49000   C:\WINDOWS\system32\GDI32.dll
ModLoad: 77f50000 77fec000   C:\WINDOWS\system32\ADVAPI32.dll
ModLoad: 77c50000 77cef000   C:\WINDOWS\system32\RPCRT4.dll
ModLoad: 77da0000 77df2000   C:\WINDOWS\system32\SHLWAPI.dll
ModLoad: 77530000 775c7000   C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_5.82.3790.2778_x-ww_497C098C\COMCTL32.dll
ModLoad: 76280000 76285000   C:\WINDOWS\system32\MSIMG32.dll
ModLoad: 7c8d0000 7d0d4000   C:\WINDOWS\system32\SHELL32.dll
ModLoad: 77670000 777a4000   C:\WINDOWS\system32\ole32.dll
ModLoad: 77d00000 77d8c000   C:\WINDOWS\system32\OLEAUT32.dll
ModLoad: 71bb0000 71bb9000   C:\WINDOWS\system32\WSOCK32.dll
ModLoad: 71c00000 71c17000   C:\WINDOWS\system32\WS2_32.dll
ModLoad: 71bf0000 71bf8000   C:\WINDOWS\system32\WS2HELP.dll
ModLoad: 6d580000 6d628000   C:\WINDOWS\system32\dbghelp.dll
ModLoad: 76cf0000 76d0a000   C:\WINDOWS\system32\IPHLPAPI.DLL
ModLoad: 76b70000 76b7b000   C:\WINDOWS\system32\PSAPI.DLL
(87c.135c): Break instruction exception - code 80000003 (first chance)
eax=76c00000 ebx=7ffda000 ecx=00000003 edx=00000008 esi=7c88be14 edi=00151f38
eip=7c822577 esp=0012fb70 ebp=0012fcb4 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
*** WARNING: symbols timestamp is wrong 0x49901641 0x45d70ad8 for ntdll.dll
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdll.dll - 
ntdll!RtlMultiByteToUnicodeN+0x6002:
7c822577 cc              int     3
0:000> g
(87c.135c): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00000000 ebx=77fc2324 ecx=fffffffc edx=00000000 esi=77fc2320 edi=00000004
eip=7c8396f0 esp=0012f030 ebp=0012f058 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010246
ntdll!strnicmp+0x22b:
7c8396f0 8b5014          mov     edx,dword ptr [eax+14h] ds:0023:00000014=????????
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\WINDOWS\system32\ADVAPI32.dll - 
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\WINDOWS\system32\mscoree.dll - 

*Next step: Removing dependencies in my project.

My project has dependency on another c++ project (R**.dll) which is a wrapper to a C# library. When a remove this dependency my program suddenly works (at least it starts normally).

How can I link with this DLL's (wrapper and c#)?

Is it releated to manifest?

any idea?

here is the manifest of the app

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
<assemblyIdentity 
    version="1.0.0.0" 
    processorArchitecture="X86" 
    name="Microsoft.Windows.C****"
    type="win32" 
/> 
<description></description> 
<dependency> 
    <dependentAssembly> 
        <assemblyIdentity 
            type="win32" 
            name="Microsoft.Windows.Common-Controls" 
            version="6.0.0.0" 
            processorArchitecture="X86" 
            publicKeyToken="6595b64144ccf1df" 
            language="*" 
        /> 
    </dependentAssembly> 
</dependency> 
</assembly>


It seems that the root cause of your problem is a conflict between two versions of the C++ runtime libraries.

Your application is compiled with Visual Studio 2010, so it requires version 10 of the C++ runtime, but it depends on another C++ project that loads version 2 of the .NET CLR. That version of the CLR, in turn, requires version 9 of the C++ runtime. Since only one version of the runtime can be loaded by a given process, chaos ensues.

The easy way out is to either build your application with Visual Studio 2008, or modify the dependent project so it targets version 4 of the .NET CLR. That way, both modules will agree on the version of the C++ runtime to load.

The hard way is to split your application into two processes: one that loads the dependent project and one that contains the application proper, and use some form of IPC to communicate between them. That way, each process will be able to load its own version of the C++ runtime.

0

精彩评论

暂无评论...
验证码 换一张
取 消