diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-10-05 22:04:45 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-10-05 22:04:45 +0000 |
commit | 92abf1b6530484afb9c01f54c2d341a47cb8d386 (patch) | |
tree | e1c9f06cf08c8b56e202765474675eb3ec0074c2 /src/common/compat.c | |
parent | 1ebbaf5c3aa880d7ce2268c61e79bf0b52dd6a07 (diff) | |
download | tor-92abf1b6530484afb9c01f54c2d341a47cb8d386.tar.gz tor-92abf1b6530484afb9c01f54c2d341a47cb8d386.zip |
Make windows platform detection smarter. {Untested.}
svn:r5198
Diffstat (limited to 'src/common/compat.c')
-rw-r--r-- | src/common/compat.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/common/compat.c b/src/common/compat.c index 9a398fbf53..607f196682 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -693,12 +693,13 @@ get_uname(void) #endif { #ifdef MS_WINDOWS - OSVERSIONINFO info; + OSVERSIONINFOEX info; int i; const char *plat = NULL; static struct { int major; int minor; const char *version; } win_version_table[] = { + { 6, 0, "Windows \"Longhorn\"" }, { 5, 2, "Windows Server 2003" }, { 5, 1, "Windows XP" }, { 5, 0, "Windows 2000" }, @@ -726,10 +727,11 @@ get_uname(void) } } if (plat) { - strlcpy(uname_result, plat, sizeof(uname_result)); + tor_snprtint(uname_result, sizeof(uname_result), "%s %s", + plat, info.szCSDVersion); } else { - if (info.dwMajorVersion > 5 || - (info.dwMajorVersion==5 && info.dwMinorVersion>2)) + if (info.dwMajorVersion > 6 || + (info.dwMajorVersion==6 && info.dwMinorVersion>0)) tor_snprintf(uname_result, sizeof(uname_result), "Very recent version of Windows [major=%d,minor=%d]", (int)info.dwMajorVersion,(int)info.dwMinorVersion); @@ -738,6 +740,28 @@ get_uname(void) "Unrecognized version of Windows [major=%d,minor=%d]", (int)info.dwMajorVersion,(int)info.dwMinorVersion); } + if (info.dwProductType == VER_NT_DOMAIN_CONTROLLER) { + strlcat(uname_result, " [domain controller]", sizeof(uname_result)); + } else if (info.dwProductType == VER_NT_SERVER) { + strlcat(uname_result, " [server]", sizeof(uname_result)); + } else if (info.dwProductType == VER_NT_WORKSTATION) { + strlcat(uname_result, " [workstation]", sizeof(uname_result)); + } + if (info.dwSuiteMask & VER_SUITE_DATACENTER) { + strlcat(uname_result, " {datacenter}", sizeof(uname_result)); + } + if (info.dwSuiteMask & VER_SUITE_ENTERPRISE) { + strlcat(uname_result, " {enterprise}", sizeof(uname_result)); + } + if (info.dwSuiteMask & VER_SUITE_PERSONAL) { + strlcat(uname_result, " {personal}", sizeof(uname_result)); + } + if (info.dwSuiteMask & VER_SUITE_EMBEDDED) { + strlcat(uname_result, " {personal}", sizeof(uname_result)); + } + if (info.dwSuiteMask & VER_SUITE_PERSONAL) { + strlcat(uname_result, " {personal}", sizeof(uname_result)); + } #else strlcpy(uname_result, "Unknown platform", sizeof(uname_result)); #endif |