enlyze / enlyzewincompatlib Goto Github PK
View Code? Open in Web Editor NEWLet MSVC v141_xp/Clang targeted applications run on even older Windows versions
License: MIT License
Let MSVC v141_xp/Clang targeted applications run on even older Windows versions
License: MIT License
Thank you for providing such a great library that can help me to run my application in windowsxp.
I am facing this problem -
I follow the steps listed here - https://building.enlyze.com/posts/modern-visual-studio-meets-ancient-windows/#introducing-enlyzewincompatlib. But I am still getting an linking error: LNK2005 __imp__InitializeSListHead@4 already defined in kernel32.lib(KERNEL32.dll). A little help would be great. Thanks in advance
Thank you very much for your solution of making Visual Studio applications compatible with older Windows versions.
I try to achieve to run an application on Windows 95 while compiling using Visual C++ 2019. Currently I need to compile with OpenWatcom in order to create a Win95 binary of my application.
I have following problems:
(1)
In winnt_50.cpp at function _CompatInterlockedFlushSList
:
SLIST_HEADER NewHead = InitialHead;
ListEntry->Next = NewHead.Next.Next;
NewHead.Next.Next = ListEntry;
NewHead.Depth++;
NewHead.Sequence++; // not existing
In my Windows 10 SDK, the field "Sequence" is only available if defined(_AMD64_)
or defined(_ARM64_)
, but not for defined(_X86_)
or defined(_ARM_)
.
For x86, the definition in my Win10 SDK is:
typedef union _SLIST_HEADER {
ULONGLONG Alignment;
struct {
SLIST_ENTRY Next;
WORD Depth;
WORD CpuId;
} DUMMYSTRUCTNAME;
} SLIST_HEADER, *PSLIST_HEADER;
For the moment, I have simply commented out the line. But I am not sure if that fix is appropriate.
(2)
In my application I have following unresolved Win2000 dependencies which are supported by EnlyzeWinCompatLib:
DecodePointer
InitializeSListHead
GetModuleHandleExW
InterlockedFlushSList
(2a) In addition, I see following unresolved Win98 dependencies:
SetFilePointerEx
GetFileSizeEx
=> For these two functions, I have created following patch (sorry, I am not used to GIT/PullRequests, so I just uploaded my code).
EnlyzeWinCompatLib-Patch-VTS-1.zip
I haven't tested the functions themselves, and I am not sure if winnt_50.cpp is the correct "home" for these two functions. I think I should have called the file win98.cpp, since it implements functions missing in Windows 98. With the patch, I could successfully run my application on Windows 98 SE!
(2b) Win95 has more additional dependencies (used by the SDK, not used in my code):
FindFirstFileExW
(For Win95, the only way would be a fallback/convertion to FindFirstFileA)InitializeCriticalSectionAndSpinCount
(Can we simply call InitializeCriticalSection and ignore the spin feature, or will this lead to problems?)IsDebuggerPresent
(We can always return 0)IsProcessorFeaturePresent
(That will be very hard to implement. I'll have to look in the SDK source to see if this function is used in a critical way)=> Would it be possible to write patches for these functions as well? I would be super happy about it!
(3) When I untick the option "Inherit from parent or project defaults" as described on your website, I get a lot of errors of unresolved symbols, so I cannot build my executable. What am I doing wrong?
If I simply place the source files into my own project (without dependency), then it works.
(4) My application (a Photoshop plugin) crashes on one Win2000 computer and on another Win2000 VM it doesn't crash.
The crash happens when I call the function ceil
. Directly after ceil
is executed, the CompatInterlockedFlushSList
compatibility function is called, and after that call, the program crashes.
int main() {
..........
simplealert(_strdup("Debug A"));
int32 y = (int32)ceil((x / 10.) * 9);
simplealert(_strdup("Debug D"));
..........
}
extern "C" PSLIST_ENTRY WINAPI
LibInterlockedFlushSList(PSLIST_HEADER ListHead)
{
........
MessageBox(NULL, "B", "Debug", MB_OKCANCEL);
pfnInterlockedFlushSList = _CompatInterlockedFlushSList;
MessageBox(NULL, "C", "Debug", MB_OKCANCEL);
........
}
This sample program will output the debug messages A, B, C and then crashes.
So, I have the suspicion that the reason is my commented out NewHead.Sequence++
, and it is most likely dependent on the CPU of the computer.
But, theoretically, it is also possible that Visual C++ 2019 creates CPU OP codes which cannot be executed by the CPU of the old computer (Intel Celeron 500 MHz), and the call to InterlockedFlushSList
is invoked by a crash handler or similar. Having ceil
crashing probably means that there is some CPU airthmetic related stuff going on, probably in combination with compiler optimizations.
(5) When I included the .asm files in my project and enabled "masm", I cannot compile my application with Win64 anymore. (I compile my application in 32 and 64 bit)
Following errors show up when I try to compile as X64:
I get a lot of errors at _CompatInterlockedFlushSList
, saying "union _SLIST_HEADER has no member Next/Depth/Sequence".
The asm files show that .model flat
has a syntax error, because "model" is not existing in x64
How can I completely disable "masm"/EnlyzeWinCompatLib for the X64 build?
Thank you for your help!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.