我在 Windows 7 x64 上使用 VS2008 SP1a (9.0.30729.4148) 构建了一个不想在 XP 下启动的应用程序。
消息是The application failed to initialize properly (0x80000003). Click on OK to terminate the application.
。我检查depends.exe
并发现msvcr90.dll
确实尝试FlsAlloc
从 KERNEL32.dll 加载 - 而 FlsAlloc 仅从 Vista 开始可用。我确定它没有被应用程序使用。
如何解决问题?
SxS 包已经安装在目标机器上 - 事实上我有 9.0 SxS 的所有 3 个版本(初始版本、sp1 和 sp1+安全补丁)
应用程序是用_BIND_TO_CURRENT_VCLIBS_VERSION=1
我还定义了正确的目标 Windows 版本stdafx.h
#define WINVER 0x0500
#define _WIN32_WINNT 0x0500
清单文件
<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”。成功挂接模块。加载“c:
我应该提到我已安装 Windows SDK 7 并将其配置为默认 SDK。