2010-03-14 34 views
0

我有一个应用程序内置与VS2008 SP1a(9.0.30729.4148)在Windows 7 x64不想在XP下启动。XP部署问题,由于msvcr90.dll试图加载FlsAlloc

该消息是The application failed to initialize properly (0x80000003). Click on OK to terminate the application.。我检查了depends.exe,发现msvcr90.dll尝试从KERNEL32.dll加载FlsAlloc - 而FlsAlloc只能从Vista开始。我确定它没有被应用程序使用。

如何解决这个问题?

中的SxS包已经安装在目标机器上 - 其实我有9.0的SxS所有3个版本(初始版本,SP1和SP1 +安全补丁)

应用程序编译时_BIND_TO_CURRENT_VCLIBS_VERSION=1

此外,我对stdafx.h

#define WINVER 0x0500 
#define _WIN32_WINNT 0x0500 

清单文件中定义的正确的目标Windows版本

<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> 

结果从依赖

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).

我要指出,我有Windows SDK 7安装并配置为默认的SDK。

+0

http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/21418b8a-b7fe-4049-b23a-f5e4941e63db/)说我应该检查SDK中包含Visual目录的顶层目录工作室。我改变了他们,但没有成功。 – sorin 2010-03-14 20:27:13

回答

-1

清单工具实际上是越野车,唯一可靠的解决方案是不将清单嵌入到二进制文件中,因为嵌入失败几乎是随机的。保持外面的清单是丑陋的,但至少总是有效。

+0

此外,微软从VS 2010丢弃清单:) – sorin 2011-06-16 09:08:48

0

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