0

我在 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。

4

2 回答 2

0

我总是将清单嵌入到我的 DLL 中并且从来没有遇到过问题。我只是在忘记嵌入清单时遇到了问题。然后它在 Windows 2008 上找不到 MSVCR90.dll,但它适用于旧版本的 Windows,这让我困惑了一段时间。

于 2011-06-15T18:50:31.217 回答
-1

清单工具确实有问题,唯一可靠的解决方案是不将清单嵌入到二进制文件中,因为嵌入几乎随机失败。将清单放在外面很丑陋,但至少总是有效。

于 2010-08-09T09:50:25.023 回答