summaryrefslogtreecommitdiffstats
path: root/win/tclWinInit.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-02-03 22:58:36 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-02-03 22:58:36 (GMT)
commitb952380a515955264c2a82e6ec784268a69b2042 (patch)
treea2879a7012f4634b3e2703b20fd9fbf53a074f48 /win/tclWinInit.c
parenta85ebc21de9b4010d0733a56197fecbb6f3d3a3b (diff)
parent009a17d3a03061610a2c281f18937e78e995855f (diff)
downloadtcl-b952380a515955264c2a82e6ec784268a69b2042.zip
tcl-b952380a515955264c2a82e6ec784268a69b2042.tar.gz
tcl-b952380a515955264c2a82e6ec784268a69b2042.tar.bz2
merge 8.5
Diffstat (limited to 'win/tclWinInit.c')
-rw-r--r--win/tclWinInit.c18
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);
/*