Allow identification of Windows Vista/Windows 7 in logfiles (as opposed to "unknown NT-based").

This commit is contained in:
AJ Kelly
2010-06-05 15:52:12 -05:00
parent 25193851b6
commit 5be876fd34
+35 -5
View File
@@ -72,10 +72,10 @@ static RString wo_ssprintf( MMRESULT err, const char *fmt, ...)
char buf[MAXERRORLENGTH]; char buf[MAXERRORLENGTH];
waveOutGetErrorText(err, buf, MAXERRORLENGTH); waveOutGetErrorText(err, buf, MAXERRORLENGTH);
va_list va; va_list va;
va_start(va, fmt); va_start(va, fmt);
RString s = vssprintf( fmt, va ); RString s = vssprintf( fmt, va );
va_end(va); va_end(va);
return s += ssprintf( "(%s)", buf ); return s += ssprintf( "(%s)", buf );
} }
@@ -191,7 +191,7 @@ static void GetDriveDebugInfo()
static void GetWindowsVersionDebugInfo() static void GetWindowsVersionDebugInfo()
{ {
/* Detect operating system. */ // Detect operating system.
OSVERSIONINFO ovi; OSVERSIONINFO ovi;
ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (!GetVersionEx(&ovi)) if (!GetVersionEx(&ovi))
@@ -200,6 +200,7 @@ static void GetWindowsVersionDebugInfo()
return; return;
} }
RString Ver = ssprintf("Windows %i.%i (", ovi.dwMajorVersion, ovi.dwMinorVersion); RString Ver = ssprintf("Windows %i.%i (", ovi.dwMajorVersion, ovi.dwMinorVersion);
if(ovi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) if(ovi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
{ {
@@ -220,6 +221,35 @@ static void GetWindowsVersionDebugInfo()
Ver += "Win2000"; Ver += "Win2000";
else if(ovi.dwMajorVersion == 5 && ovi.dwMinorVersion == 1) else if(ovi.dwMajorVersion == 5 && ovi.dwMinorVersion == 1)
Ver += "WinXP"; Ver += "WinXP";
else if(ovi.dwMajorVersion == 5 && ovi.dwMinorVersion == 2)
{
Ver += "WinServer2003";
// todo: check for R2
/*
if(GetSystemMetrics(SM_SERVERR2) != 0)
Ver += "R2";
*/
}
else if(ovi.dwMajorVersion == 6 && ovi.dwMinorVersion == 0)
{
Ver += "Vista";
// todo: make this check work
/*
if(ovi.wProductType == VER_NT_WORKSTATION)
Ver += "Vista";
else
Ver += "WinServer2008";
*/
}
else if(ovi.dwMajorVersion == 6 && ovi.dwMinorVersion == 1)
Ver += "Win7";
// todo: make this check work
/*
if(ovi.wProductType == VER_NT_WORKSTATION)
Ver += "Win7";
else
Ver += "WinServer2008 R2";
*/
else else
Ver += "unknown NT-based"; Ver += "unknown NT-based";
} else Ver += "???"; } else Ver += "???";