diff options
author | Bill Meier <wmeier@newsguy.com> | 2009-09-16 23:13:34 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2009-09-16 23:13:34 +0000 |
commit | bfd830ace8409e999310a24a8ef3da78f11dc2e0 (patch) | |
tree | fdd33fa80897e5204b7614630a8cabfd69217a62 /version_info.c | |
parent | ccad8f74f5dd0952cff25d267cfcbb9f23d9f37c (diff) |
Add info as to 32/64 bit and also if "Windows 7" to runtime version info.
svn path=/trunk/; revision=29950
Diffstat (limited to 'version_info.c')
-rw-r--r-- | version_info.c | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/version_info.c b/version_info.c index ef7adda333..72283ec9f1 100644 --- a/version_info.c +++ b/version_info.c @@ -311,6 +311,7 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *)) { #if defined(_WIN32) OSVERSIONINFOEX info; + SYSTEM_INFO system_info; #elif defined(HAVE_SYS_UTSNAME_H) struct utsname name; #endif @@ -338,6 +339,8 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *)) * not even be able to compile code that *uses* that structure with * older versions of the SDK. */ + + memset(&info, '\0', sizeof info); info.dwOSVersionInfoSize = sizeof info; if (!GetVersionEx((OSVERSIONINFO *)&info)) { /* @@ -346,6 +349,10 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *)) g_string_append(str, "unknown Windows version"); return; } + + memset(&system_info, '\0', sizeof system_info); + GetSystemInfo(&system_info); /* only for W2K or greater .... (which is what we suuport) */ + switch (info.dwPlatformId) { case VER_PLATFORM_WIN32s: @@ -410,7 +417,14 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *)) break; case 2: - g_string_append_printf(str, "Windows Server 2003"); + if ((info.wProductType == VER_NT_WORKSTATION) && + (system_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)) { + g_string_append_printf(str, "Windows XP Professional x64 Edition"); + } else { + g_string_append_printf(str, "Windows Server 2003"); + if (system_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) + g_string_append_printf(str, " X64 Edition"); + } break; default: @@ -420,23 +434,38 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *)) } break; - case 6: + case 6: { + gboolean is_nt_workstation; + + if (system_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) + g_string_append(str, "64-bit "); + else if (system_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) + g_string_append(str, "32-bit "); #ifndef VER_NT_WORKSTATION #define VER_NT_WORKSTATION 0x01 - if ((info.wReserved[1] & 0xff) == VER_NT_WORKSTATION) + is_nt_workstation = ((info.wReserved[1] & 0xff) == VER_NT_WORKSTATION); #else - if (info.wProductType == VER_NT_WORKSTATION) + is_nt_workstation = (info.wProductType == VER_NT_WORKSTATION); #endif - g_string_append_printf(str, "Windows Vista"); - else - g_string_append_printf(str, "Windows Server 2008"); + switch (info.dwMinorVersion) { + case 0: + g_string_append_printf(str, is_nt_workstation ? "Windows Vista" : "Windows Server 2008"); + break; + case 1: + g_string_append_printf(str, is_nt_workstation ? "Windows 7" : "Windows Server 2008 R2"); + break; + default: + g_string_append_printf(str, "Windows NT, unknown version %lu.%lu", + info.dwMajorVersion, info.dwMinorVersion); + break; + } break; - + } /* case 6 */ default: g_string_append_printf(str, "Windows NT, unknown version %lu.%lu", info.dwMajorVersion, info.dwMinorVersion); break; - } + } /* info.dwMajorVersion */ break; default: |