Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
823ec95fce | |||
a6f499ce50 | |||
85e0b8e39a | |||
b8225eeb99 | |||
d942b6cdfc |
@ -20,9 +20,6 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
|
||||
</MASM>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\compat.c" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
@ -80,7 +77,7 @@
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
@ -106,7 +103,7 @@
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
|
@ -22,9 +22,4 @@
|
||||
<Filter>Source Files</Filter>
|
||||
</MASM>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\compat.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,17 +0,0 @@
|
||||
/******************************************************************************/
|
||||
/* CompatLib for Windows XP, by LoRd_MuldeR <MuldeR2@GMX.de> */
|
||||
/* This work has been released under the CC0 1.0 Universal license! */
|
||||
/******************************************************************************/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <Windows.h>
|
||||
|
||||
BOOL WINAPI XPCompatLib_InitializeCriticalSectionEx(LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount, DWORD Flags)
|
||||
{
|
||||
return InitializeCriticalSectionAndSpinCount(lpCriticalSection, dwSpinCount);
|
||||
}
|
||||
|
||||
int WINAPI XPCompatLib_LCMapStringEx(LPCWSTR lpLocaleName, DWORD dwMapFlags, LPCWSTR lpSrcStr, int cchSrc, LPWSTR lpDestStr, int cchDest, LPNLSVERSIONINFO lpVersionInformation, LPVOID lpReserved, LPARAM sortHandle)
|
||||
{
|
||||
return LCMapStringW(LOCALE_SYSTEM_DEFAULT, dwMapFlags, lpSrcStr, cchSrc, lpDestStr, cchDest);
|
||||
}
|
@ -5,13 +5,19 @@
|
||||
|
||||
.data
|
||||
|
||||
__imp_InitializeCriticalSectionEx dq XPCompatLib_InitializeCriticalSectionEx
|
||||
__imp_LCMapStringEx dq XPCompatLib_LCMapStringEx
|
||||
__imp_CompareStringEx dq __acrt_CompareStringEx
|
||||
__imp_GetLocaleInfoEx dq __acrt_GetLocaleInfoEx
|
||||
__imp_InitializeCriticalSectionEx dq __acrt_InitializeCriticalSectionEx
|
||||
__imp_LCMapStringEx dq __acrt_LCMapStringEx
|
||||
|
||||
externdef __imp_CompareStringEx : QWORD
|
||||
externdef __imp_GetLocaleInfoEx : QWORD
|
||||
externdef __imp_InitializeCriticalSectionEx : QWORD
|
||||
externdef __imp_LCMapStringEx : QWORD
|
||||
|
||||
extern XPCompatLib_InitializeCriticalSectionEx : proc
|
||||
extern XPCompatLib_LCMapStringEx : proc
|
||||
extern __acrt_CompareStringEx : proc
|
||||
extern __acrt_GetLocaleInfoEx : proc
|
||||
extern __acrt_InitializeCriticalSectionEx : proc
|
||||
extern __acrt_LCMapStringEx : proc
|
||||
|
||||
end
|
||||
|
@ -7,13 +7,19 @@
|
||||
|
||||
.data
|
||||
|
||||
__imp__InitializeCriticalSectionEx@12 dd _XPCompatLib_InitializeCriticalSectionEx@12
|
||||
__imp__LCMapStringEx@36 dd _XPCompatLib_LCMapStringEx@36
|
||||
__imp__CompareStringEx@36 dd ___acrt_CompareStringEx@36
|
||||
__imp__GetLocaleInfoEx@16 dd ___acrt_GetLocaleInfoEx@16
|
||||
__imp__InitializeCriticalSectionEx@12 dd ___acrt_InitializeCriticalSectionEx@12
|
||||
__imp__LCMapStringEx@36 dd ___acrt_LCMapStringEx@36
|
||||
|
||||
externdef __imp__CompareStringEx@36 : DWORD
|
||||
externdef __imp__GetLocaleInfoEx@16 : DWORD
|
||||
externdef __imp__InitializeCriticalSectionEx@12 : DWORD
|
||||
externdef __imp__LCMapStringEx@36 : DWORD
|
||||
|
||||
extern _XPCompatLib_InitializeCriticalSectionEx@12 : proc
|
||||
extern _XPCompatLib_LCMapStringEx@36 : proc
|
||||
extern ___acrt_CompareStringEx@36 : proc
|
||||
extern ___acrt_GetLocaleInfoEx@16 : proc
|
||||
extern ___acrt_InitializeCriticalSectionEx@12 : proc
|
||||
extern ___acrt_LCMapStringEx@36 : proc
|
||||
|
||||
end
|
||||
|
24
README.md
24
README.md
@ -1,23 +1,33 @@
|
||||
Introduction
|
||||
============
|
||||
|
||||
CompatLib – compatibility library for re-establishing Windows XP SP-3 support in VS2019 (and later).
|
||||
CompatLib – compatibility library for re-establishing Windows XP (SP-3) support in VS2019 and VS2022.
|
||||
|
||||
Executables built with VS2019 (Toolset v142) do **not** normally run on Windows XP SP-3. That is because the executables created by VS2019 (Toolset v142) depend on certain functions in `KERNEL32.DLL` that simply did **not** exist in Windows XP SP-3 yet. Consequently, the executable will fail to start with an error message about the missing entry point! CompatLib provides a workaround for the problem, by eliminating the "problematic" `KERNEL32.DLL` dependencies from the executable, so that the executable will again be able to run on Windows XP SP-3. This is achieved by substituting the call to the original (missing) function in `KERNEL32.DLL` with a small "shim" function that is linked directly into the executable. The "shim" function will forward the call to an adequate function in `KERNEL32.DLL` that *does* exist on Windows XP SP-3. In fact, there currently are *two* such function dependencies that must be substituted by CompatLib, i.e. `InitializeCriticalSectionEx()` and `LCMapStringEx()`.
|
||||
C/C++ executables built with VS2019 (Toolset v142) or VS2022 (Toolset v143) do **not** normally run on Windows XP. That is because the executables created by VS2019 (Toolset v142) or VS2022 (Toolset v143) depend on certain functions in the `KERNEL32.DLL` system library that simply did **not** exist in Windows XP yet. Consequently, on the Windows XP system, those executable fail to start with an error message about the missing entry point!
|
||||
|
||||
**Note:** It still is necessary to install "Service Pack 3" for Windows XP 😏
|
||||
CompatLib provides a workaround for the problem, by eliminating the "problematic" `KERNEL32.DLL` dependencies from the executable, so that the executable will again be able to run on Windows XP. This is achieved by substituting the call to the original (missing) function in `KERNEL32.DLL` with a small "shim" function. The "shim" function is linked directly into the executable file; it tries to emulate the call, by forwarding the call to an adequate function in `KERNEL32.DLL` that *does* exist on Windows XP. Dependencies that must be substituted by CompatLib include `InitializeCriticalSectionEx()`, `LCMapStringEx()`, `CompareStringEx()` and `GetLocaleInfoEx()`.
|
||||
|
||||
|
||||
### Remarks
|
||||
|
||||
* Even with CompatLib, it still *is* necessary to install "Service Pack 3" for Windows XP on the target system
|
||||
|
||||
* Running x64 (64-Bit) executables is possible, but requires the *Windows XP Professional x64 Edition*
|
||||
|
||||
* If your *application code* uses other Win32 API functions unavailable in Windows XP, then CompatLib will **not** help!
|
||||
CompatLib **only** removes the "problematic" dependencies induced by Microsoft's C/C++ Runtime.
|
||||
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
In order to build an executable that will run on Windows XP SP-3, the following project settings are required:
|
||||
In order to build an executable that will run on Windows XP with VS2019 (Toolset v142) or VS2022 (Toolset v143), the following settings are required in your Visual Studio C/C++ project:
|
||||
|
||||
1. The ***runtime library*** must be set to `Multi-threaded (/MT)` – *static* linking is necessary
|
||||
1. ***Code Generation / Runtime Library*** must be set to `Multi-threaded (/MT)` ➟ *static* linking is necessary!
|
||||
|
||||
2. The ***minimum required version*** must be set to `5.1` (32-Bit) or `5.2` (64-Bit)
|
||||
2. ***System / Minimum Required Version*** must be forced to `5.1` (x86) or `5.2` (x64)
|
||||
|
||||
3. The matching variant of `libcompat.lib` must be added to the ***additional dependencies***
|
||||
3. Finally, the matching variant of `libcompat.lib` must be added to ***Input / Additional Dependencies***
|
||||
|
||||
|
||||
License
|
||||
|
Loading…
Reference in New Issue
Block a user