Debugging program that won't start

Whenever I try to start my program, I get a dialog box saying

"The application failed to initialize properly (0xc0000022). Click on OK to terminate the application".

With the debugger, it does the exact same thing, giving me no opportunity to find out what is going on; if I try to break it once the dialog box is up, I get another dialog

"Unable to break execution. Please wait until the debuggee has finished loading, and try again"

The only vaguely informative piece of information is a message in the debug window:

"Debugger: An unhandled non-continuable exception was thrown during process load"

How do I figure out what is going wrong I assume that there's some sort of problem with a .dll my program is trying to load, but which dll and what is the problem



Answer this question

Debugging program that won't start

  • Ivanaq

    What is you use ntsd from the command prompt

    ntsd youerefile.exe

    Then hit "g" to continue executing. What dlls are loaded

    Without more information, I am afraid no one will be able to help.

    Thanks,
    Ayman Shoukry
    VC++ Team


  • JonasHei

    Other applications that use those .dlls work fine. However, poking around a bit, according to depends, the program also depends on c:\windows\system32\glew32.dll, though that doesn't show up in the list of dlls that the ntsd shows. Would that be the dll that is causing problems

    If so, how do I go about figuring out what is wrong and fixing it That dll has something to do with OpenGL extensions for windows, I think.


  • Scorpiious

    What is the call stack when you are starting the application

    Thanks,
    Ayman Shoukry
    VC++ Tean


  • tekagnos

    After trying lots of things, I found that deleting glew32.dll and replacing it with an identical copy (according to a file compare utility) from another machine on which glew-based things worked fixed the problem. I have no idea what was actually wrong.
  • gkat

    Altough the last post to this thread has been quite some time ago I wanted to share my solution to the problem...

    !!! Make sure the permissions of your DLLs are set correctly !!!
    glew32.dll from the official site glew.sf.net comes with wrong permissions.


  • vixxen

    cg.dll/cgGL.dll are the NVidia Cg toolkit. They seem to load and run fine with other programs, just not this one.
  • MHV642

    There's no call stack -- I'm starting from the command line or from the debugger (F5), with the same result in either case
  • Brian Shay

    Could you try a simple application that use those dlls and see if that is the cause of the issue

    Thanks,
    Ayman Shoukry
    VC++ Team


  • The Inquisitor

    I haven't used ntsd before (just the gui debugger), but when I run as you request I see:

    Microsoft (R) Windows User-Mode Debugger  Version 5.1.2600.0
    Copyright (c) Microsoft Corporation. All rights reserved.

    CommandLine: ./program.exe
    Loaded dbghelp extension DLL
    The call to LoadLibrary(ext) failed with error 2.
    Please check your debugger configuration and/or network access
    Loaded exts extension DLL
    The call to LoadLibrary(uext) failed with error 2.
    Please check your debugger configuration and/or network access
    Loaded ntsdexts extension DLL
    Symbol search path is: *** Invalid *** : Verify _NT_SYMBOL_PATH setting
    Executable search path is:
    ModLoad: 00400000 00420000   program.exe
    ModLoad: 7c900000 7c9b0000   ntdll.dll
    ModLoad: 7c800000 7c8f4000   C:\WINDOWS\system32\kernel32.dll
    ModLoad: 10000000 1002a000   c:\cdodd\bin\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 77f01000   C:\WINDOWS\system32\RPCRT4.dll
    ModLoad: 77f10000 77f57000   C:\WINDOWS\system32\GDI32.dll
    ModLoad: 77d40000 77dd0000   C:\WINDOWS\system32\USER32.dll
    ModLoad: 68b20000 68b40000   C:\WINDOWS\system32\GLU32.dll
    ModLoad: 73760000 737a9000   C:\WINDOWS\system32\DDRAW.dll
    ModLoad: 73bc0000 73bc6000   C:\WINDOWS\system32\DCIMAN32.dll
    ModLoad: 76b40000 76b6d000   C:\WINDOWS\system32\WINMM.dll
    ModLoad: 7c340000 7c396000   C:\WINDOWS\system32\MSVCR71.dll
    ModLoad: 00420000 0083d000   c:\cdodd\bin\cg.dll
    ModLoad: 00320000 00391000   c:\cdodd\bin\cgGL.dll
    Unknown exception - code c0000022 (first chance)
    Unknown exception - code c0000022 (!!! second chance !!!)
    eax=0012fc54 ebx=00000000 ecx=0012fc80 edx=7c90eb94 esi=7ffd7000 edi=c0000022
    eip=7c964ed1 esp=0012fc54 ebp=0012fca4 iopl=0         nv up ei pl zr na po nc
    cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246
    *** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdll.dll -
    ntdll!RtlRaiseStatus+26:
    7c964ed1 c9               leave
    0:000> g
    Access violation - code c0000005 (first chance)
    eax=0012fef0 ebx=7ffd7000 ecx=0012fef0 edx=0012fef0 esi=0007f7ec edi=00000000
    eip=0001c05c esp=0012fee8 ebp=0012ffc0 iopl=0         nv up ei pl nz na pe nc
    cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010202
    0001c05c               
    0:000>

     

    The dialog box appeared immediately after displaying the list of dlls.  When I hit OK, it continued up to the first prompt, and hitting 'g' resulted as above


  • preissen

    It looks like the last dll load were on:

    ModLoad: 00420000 0083d000 c:\cdodd\bin\cg.dll
    ModLoad: 00320000 00391000 c:\cdodd\bin\cgGL.dll

    That are these part of

    Thanks,
    Ayman Shoukry
    VC++ Team


  • DaverDee

    I am moving this to the games forum in case folks there have more details.

    Thanks,
    Ayman Shoukry
    VC++ Team


  • Debugging program that won't start