diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-03-24 05:26:33 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-03-24 05:26:33 +0000 |
commit | 6d9632ba236340ca94c40b03233268e70c005f35 (patch) | |
tree | 4b80ae28bb821645c17b5df5de75d7b16bdc3b06 | |
parent | 444e3b8eb2b3f80f85b50de0db816a5204c7d33f (diff) | |
download | tor-6d9632ba236340ca94c40b03233268e70c005f35.tar.gz tor-6d9632ba236340ca94c40b03233268e70c005f35.zip |
Check return value from GetVersionEx (even though the MSDN example doesnt) and zero out the LPOSVERSIONINFOEX struct before getting the version. This may fix the "johnboy" [major=-858993460,minor=-858993460] problem.
svn:r6233
-rw-r--r-- | src/common/compat.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/common/compat.c b/src/common/compat.c index a0af0d97eb..0572ad265a 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -742,8 +742,15 @@ get_uname(void) { VER_SUITE_TERMINAL, " {terminal services}" }, { 0, NULL }, }; + memset(&info, 0, sizeof(info)); info.dwOSVersionInfoSize = sizeof(info); - GetVersionEx((LPOSVERSIONINFO)&info); + if (! GetVersionEx((LPOSVERSIONINFO)&info)) { + int err = GetLastError(); + strlcpy(uname_result, "Bizarre version of Windows where GetVersionEx" + " doesn't work.", sizeof(uname_result)); + uname_result_is_set = 1; + return uname_result; + } if (info.dwMajorVersion == 4 && info.dwMinorVersion == 0) { if (info.dwPlatformId == VER_PLATFORM_WIN32_NT) plat = "Windows NT 4.0"; |