From 9ff8308a3554cae7300f400ce87c113580fd402d Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 19 Dec 2007 01:03:51 +0000 Subject: [PATCH] Change sys_info to distinguish between Vista and 2008 server --- src/os/win32/win32_sigar.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/os/win32/win32_sigar.c b/src/os/win32/win32_sigar.c index e9ab43cf..5d903e41 100644 --- a/src/os/win32/win32_sigar.c +++ b/src/os/win32/win32_sigar.c @@ -3218,14 +3218,25 @@ int sigar_who_list_get_win32(sigar_t *sigar, return SIGAR_OK; } +/* see: http://msdn2.microsoft.com/en-us/library/ms724833.aspx */ +#ifndef VER_NT_WORKSTATION +#define VER_NT_WORKSTATION 0x0000001 +#endif + +#if _MSC_VER <= 1200 +#define sigar_wProductType wReserved[1] +#else +#define sigar_wProductType wProductType +#endif + int sigar_os_sys_info_get(sigar_t *sigar, sigar_sys_info_t *sysinfo) { - OSVERSIONINFO version; + OSVERSIONINFOEX version; char *vendor_name, *vendor_version, *code_name=NULL; version.dwOSVersionInfoSize = sizeof(version); - GetVersionEx(&version); + GetVersionEx((OSVERSIONINFO *)&version); if (version.dwMajorVersion == 4) { vendor_name = "Windows NT"; @@ -3253,11 +3264,14 @@ int sigar_os_sys_info_get(sigar_t *sigar, } } else if (version.dwMajorVersion == 6) { - switch (version.dwMinorVersion) { - default: + if (version.sigar_wProductType == VER_NT_WORKSTATION) { vendor_name = "Windows Vista"; vendor_version = "Vista"; - break; + } + else { + vendor_name = "Windows 2008"; + vendor_version = "2008"; + code_name = "Longhorn Server"; } }