Debug "Application failed to initialize" error

I sometimes encounter this error when trying to run an executable file that I built on windows, but I have no idea what causes it and how to fix it. With the usual MSVC debugger, it simply opens a dialog box and exits without any chance of doing anything or looking at something. I was able to at least catch something and get a stack trace using the Microsoft console debugger, but I have no idea what to look from here. It seems that the ntdll.dll is weirdly strange before ever getting to the main function of my program or running any of my code.

C:\> cdb bugrepro Microsoft (R) Windows Debugger Version 6.11.0001.404 X86 Copyright (c) Microsoft Corporation. All rights reserved. CommandLine: bugrepro.exe Symbol search path is: C:\SYMBOLS Executable search path is: ModLoad: 00400000 00447000 bugrepro.exe ModLoad: 7c900000 7c9af000 ntdll.dll ModLoad: 7c800000 7c8f6000 C:\WINDOWS\system32\kernel32.dll ModLoad: 10000000 1002a000 glut32.dll ModLoad: 5ed00000 5edcc000 C:\WINDOWS\system32\OPENGL32.dll ModLoad: 77c10000 77c68000 C:\WINDOWS\system32\msvcrt.dll ModLoad: 77dd0000 77e6b000 C:\WINDOWS\system32\ADVAPI32.dll ModLoad: 77e70000 77f02000 C:\WINDOWS\system32\RPCRT4.dll ModLoad: 77fe0000 77ff1000 C:\WINDOWS\system32\Secur32.dll ModLoad: 77f10000 77f59000 C:\WINDOWS\system32\GDI32.dll ModLoad: 7e410000 7e4a1000 C:\WINDOWS\system32\USER32.dll ModLoad: 68b20000 68b40000 C:\WINDOWS\system32\GLU32.dll ModLoad: 73760000 737ab000 C:\WINDOWS\system32\DDRAW.dll ModLoad: 73bc0000 73bc6000 C:\WINDOWS\system32\DCIMAN32.dll ModLoad: 76b40000 76b6d000 C:\WINDOWS\system32\WINMM.dll (64c.7b4): Unknown exception - code c0000022 (first chance) (64c.7b4): Unknown exception - code c0000022 (!!! second chance !!!) eax=0012fc54 ebx=00000000 ecx=0012fc80 edx=7c90e4f4 esi=7ffd8000 edi=c0000022 eip=7c96478e esp=0012fc54 ebp=0012fca4 iopl=0 nv up ei pl zr na pe nc cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246 ntdll!RtlRaiseStatus+0x26: 7c96478e c9 leave 0:000> ~k ChildEBP RetAddr 0012fca4 7c93f14e ntdll!RtlRaiseStatus+0x26 0012fd1c 7c90e437 ntdll!_LdrpInitialize+0x241 00000000 00000000 ntdll!KiUserApcDispatcher+0x7 0:000> 

Does anyone have any suggestions on where to go from here debugging this?

+7
debugging windows dll windbg
source share
4 answers

Following Moron's answers, you should start Process Monitor .

This tool will tell you exactly what your process is doing, and what files it tried (and probably at least one failed) to load, and what are the errors.

It does more than that, and to eliminate any process it is an amazing time saver.

+10
source share

Usually the "application failed to initialize" error is due to the lack of import from the DLL; in combination with 0xC0000022, this may mean that the DLL required by your application cannot be loaded due to an access denied error (the user may not have permission to open / execute this file).

+3
source share

Try running with the dependency walker. http://dependencywalker.com/

It performs static dependency analysis and can also track application launch.

+3
source share

If I remember correctly, exception code c0000022 means Access Denied. This usually means that Windows has blocked access to a resource, such as a domain controller or driver.

You did not specify the nature of your application, but it is clear from the stack dump that it deals with 3D / OpenGL devices. Perhaps your problem is with a misconfigured driver or library. I suggest testing on another machine and / or reinstalling the drivers.

+1
source share

All Articles