Giter Site home page Giter Site logo

enlyzewincompatlib's People

Contributors

colinfinck avatar solemnwarning avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

enlyzewincompatlib's Issues

Windows 98 and Windows 10 SDK compatibility

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

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:

  1. I get a lot of errors at _CompatInterlockedFlushSList, saying "union _SLIST_HEADER has no member Next/Depth/Sequence".

  2. 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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.