show windoes 2012

This commit is contained in:
root 2013-08-12 09:34:24 +00:00
parent f15aa84dfe
commit 5a1d5e75f1
1 changed files with 21 additions and 6 deletions

View File

@ -3722,6 +3722,7 @@ int sigar_who_list_get_win32(sigar_t *sigar,
#define SIGAR_ARCH "x86" #define SIGAR_ARCH "x86"
#endif #endif
int sigar_os_sys_info_get(sigar_t *sigar, int sigar_os_sys_info_get(sigar_t *sigar,
sigar_sys_info_t *sysinfo) sigar_sys_info_t *sysinfo)
{ {
@ -3729,7 +3730,7 @@ int sigar_os_sys_info_get(sigar_t *sigar,
char *vendor_name, *vendor_version, *code_name=NULL; char *vendor_name, *vendor_version, *code_name=NULL;
version.dwOSVersionInfoSize = sizeof(version); version.dwOSVersionInfoSize = sizeof(version);
GetVersionEx((OSVERSIONINFO *)&version); GetVersionEx((OSVERSIONINFO *)&version);
if (version.dwMajorVersion == 4) { if (version.dwMajorVersion == 4) {
vendor_name = "Windows NT"; vendor_name = "Windows NT";
@ -3769,11 +3770,25 @@ int sigar_os_sys_info_get(sigar_t *sigar,
code_name = "Vienna"; code_name = "Vienna";
} }
} }
else { else {
vendor_name = "Windows 2008"; // not nt work station
vendor_version = "2008"; if (version.dwMinorVersion == 0 || version.dwMinorVersion ==1) {
code_name = "Longhorn Server"; vendor_name = "Windows 2008";
} vendor_version = "2008";
code_name = "Longhorn Server";
}
else if (version.dwMinorVersion == 2) {
vendor_name = "Windows 2012";
vendor_version = "2012";
code_name = "Windows Server 8";
}
else {
// defaults
vendor_name = "Windows Unknown";
vendor_version = "2012";
}
}
} }
SIGAR_SSTRCPY(sysinfo->name, "Win32"); SIGAR_SSTRCPY(sysinfo->name, "Win32");