mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 14:39:24 -05:00
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.
This commit is contained in:
parent
5de1df1b94
commit
26dcfcbd44
@ -4,6 +4,11 @@ DWORD osMajorVersion, osMinorVersion, osPlatformId;
|
|||||||
|
|
||||||
void init_winver(void)
|
void init_winver(void)
|
||||||
{
|
{
|
||||||
|
static bool initialised = false;
|
||||||
|
if (initialised)
|
||||||
|
return;
|
||||||
|
initialised = true;
|
||||||
|
|
||||||
OSVERSIONINFO osVersion;
|
OSVERSIONINFO osVersion;
|
||||||
static HMODULE kernel32_module;
|
static HMODULE kernel32_module;
|
||||||
DECL_WINDOWS_FUNCTION(static, BOOL, GetVersionExA, (LPOSVERSIONINFO));
|
DECL_WINDOWS_FUNCTION(static, BOOL, GetVersionExA, (LPOSVERSIONINFO));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user