From 53b1b7efab971d9a18aa10339d7aa2d4607078c4 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 24 Nov 2009 04:29:36 +0000 Subject: [PATCH] - Added Windows 7 (aka Windows NT 6.1) and Server 2008 identification to I_DetectOS(). SVN r1996 (trunk) --- docs/rh-log.txt | 2 ++ src/win32/i_system.cpp | 38 ++++++++++++++++++++++++++++++++------ 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index acb6110e5..2db27819f 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ November 23, 2009 +- Added Windows 7 (aka Windows NT 6.1) and Server 2008 identification to + I_DetectOS(). - Fixed: ArtiPork did not use all its sprite frames. - Fixed: FWadCollection::AddFile() did not call FixPathSeperator(), so savegames would hold the full file path for wads that had been specified diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 1cbc957b6..d39cfc804 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -480,11 +480,16 @@ void I_WaitVBL(int count) void I_DetectOS(void) { - OSVERSIONINFO info; + OSVERSIONINFOEX info; const char *osname; - info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx (&info); + info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + if (!GetVersionEx((OSVERSIONINFO *)&info)) + { + // Retry with the older OSVERSIONINFO structure. + info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx((OSVERSIONINFO *)&info); + } switch (info.dwPlatformId) { @@ -522,9 +527,30 @@ void I_DetectOS(void) osname = "Server 2003"; } } - else if (info.dwMajorVersion == 6 && info.dwMinorVersion == 0) + else if (info.dwMajorVersion == 6) { - osname = "Vista"; + if (info.dwMinorVersion == 0) + { + if (info.wProductType == VER_NT_WORKSTATION) + { + osname = "Vista"; + } + else + { + osname = "Server 2008"; + } + } + else if (info.dwMinorVersion == 1) + { + if (info.wProductType == VER_NT_WORKSTATION) + { + osname = "7"; + } + else + { + osname = "Server 2008 R2"; + } + } } break; @@ -543,7 +569,7 @@ void I_DetectOS(void) } else { - Printf ("OS: Windows %s %lu.%lu (Build %lu)\n %s\n", + Printf ("OS: Windows %s (NT %lu.%lu) Build %lu\n %s\n", osname, info.dwMajorVersion, info.dwMinorVersion, info.dwBuildNumber, info.szCSDVersion);