diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-02-03 15:19:26 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-02-03 15:19:26 (GMT) |
commit | 9acd6848382529da76b66a3108c7cceb755dcffa (patch) | |
tree | faa457ef4cf085f450f6a93aae34f7de4f828170 /win | |
parent | 6376a7f056624dfca2cce996a6ffc44cf931fe45 (diff) | |
parent | 009a17d3a03061610a2c281f18937e78e995855f (diff) | |
download | tcl-9acd6848382529da76b66a3108c7cceb755dcffa.zip tcl-9acd6848382529da76b66a3108c7cceb755dcffa.tar.gz tcl-9acd6848382529da76b66a3108c7cceb755dcffa.tar.bz2 |
Fix [651e828a52]: Wrong Windows version reported for Windows 8.1
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinInit.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 7b027c5..b3f8f41 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -530,7 +530,8 @@ TclpSetVariables( SYSTEM_INFO info; OemId oemId; } sys; - OSVERSIONINFOW osInfo; + static OSVERSIONINFOW osInfo; + static int osInfoInitialized = 0; Tcl_DString ds; TCHAR szUserName[UNLEN+1]; DWORD cchUserNameLen = UNLEN; @@ -538,9 +539,18 @@ TclpSetVariables( Tcl_SetVar2Ex(interp, "tclDefaultLibrary", NULL, TclGetProcessGlobalValue(&defaultLibraryDir), TCL_GLOBAL_ONLY); - osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); - GetVersionExW(&osInfo); - + if (!osInfoInitialized) { + HANDLE handle = LoadLibraryW(L"NTDLL"); + int(*getversion)(void *) = (int(*)(void *))GetProcAddress(handle, "RtlGetVersion"); + osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); + if (!getversion || getversion(&osInfo)) { + GetVersionExW(&osInfo); + } + if (handle) { + FreeLibrary(handle); + } + osInfoInitialized = 1; + } GetSystemInfo(&sys.info); /* |