LoadLibrary(" my.dll")在使用v120_xp工具集在VS 2013中构建项目时返回正常。但在VS 2017上使用v141_xp工具集(平台为7.1)时,它返回NULL并返回错误代码4250.我确保两次都进行干净的构建。
我无法进入LoadLibrary(F11)。
执行该行后,ProcessMonitor在RegQueryValue上的HKLM \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ SideBySide \ PreferExternalManifest上显示FILE LOCKED WITH ONLY READERS on CreateFileMapping且NAME NOT FOUND,但是否则所有SUCCESS
对于my.dll的两个版本,dumpbin / headers是相同的
Dependency Walker有错误,如循环依赖,未解析的导出等,但2013版本的工作似乎有相同的错误。使用VS 2017 my.dll有额外的依赖UCRTBased.dll,vcruntime140d.dll。
my.dll静态链接到Boost 1.64& TBB但这些都是在没有任何Windows商店或通用选项的情况下构建的。我使用的是Windows 10和cmake 3.8。生成VS解决方案的cmake文件没有变化。
以下是依赖步行者资料:
LoadLibraryA("my.dll") called from "d:\myproject\x64\debug\my.EXE" at address 0x00007FF7FCED1DA2.
Loaded "d:\myproject\x64\debug\my.DLL" at address 0x00007FFA49D40000. Successfully hooked module.
Loaded "d:\myproject\x64\debug\abc.DLL" at address 0x00007FFA45190000. Successfully hooked module.
Loaded "c:\windows\system32\OLEAUT32.DLL" at address 0x00007FFA839F0000. Successfully hooked module.
Loaded "c:\windows\system32\MSVCP_WIN.DLL" at address 0x00007FFA83010000. Successfully hooked module.
Loaded "c:\windows\system32\OLE32.DLL" at address 0x00007FFA83750000. Successfully hooked module.
Loaded "d:\myproject\x64\debug\def.DLL" at address 0x00007FFA67FD0000. Successfully hooked module.
Loaded "d:\myproject\x64\debug\TBB_DEBUG.DLL" at address 0x00007FFA62BE0000. Successfully hooked module.
Unloaded "d:\myproject\x64\debug\abc.DLL" at address 0x00007FFA45190000.
Unloaded "d:\myproject\x64\debug\TBB_DEBUG.DLL" at address 0x00007FFA62BE0000.
Unloaded "c:\windows\system32\MSVCP_WIN.DLL" at address 0x00007FFA83010000.
Unloaded "c:\windows\system32\OLEAUT32.DLL" at address 0x00007FFA839F0000.
Unloaded "c:\windows\system32\OLE32.DLL" at address 0x00007FFA83750000.
Unloaded "d:\myproject\x64\debug\def.DLL" at address 0x00007FFA67FD0000.
Unloaded "d:\myproject\x64\debug\my.DLL" at address 0x00007FFA49D40000.
LoadLibraryA("my.dll") returned NULL. Error: This operation is only valid in the context of an app container (4250).
答案 0 :(得分:0)
检查程序是否在您认为的位置运行(项目设置的调试部分中的工作目录,如果您的程序没有更改当前目录本身)。