From 0546c86716a3f603cbcfeccd67b9d541b098c263 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Thu, 31 May 2018 10:24:16 +0300 Subject: [PATCH] - fixed Windows XP compatibility for MSVC 2017 targets Workaround initially implemented for MSVC 2015 is enabled with all Windows XP compatible toolsets regardless of Visual Studio version https://forum.zdoom.org/viewtopic.php?t=60675 --- src/CMakeLists.txt | 5 ----- src/win32/i_system.cpp | 13 ++++++------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 16c23743a..59dd637a2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -416,11 +416,6 @@ if( NOT MSVC ) add_definitions( -D__forceinline=inline ) endif() -# Fix stat in v140_xp (broken in RTM and Update 1 so far) -if( MSVC AND MSVC_VERSION EQUAL 1900 AND CMAKE_GENERATOR_TOOLSET STREQUAL "v140_xp" ) - add_definitions( -D_stat64i32=VS14Stat ) -endif() - if( UNIX ) CHECK_LIBRARY_EXISTS( rt clock_gettime "" CLOCK_GETTIME_IN_RT ) if( NOT CLOCK_GETTIME_IN_RT ) diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 28f2bf5ed..2a49a2426 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -1440,19 +1440,18 @@ FString I_GetLongPathName(FString shortpath) return longpath; } -#if _MSC_VER == 1900 && defined(_USING_V110_SDK71_) +#ifdef _USING_V110_SDK71_ //========================================================================== // -// VS14Stat +// _stat64i32 // -// Work around an issue where stat doesn't work with v140_xp. This was -// supposedly fixed, but as of Update 1 continues to not function on XP. +// Work around an issue where stat() function doesn't work +// with Windows XP compatible toolset. +// It uses GetFileInformationByHandleEx() which requires Windows Vista. // //========================================================================== -#include - -int VS14Stat(const char *path, struct _stat64i32 *buffer) +int _stat64i32(const char *path, struct _stat64i32 *buffer) { WIN32_FILE_ATTRIBUTE_DATA data; if(!GetFileAttributesEx(path, GetFileExInfoStandard, &data))