调试可怕的“应用程序初始化失败”错误

发布于 2024-08-20 16:09:10 字数 1922 浏览 2 评论 0原文

当尝试运行我在 Windows 上构建的可执行文件时,我偶尔会遇到此错误,但我不知道是什么原因导致它或如何修复它。使用普通的 MSVC 调试器,它只是弹出一个对话框并退出,没有机会执行任何操作或查看任何内容。我至少成功地捕获了一些东西并使用 Microsoft 控制台调试器获得了堆栈跟踪,但我不知道从这里看什么。在进入我的程序的主要功能或运行我的任何代码之前,它似乎在 ntdll.dll 中奇怪地失败了。

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>

有人对从这里开始调试这个有什么建议吗?

I occasionally run into this error when trying run an executable I've built on windows, but I have no idea what causes it or how to fix it. With the normal MSVC debugger, it just pops up a dialog and exits with no chance to do anything or look at anything. I've managed to at least catch something and get a stack trace with the Microsoft console debugger, but I have no idea what to look at from here. It seems to be failing oddly within ntdll.dll before ever getting to 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>

Anyone have any suggestions of where to go from here in debugging this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

宛菡 2024-08-27 16:09:10

根据白痴的回答,您应该运行进程监视器

该工具将准确地告诉您您的进程做了什么,它尝试加载哪些文件(可能至少有一个失败),以及错误是什么。

它的作用远不止于此,对于任何流程故障排除来说,它都可以节省惊人的时间。

Following up on Moron's answer, You should run Process Monitor.

This tool will tell you exactly what your process does, and which files it tried (and likely at least for one failed) to load, and what the errors are.

It does more than this, and for any process troubleshooting, it's an amazing time-saver.

摇划花蜜的午后 2024-08-27 16:09:10

通常“应用程序初始化失败”错误与缺少 dll 导入有关;与 0xC0000022 结合使用,可能意味着您的应用程序所需的 dll 由于访问被拒绝错误而无法加载(可能用户没有打开/执行该文件的权限)。

Usually the "Application has failed to initialize" error is related to missing imports from dlls; combined with the 0xC0000022 it may mean that a dll needed by your application cannot be loaded because of an access denied error (maybe the user hasn't got the rights to open/execute that file).

木格 2024-08-27 16:09:10

尝试使用依赖步行器运行。 http://dependencywalker.com/

它对依赖关系进行静态分析,并且还可以通过启动跟踪应用。

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

It does static analysis of dependencies, and it can also trace through the startup of an application.

凉墨 2024-08-27 16:09:10

如果我没记错的话,异常代码 c0000022 代表访问被拒绝。通常,这意味着 Windows 阻止了对资源的访问,例如域控制器或驱动程序。

您尚未指定应用程序的性质,但从堆栈转储中可以明显看出它处理 3D/OpenGL 设备。也许您的问题在于驱动程序或库配置错误。我建议在另一台机器上进行测试和/或重新安装驱动程序。

If I recall correctly, exception code c0000022 stands for Access Denied. Usually, it means Windows blocked access to a resource, like a domain controller or a driver.

You haven't specified the nature of your application, but it is evident from the stack dump that it deals with 3D/OpenGL devices. Perhaps your issue lies with a misconfigured driver or library. I suggest testing on another machine and/or re-installing your drivers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文