bmx-ng / pub.mod

BlitzMax NG Pub modules port.
7 stars 8 forks source link

[physfs.mod] Current version fails on Windows 7 (CreateFile2 not known in kernel) #68

Open GWRon opened 7 months ago

GWRon commented 7 months ago

Coming from my initial thoughts in: https://github.com/bmx-ng/image.mod/issues/29

The current Weekly Builds are not able to execute their built files on Windows 7 - because physfs calls CreateFile2 there.

The issue is in physfs.mod/physfs/src/physfs_platform_windows.c

static inline HANDLE winCreateFileW(const WCHAR *wfname, const DWORD mode,
                                    const DWORD creation)
{
    const DWORD share = FILE_SHARE_READ | FILE_SHARE_WRITE;
    #if defined(PHYSFS_PLATFORM_WINRT) || (_WIN32_WINNT >= 0x0602) // Windows 8+
        return CreateFile2(wfname, mode, share, creation, NULL);
    #else
    return CreateFileW(wfname, mode, share, NULL, creation,
                       FILE_ATTRIBUTE_NORMAL, NULL);
    #endif
} /* winCreateFileW */

That code there is incorrect - it also is used on Windows 7.

Once knowing this it was easy to spot, that the physfs-repo already fixed that 2 months ago: https://github.com/icculus/physfs/commit/cc2da5ab96cc79c5132017ad8f5bf60ab7243414

Maybe we could update physfs too - or at least incorporate the fix so Windows7 users are back in the game again.

GWRon commented 6 months ago

Seems this also affects MaxIDE builds in weekly build releases.