由于 msvcr90.dll 尝试加载 FlsAlloc 导致 XP 部署问题
我有一个在 Windows 7 x64 上使用 VS2008 SP1a (9.0.30729.4148) 构建的应用程序,但不想在 XP 下启动。
消息为应用程序无法正确初始化 (0x80000003)。单击“确定”终止应用程序。
。我检查了 depends.exe
并发现 msvcr90.dll
确实尝试从 KERNEL32.dll 加载 FlsAlloc
- 并且 FlsAlloc 仅在开始时可用远景。我确信应用程序没有使用它。
如何解决问题?
SxS 软件包已安装在目标计算机上 - 事实上,我拥有 9.0 SxS 的所有 3 个版本(初始版本、sp1 和 sp1+安全补丁)
应用程序是使用 _BIND_TO_CURRENT_VCLIBS_VERSION=1
编译的
我还定义了 上正确的目标 Windows 版本
#define WINVER 0x0500
#define _WIN32_WINNT 0x0500
stdafx.h
清单文件
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.30729.4148" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.MFC" version="9.0.30729.4148" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" />
</dependentAssembly>
</dependency>
</assembly>
结果取决于
在地址 0x00400000 处启动“c:\program files\app\app.EXE”(进程 0xA0)。成功挂接模块。 已在地址 0x7C900000 加载“c:\windows\system32\NTDLL.DLL”。成功挂接模块。 已在地址 0x7C800000 加载“c:\windows\system32\KERNEL32.DLL”。成功挂接模块。 已在地址 0x785E0000 加载“c:\program files\app\MFC90.DLL”。成功挂接模块。 已在地址 0x78520000 加载“c:\program files\app\MSVCR90.DLL”。成功挂接模块。 已在地址 0x7E410000 加载“c:\windows\system32\USER32.DLL”。成功挂接模块。 在地址 0x77F10000 处加载了“c:\windows\system32\GDI32.DLL”。成功挂接模块。 已在地址 0x77F60000 加载“c:\windows\system32\SHLWAPI.DLL”。成功挂接模块。 已在地址 0x77DD0000 加载“c:\windows\system32\ADVAPI32.DLL”。成功挂接模块。 已在地址 0x77E70000 加载“c:\windows\system32\RPCRT4.DLL”。成功挂接模块。 已在地址 0x77FE0000 加载“c:\windows\system32\SECUR32.DLL”。成功挂接模块。 已在地址 0x77C10000 加载“c:\windows\system32\MSVCRT.DLL”。成功挂接模块。 已在地址 0x5D090000 加载“c:\windows\system32\COMCTL32.DLL”。成功挂接模块。 已在地址 0x76380000 加载“c:\windows\system32\MSIMG32.DLL”。成功挂接模块。 已在地址 0x7C9C0000 加载“c:\windows\system32\SHELL32.DLL”。成功挂接模块。 已在地址 0x77120000 加载“c:\windows\system32\OLEAUT32.DLL”。成功挂接模块。 已在地址 0x774E0000 加载“c:\windows\system32\OLE32.DLL”。成功挂接模块。 已到达入口点。所有隐式模块均已加载。 调用“c:\program files\app\MSVCR90.DLL”中的 DllMain(0x78520000, DLL_PROCESS_ATTACH, 0x0012FD30)。 GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsAlloc") 从地址 0x78543ACC 处的“c:\program files\app\MSVCR90.DLL”调用并返回 NULL。错误:找不到指定的过程 (127)。 GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsGetValue") 从地址 0x78543AD9 处的“c:\program files\app\MSVCR90.DLL”调用并返回 NULL。错误:找不到指定的过程 (127)。 GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsSetValue") 从地址 0x78543AE6 处的“c:\program files\app\MSVCR90.DLL”调用并返回 NULL。错误:找不到指定的过程 (127)。 GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsFree") 从地址 0x78543AF3 处的“c:\program files\app\MSVCR90.DLL”调用并返回 NULL。错误:找不到指定的过程 (127)。
我应该提到我已经安装了 Windows SDK 7 并将其配置为默认 SDK。
I have an application build with VS2008 SP1a (9.0.30729.4148) on Windows 7 x64 that does not want to start under XP.
The message is The application failed to initialize properly (0x80000003). Click on OK to terminate the application.
. I checked with depends.exe
and found that msvcr90.dll
does try to load FlsAlloc
from KERNEL32.dll - and FlsAlloc is available only starting with Vista. I'm sure it is not used by the application.
How to solve the issue?
The SxS package is already installed on the target machine - In fact I have all 3 versions of 9.0 SxS (initial release, sp1, and sp1+security patch)
Application is compiled with _BIND_TO_CURRENT_VCLIBS_VERSION=1
Also I defined the right target Windows version on stdafx.h
#define WINVER 0x0500
#define _WIN32_WINNT 0x0500
Manifest file
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.30729.4148" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.MFC" version="9.0.30729.4148" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" />
</dependentAssembly>
</dependency>
</assembly>
Result from depends
Started "c:\program files\app\app.EXE" (process 0xA0) at address 0x00400000. Successfully hooked module.
Loaded "c:\windows\system32\NTDLL.DLL" at address 0x7C900000. Successfully hooked module.
Loaded "c:\windows\system32\KERNEL32.DLL" at address 0x7C800000. Successfully hooked module.
Loaded "c:\program files\app\MFC90.DLL" at address 0x785E0000. Successfully hooked module.
Loaded "c:\program files\app\MSVCR90.DLL" at address 0x78520000. Successfully hooked module.
Loaded "c:\windows\system32\USER32.DLL" at address 0x7E410000. Successfully hooked module.
Loaded "c:\windows\system32\GDI32.DLL" at address 0x77F10000. Successfully hooked module.
Loaded "c:\windows\system32\SHLWAPI.DLL" at address 0x77F60000. Successfully hooked module.
Loaded "c:\windows\system32\ADVAPI32.DLL" at address 0x77DD0000. Successfully hooked module.
Loaded "c:\windows\system32\RPCRT4.DLL" at address 0x77E70000. Successfully hooked module.
Loaded "c:\windows\system32\SECUR32.DLL" at address 0x77FE0000. Successfully hooked module.
Loaded "c:\windows\system32\MSVCRT.DLL" at address 0x77C10000. Successfully hooked module.
Loaded "c:\windows\system32\COMCTL32.DLL" at address 0x5D090000. Successfully hooked module.
Loaded "c:\windows\system32\MSIMG32.DLL" at address 0x76380000. Successfully hooked module.
Loaded "c:\windows\system32\SHELL32.DLL" at address 0x7C9C0000. Successfully hooked module.
Loaded "c:\windows\system32\OLEAUT32.DLL" at address 0x77120000. Successfully hooked module.
Loaded "c:\windows\system32\OLE32.DLL" at address 0x774E0000. Successfully hooked module.
Entrypoint reached. All implicit modules have been loaded.
DllMain(0x78520000, DLL_PROCESS_ATTACH, 0x0012FD30) in "c:\program files\app\MSVCR90.DLL" called.
GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsAlloc") called from "c:\program files\app\MSVCR90.DLL" at address 0x78543ACC and returned NULL. Error: The specified procedure could not be found (127).
GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsGetValue") called from "c:\program files\app\MSVCR90.DLL" at address 0x78543AD9 and returned NULL. Error: The specified procedure could not be found (127).
GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsSetValue") called from "c:\program files\app\MSVCR90.DLL" at address 0x78543AE6 and returned NULL. Error: The specified procedure could not be found (127).
GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsFree") called from "c:\program files\app\MSVCR90.DLL" at address 0x78543AF3 and returned NULL. Error: The specified procedure could not be found (127).
I should mention that I have Windows SDK 7 installed and configured as default SDK.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我总是将清单嵌入到我的 DLL 中并且从未遇到过问题。当我忘记嵌入清单时,我才遇到了问题。然后在Windows 2008上找不到MSVCR90.dll,但在旧版本的Windows上却可以工作,这让我困惑了一段时间。
I always embed the manifest in my DLLs and have never had a problem. I only ran into a problem when I forgot to embed the manifest. Then it fails to find the MSVCR90.dll on Windows 2008, but it works on older versions of Windows, which confused me for a while.
清单工具确实有缺陷,唯一可靠的解决方案是不将清单嵌入到二进制文件中,因为嵌入几乎随机失败。把清单放在外面很丑陋,但至少总是有效的。
Manifest tool is really buggy and the only reliable solution was to not embed the manifest into the binaries because embedding fails almost randomly. Keeping the manifest outside is ugly but at least always works.