diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-02-03 15:29:09 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-02-03 15:29:09 (GMT) |
commit | b7a436af60e61f81ec9e5d31278eb6a5ab9ac0cd (patch) | |
tree | 213a2a3e79bf54d41bde70440963e50f8fc5caea | |
parent | 5b741f3b8fcdc21ce6f1d0410bf7308c5207ada2 (diff) | |
parent | 9acd6848382529da76b66a3108c7cceb755dcffa (diff) | |
download | tcl-b7a436af60e61f81ec9e5d31278eb6a5ab9ac0cd.zip tcl-b7a436af60e61f81ec9e5d31278eb6a5ab9ac0cd.tar.gz tcl-b7a436af60e61f81ec9e5d31278eb6a5ab9ac0cd.tar.bz2 |
merge trunk
-rw-r--r-- | generic/tclExecute.c | 2 | ||||
-rw-r--r-- | unix/tclUnixInit.c | 27 | ||||
-rw-r--r-- | win/tclWinInit.c | 18 |
3 files changed, 36 insertions, 11 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 98dc522..ec55e9a 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5835,7 +5835,7 @@ TEBCresume( if (GetNumberFromObj(NULL, OBJ_AT_TOS, &ptr1, &type1) != TCL_OK) { type1 = 0; } - TclNewIntObj(objResultPtr, type1); + TclNewLongObj(objResultPtr, type1); TRACE(("\"%.20s\" => %d\n", O2S(OBJ_AT_TOS), type1)); NEXT_INST_F(1, 1, 1); diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 39be160..9f860b0 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -33,7 +33,10 @@ #endif #ifdef __CYGWIN__ -DLLIMPORT extern __stdcall unsigned char GetVersionExA(void *); +DLLIMPORT extern __stdcall unsigned char GetVersionExW(void *); +DLLIMPORT extern __stdcall void *LoadLibraryW(const void *); +DLLIMPORT extern __stdcall void FreeLibrary(void *); +DLLIMPORT extern __stdcall void *GetProcAddress(void *, const char *); DLLIMPORT extern __stdcall void GetSystemInfo(void *); #define NUMPLATFORMS 4 @@ -72,8 +75,8 @@ typedef struct { DWORD dwMinorVersion; DWORD dwBuildNumber; DWORD dwPlatformId; - char szCSDVersion[128]; -} OSVERSIONINFOA; + wchar_t szCSDVersion[128]; +} OSVERSIONINFOW; #endif #ifdef HAVE_COREFOUNDATION @@ -747,7 +750,8 @@ TclpSetVariables( { #ifdef __CYGWIN__ SYSTEM_INFO sysInfo; - OSVERSIONINFOA osInfo; + static OSVERSIONINFOW osInfo; + static int osInfoInitialized = 0; char buffer[TCL_INTEGER_SPACE * 2]; #elif !defined(NO_UNAME) struct utsname name; @@ -860,8 +864,19 @@ TclpSetVariables( unameOK = 0; #ifdef __CYGWIN__ unameOK = 1; - osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA); - GetVersionExA(&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(&sysInfo); if (osInfo.dwPlatformId < NUMPLATFORMS) { 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); /* |