Mercurial > jwe > octave
changeset 29359:6c2fa2293242
Increase Windows API version to Windows 7 (bug #60014).
* configure.ac: Increase minimum value of _WIN32_WINNT to 0x0601 (Windows 7).
* libinterp/corefcn/sysdep.cc (set_application_id): Call
"SetCurrentProcessExplicitAppUserModelID" directly.
* liboctave/system/oct-time.cc (base_tm::init): Call
"GetTimeZoneInformationForYear" unconditionally.
* NEWS: Add note about new minimum Windows version.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sat, 06 Feb 2021 11:14:13 +0100 |
parents | 715344f405f0 |
children | 2a4998b97990 |
files | NEWS configure.ac libinterp/corefcn/sysdep.cc liboctave/system/oct-time.cc |
diffstat | 4 files changed, 10 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Sat Feb 06 09:27:26 2021 -0500 +++ b/NEWS Sat Feb 06 11:14:13 2021 +0100 @@ -76,6 +76,9 @@ same number of digits for each value such as `[0x00_00_01; 0x00_01_00; 0x01_00_00]`. +- For Octave on Windows OS, the minimum required version of the Windows +API is now 6.1 (Windows 7 or newer). + - As part of GSoC 2020, Abdallah K. Elshamy implemented the `jsondecode` and `jsonencode` functions to read and write JSON data.
--- a/configure.ac Sat Feb 06 09:27:26 2021 -0500 +++ b/configure.ac Sat Feb 06 11:14:13 2021 +0100 @@ -1067,14 +1067,14 @@ AC_MSG_CHECKING([for required _WIN32_WINNT]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <windows.h> - #if _WIN32_WINNT < 0x0403 + #if _WIN32_WINNT < 0x0601 #error "Wrong version" #endif ]], [])], [AC_MSG_RESULT([none])], - [AC_DEFINE(_WIN32_WINNT, 0x0403, - [Define to 0x0403 to access InitializeCriticalSectionAndSpinCount.]) - AC_MSG_RESULT([0x0403])]) + [AC_DEFINE(_WIN32_WINNT, 0x0601, + [Define to 0x0601 to access SetCurrentProcessExplicitAppUserModelID.]) + AC_MSG_RESULT([0x0601])]) ;; esac
--- a/libinterp/corefcn/sysdep.cc Sat Feb 06 09:27:26 2021 -0500 +++ b/libinterp/corefcn/sysdep.cc Sat Feb 06 11:14:13 2021 +0100 @@ -99,6 +99,7 @@ #include <tlhelp32.h> #include <psapi.h> #include <shellapi.h> +#include <shobjidl.h> #endif @@ -179,29 +180,11 @@ #endif - // Set app id if we have the SetCurrentProcessExplicitAppUserModelID - // available (>= Win7). FIXME: Could we check for existence of this - // function in the configure script instead of dynamically loading - // shell32.dll? - void set_application_id (void) { #if defined (__MINGW32__) || defined (_MSC_VER) - typedef HRESULT (WINAPI *SETCURRENTAPPID)(PCWSTR AppID); - - HMODULE hShell = LoadLibrary ("shell32.dll"); - - if (hShell) - { - SETCURRENTAPPID pfnSetCurrentProcessExplicitAppUserModelID - = reinterpret_cast<SETCURRENTAPPID> (GetProcAddress (hShell, "SetCurrentProcessExplicitAppUserModelID")); - - if (pfnSetCurrentProcessExplicitAppUserModelID) - pfnSetCurrentProcessExplicitAppUserModelID (L"gnu.octave." VERSION); - - FreeLibrary (hShell); - } + SetCurrentProcessExplicitAppUserModelID (L"gnu.octave." VERSION); #endif }
--- a/liboctave/system/oct-time.cc Sat Feb 06 09:27:26 2021 -0500 +++ b/liboctave/system/oct-time.cc Sat Feb 06 11:14:13 2021 +0100 @@ -246,29 +246,7 @@ #elif defined (OCTAVE_USE_WINDOWS_API) TIME_ZONE_INFORMATION tzi; - // GetTimeZoneInformationForYear is in Windows Vista SP1 or later - typedef BOOL (WINAPI *gtzify_type) (USHORT year, - PDYNAMIC_TIME_ZONE_INFORMATION pdtzi, - LPTIME_ZONE_INFORMATION ptzi); - HMODULE h_kernel32 = LoadLibrary ("kernel32.dll"); - - gtzify_type p_gtzify = nullptr; - if (h_kernel32) - { - p_gtzify = reinterpret_cast<gtzify_type> - (GetProcAddress (h_kernel32, - "GetTimeZoneInformationForYear")); - - if (p_gtzify) - p_gtzify (m_year, nullptr, &tzi); - - FreeLibrary (h_kernel32); - } - - // Fall back to GetTimeZoneInformation, which might be wrong if a time - // zone switched the GMT offset. - if (! p_gtzify) - GetTimeZoneInformation (&tzi); + GetTimeZoneInformationForYear (m_year, nullptr, &tzi); if (m_isdst) m_gmtoff = -60 * (tzi.Bias + tzi.DaylightBias);