【问题标题】:Debugging process load exception 0xc0000138 (Ordinal not found)调试进程加载异常 0xc0000138 (Ordinal not found)
【发布时间】:2012-04-27 10:40:47
【问题描述】:

在 VS2010 上运行我的 VC++ 应用程序时出现以下错误:-

'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 文件已构建,但没有执行。如何调试进程负载或解决此错误?

【问题讨论】:

  • 你有堆栈跟踪或转储文件吗?
  • 先生,我是 VC++ 新手,我不知道堆栈跟踪是什么..
  • @Rup 我已将所有 dll 放入调试文件夹本身
  • 你的 exe 是从哪里运行的?你的 exe 是发布版本还是调试版本?
  • 您不会从中获得堆栈跟踪或转储,因为它似乎在动态库加载期间失败。最好的办法是在depends.exe中加载它并查看导入的库和符号,这应该会告诉你哪个找不到。

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


【解决方案1】:

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

看看这个问题:

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

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

【讨论】:

    【解决方案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 文章中解释的方法之一。

    【讨论】:

      【解决方案3】:

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

      【讨论】:

      • 我知道,但必须提一下,这可能是他的问题的解决方案。
      • @Benj 我在依赖行者中打开了我的 exe 我在以下 dll 前面显示了一个用红点填充的框:-ADVAPI32.DLL,HDPW32.DLL,KERNEL32.DLL,KERNEL32.DLL MSVCRT.DLL NTDLL .DLL RPCRT4.DLL SHELL32.DLL USER32.DLL DUSER.DLL MPR.DLL UXTHEME.DLL.如何获得当前版本的 hdpw32.dll?
      • @user1312155 能发张depends.exe的截图吗?
      • @Benj 我已经上传了我的截图,我已经链接了库 hdpw32.lib 和 ideatools.lib,而不是它给出的错误。我的构建成功但是当我运行我的 exe 时它给出了错误来检查应用设置
      • @user1312155 - 不要担心 wer.dll 和 ieshims.dll,它们是延迟加载依赖项,并且depends.exe 几乎总是将这些显示为错误,通常它们并不代表真正的问题。关于其他问题,检查系统事件日志,有时动态链接问题会更详细地显示在这里。
      猜你喜欢
      • 2021-02-17
      • 2018-08-22
      • 2017-03-25
      • 2016-08-19
      • 1970-01-01
      • 2012-09-20
      • 2012-12-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多