From ee00815da359dccc976ec13a08686e7e164a6ff9 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Sat, 1 Jul 2017 13:10:25 +0300 Subject: [PATCH] Fix Windows XP support in LocalFileLoader Because that junk from 50 years ago still matters to people, apparently. --- Core/FileLoaders/LocalFileLoader.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Core/FileLoaders/LocalFileLoader.cpp b/Core/FileLoaders/LocalFileLoader.cpp index 588d2c944e..d720bf61cf 100644 --- a/Core/FileLoaders/LocalFileLoader.cpp +++ b/Core/FileLoaders/LocalFileLoader.cpp @@ -58,11 +58,13 @@ LocalFileLoader::LocalFileLoader(const std::string &filename) if (handle_ == INVALID_HANDLE_VALUE) { return; } - FILE_STANDARD_INFO info; - if (GetFileInformationByHandleEx(handle_, FileStandardInfo, &info, sizeof(info)) == 0) { + LARGE_INTEGER end_offset; + const LARGE_INTEGER zero = { 0 }; + if(SetFilePointerEx(handle_, zero, &end_offset, FILE_END) == 0) { return; } - filesize_ = info.EndOfFile.QuadPart; + filesize_ = end_offset.QuadPart; + SetFilePointerEx(handle_, zero, nullptr, FILE_BEGIN); #endif // !_WIN32