diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-02-03 14:43:52 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-02-03 14:43:52 (GMT) |
commit | 009a17d3a03061610a2c281f18937e78e995855f (patch) | |
tree | 334a3a09b5c0f5e2577effe8b52dae682df62e2e /win | |
parent | 81e405a16c6eff768e23d1c43c292e4875b86a16 (diff) | |
download | tcl-009a17d3a03061610a2c281f18937e78e995855f.zip tcl-009a17d3a03061610a2c281f18937e78e995855f.tar.gz tcl-009a17d3a03061610a2c281f18937e78e995855f.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 81d762f..08ef1ed 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -563,7 +563,8 @@ TclpSetVariables( SYSTEM_INFO info; OemId oemId; } sys; - OSVERSIONINFOW osInfo; + static OSVERSIONINFOW osInfo; + static int osInfoInitialized = 0; Tcl_DString ds; WCHAR szUserName[UNLEN+1]; DWORD cchUserNameLen = UNLEN; @@ -571,9 +572,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); /* |