XP Deploying issues due to msvcr90.dll trying to load FlsAlloc
- by Sorin Sbarnea
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).