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 | 4e8387e36afcce8b72317ca6a12f51279710b112 (patch) | |
| tree | 213a2a3e79bf54d41bde70440963e50f8fc5caea /unix | |
| parent | 16ae2d2ae8affc4a280a9bd279de9e55b73189da (diff) | |
| parent | ad8e3dcb0a669b4839694cfd4a24b61d31122e41 (diff) | |
| download | tcl-4e8387e36afcce8b72317ca6a12f51279710b112.zip tcl-4e8387e36afcce8b72317ca6a12f51279710b112.tar.gz tcl-4e8387e36afcce8b72317ca6a12f51279710b112.tar.bz2 | |
merge trunk
Diffstat (limited to 'unix')
| -rw-r--r-- | unix/tclUnixInit.c | 27 |
1 files changed, 21 insertions, 6 deletions
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) { |
