调试进程加载异常0xc0000138(未找到序数)

时间:2012-04-27 10:40:48

标签: c++ visual-studio-2010 visual-c++ dll

在VS2010上运行我的VC ++应用程序时

enter image description here我遇到以下错误: -

'26aprilmadefromnewfoldercode.exe': Loaded 'C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\26aprilmadefromnewfoldercode\Debug\26aprilmadefromnewfoldercode.exe', Symbols loaded.
'26aprilmadefromnewfoldercode.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Cannot find or open the PDB file
'26aprilmadefromnewfoldercode.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', Cannot find or open the PDB file
'26aprilmadefromnewfoldercode.exe': Loaded 'C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\26aprilmadefromnewfoldercode\Debug\hdpw32.dll', Binary was not built with debug information.
'26aprilmadefromnewfoldercode.exe': Loaded 'C:\WINDOWS\system32\winmm.dll', Cannot find or open the PDB file
'26aprilmadefromnewfoldercode.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', Cannot find or open the PDB file
'26aprilmadefromnewfoldercode.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', Cannot find or open the PDB file
'26aprilmadefromnewfoldercode.exe': Loaded 'C:\WINDOWS\system32\secur32.dll', Cannot find or open the PDB file
'26aprilmadefromnewfoldercode.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', Cannot find or open the PDB file
'26aprilmadefromnewfoldercode.exe': Loaded 'C:\WINDOWS\system32\user32.dll', Cannot find or open the PDB file
'26aprilmadefromnewfoldercode.exe': Loaded 'C:\WINDOWS\system32\comctl32.dll', Cannot find or open the PDB file
'26aprilmadefromnewfoldercode.exe': Loaded 'C:\WINDOWS\system32\shell32.dll', Cannot find or open the PDB file
'26aprilmadefromnewfoldercode.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', Cannot find or open the PDB file
'26aprilmadefromnewfoldercode.exe': Loaded 'C:\WINDOWS\system32\shlwapi.dll', Cannot find or open the PDB file
'26aprilmadefromnewfoldercode.exe': Loaded 'C:\WINDOWS\system32\setupapi.dll', Cannot find or open the PDB file
Debugger:: An unhandled non-continuable exception was thrown during process load
The program '[5800] 26aprilmadefromnewfoldercode.exe: Native' has exited with code -1073741512 

(0xc0000138)。

我的exe文件已构建但不会执行。如何调试流程负载或解决此错误?

3 个答案:

答案 0 :(得分:2)

您不会从中获取堆栈跟踪或转储,因为它在动态库加载期间似乎已失败。你可以做的最好的想法是将它加载到depends.exe中并查看导入的库和符号,这应该告诉你哪一个找不到。

看看这个问题:

"The specified procedure could not be found" error when running app on Windows XP (exception c0000139)

它显示了如果您尝试链接动态链接时不可用的API以及如何使用depends.exe调试它会发生什么。

答案 1 :(得分:2)

我在加载插件DLL的Windows进程中发现了非常相同的0xC0000138: Ordinal Not Found异常。该错误是由两个不同版本的 COMCTL32 加载到同一进程中引起的。

尝试使用调试器(或Process Monitor)并检查是否有任何机会加载两个COMCTL32模块,如下所示:

...
'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.18201_none_ec80f00e8593ece5\comctl32.dll'. Symbols loaded.
...
'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\comctl32.dll'. Symbols loaded.

如果是这种情况,那么将明确的COMCTL32引用添加到应用程序的清单中:

<dependency>
  <dependentAssembly>
    <assemblyIdentity type="win32" 
      name="Microsoft.Windows.Common-Controls" version="6.0.0.0"
      processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*">
    </assemblyIdentity>
  </dependentAssembly>
</dependency>

使用MSDN: Enabling Visual Styles文章中解释的方法之一。

答案 2 :(得分:1)

如果您要导出类并使用不同版本的运行时库构建,则可能会发生这种情况。因此,您必须检查所有dll是否都使用与您用于主应用程序构建的相同编译器构建。您需要做的只是清除解决方案并构建新的lib,dll将取代您拥有的旧版本。