c++ - LoadLibrary 失败 : First chance exception 0xC0000139 (DLL Not Found) - How to debug?

标签 c++ exception dll loadlibrary

我有一个 dll“mytest.dll”,当通过 LoadLibrary() 加载时,返回 NULL(并且 127 作为 GetLastError())。如果我在“mytest.dll”上使用 DependencyWalker,它会报告它应该正确加载并且正确找到所有 DLL。在主机 exe 上运行 DependencyWalker 的探查器选项会在日志中显示以下相关部分:

00:00:55.099: Loaded "mytest.DLL" at address 0x07860000 by thread 0xBBC.  Successfully hooked module.
00:00:55.115: First chance exception 0xC0000139 (DLL Not Found) occurred in "NTDLL.DLL" at address 0x76E24285 by thread 0xBBC.
00:00:55.115: Unloaded "mytest.DLL" at address 0x07860000 by thread 0xBBC.
00:00:55.115: LoadLibraryW("mytest.dll") returned NULL by thread 0xBBC. Error: The specified procedure could not be found (127).

有没有办法对此进行调试,以找出 NTDLL.DLL 报告的 DLL Not Found 消息试图查找的内容?还是我应该到别处寻找问题的根源?

请注意,从另一个应用程序加载同一个“mytest.DLL”似乎可以正常工作。

最佳答案

您的应用程序是否可以在未找到的初始加载(可能)之后尝试通过 GetProcAddress 调用特定的 DLL 函数?它是 32 位还是 64 位应用程序?

如果它按照您的建议在另一个应用程序中正确加载,那么它可能有一个正确的入口点。

快速 google search建议您返回的错误代码可能来自 DLL 中缺少的函数名称(或特定函数的序号)。我建议打开类似 Exescope 的 DLL。并检查导出 list 。

它也可以解释为什么 DLL 与另一个应用程序一起工作(也许另一个应用程序在 DLL 中使用不同的导出函数)?

关于c++ - LoadLibrary 失败 : First chance exception 0xC0000139 (DLL Not Found) - How to debug?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/795391/

相关文章:

c++ - 类实例化语法

visual-studio-2010 - 解决第一次异常

c# - 尝试后终于没有被调用

vb.net - 重新启动 PC,停止使用 VB.NET 进行编码

c++ - 我可以在 gdb pretty-print 中直接调用程序的 `operator[]` 吗?

c++ - 在 OpenCV 中逐像素复制图像

c++ - 错误 C2440 : 'type cast' : cannot convert from 'bool' to 'CString'

.net - System.ArgumentException 路径中的非法字符

c# - 64 位进程 Vista 中的 64 位 dll 失败 - 无法加载 DLL 'dllname' : The specified module could not be found

c# - 用于共享第 3 方 DLL 的 NuGet 或程序集文件夹?