From 26dcfcbd4470eef31f61b6a617f3386947c4fad6 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 12 Mar 2022 15:21:18 +0000 Subject: [PATCH] Make init_winver() idempotent. This way, anyone who needs to use the version data can quickly call init_winver to make sure it's been set up, and not waste too much faff redoing the actual work. --- windows/utils/version.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/windows/utils/version.c b/windows/utils/version.c index a53c2ad3..b626710e 100644 --- a/windows/utils/version.c +++ b/windows/utils/version.c @@ -4,6 +4,11 @@ DWORD osMajorVersion, osMinorVersion, osPlatformId; void init_winver(void) { + static bool initialised = false; + if (initialised) + return; + initialised = true; + OSVERSIONINFO osVersion; static HMODULE kernel32_module; DECL_WINDOWS_FUNCTION(static, BOOL, GetVersionExA, (LPOSVERSIONINFO));