mirror of
https://github.com/moparisthebest/hexchat
synced 2024-11-22 09:12:22 -05:00
Replace deprecated GetVersionEx calls with version helpers
Only compiles with 8.1 SDK but runs everywhere Closes #957
This commit is contained in:
parent
5fee31b1f0
commit
b049757302
@ -33,6 +33,7 @@
|
|||||||
#include <sys/timeb.h>
|
#include <sys/timeb.h>
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
#include <VersionHelpers.h>
|
||||||
#include "../dirent/dirent-win32.h"
|
#include "../dirent/dirent-win32.h"
|
||||||
#include "../../config-win32.h"
|
#include "../../config-win32.h"
|
||||||
#else
|
#else
|
||||||
@ -689,74 +690,88 @@ get_sys_str (int with_cpu)
|
|||||||
{
|
{
|
||||||
static char verbuf[64];
|
static char verbuf[64];
|
||||||
static char winver[20];
|
static char winver[20];
|
||||||
OSVERSIONINFOEX osvi;
|
|
||||||
double mhz;
|
double mhz;
|
||||||
|
|
||||||
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
|
if (IsWindows8Point1OrGreater ())
|
||||||
GetVersionEx ((OSVERSIONINFO*) &osvi);
|
|
||||||
|
|
||||||
switch (osvi.dwMajorVersion)
|
|
||||||
{
|
{
|
||||||
case 5:
|
if (IsWindowsServer ())
|
||||||
switch (osvi.dwMinorVersion)
|
{
|
||||||
{
|
strcpy (winver, "Server 2012 R2");
|
||||||
case 1:
|
}
|
||||||
strcpy (winver, "XP");
|
else
|
||||||
break;
|
{
|
||||||
case 2:
|
strcpy (winver, "8.1");
|
||||||
if (osvi.wProductType == VER_NT_WORKSTATION)
|
}
|
||||||
{
|
}
|
||||||
strcpy (winver, "XP x64 Edition");
|
else if (IsWindows8OrGreater ())
|
||||||
}
|
{
|
||||||
else
|
if (IsWindowsServer ())
|
||||||
{
|
{
|
||||||
if (GetSystemMetrics(SM_SERVERR2) == 0)
|
strcpy (winver, "Server 2012");
|
||||||
{
|
}
|
||||||
strcpy (winver, "Server 2003");
|
else
|
||||||
}
|
{
|
||||||
else
|
strcpy (winver, "8");
|
||||||
{
|
}
|
||||||
strcpy (winver, "Server 2003 R2");
|
}
|
||||||
}
|
else if (IsWindows7SP1OrGreater ())
|
||||||
}
|
{
|
||||||
break;
|
if (IsWindowsServer ())
|
||||||
}
|
{
|
||||||
break;
|
strcpy (winver, "Server 2008 R2 SP1");
|
||||||
case 6:
|
}
|
||||||
switch (osvi.dwMinorVersion)
|
else
|
||||||
{
|
{
|
||||||
case 0:
|
strcpy (winver, "7 SP1");
|
||||||
if (osvi.wProductType == VER_NT_WORKSTATION)
|
}
|
||||||
{
|
}
|
||||||
strcpy (winver, "Vista");
|
else if (IsWindows7OrGreater ())
|
||||||
}
|
{
|
||||||
else
|
if (IsWindowsServer ())
|
||||||
{
|
{
|
||||||
strcpy (winver, "Server 2008");
|
strcpy (winver, "Server 2008 R2");
|
||||||
}
|
}
|
||||||
break;
|
else
|
||||||
case 1:
|
{
|
||||||
if (osvi.wProductType == VER_NT_WORKSTATION)
|
strcpy (winver, "7");
|
||||||
{
|
}
|
||||||
strcpy (winver, "7");
|
}
|
||||||
}
|
else if (IsWindowsVistaSP2OrGreater ())
|
||||||
else
|
{
|
||||||
{
|
if (IsWindowsServer ())
|
||||||
strcpy (winver, "Server 2008 R2");
|
{
|
||||||
}
|
strcpy (winver, "Server 2008 SP2");
|
||||||
break;
|
}
|
||||||
case 2:
|
else
|
||||||
if (osvi.wProductType == VER_NT_WORKSTATION)
|
{
|
||||||
{
|
strcpy (winver, "Vista SP2");
|
||||||
strcpy (winver, "8");
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (IsWindowsVistaSP1OrGreater ())
|
||||||
{
|
{
|
||||||
strcpy (winver, "Server 2012");
|
if (IsWindowsServer ())
|
||||||
}
|
{
|
||||||
break;
|
strcpy (winver, "Server 2008 SP1");
|
||||||
}
|
}
|
||||||
break;
|
else
|
||||||
|
{
|
||||||
|
strcpy (winver, "Vista SP1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (IsWindowsVistaOrGreater ())
|
||||||
|
{
|
||||||
|
if (IsWindowsServer ())
|
||||||
|
{
|
||||||
|
strcpy (winver, "Server 2008");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy (winver, "Vista");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy (winver, "Unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
mhz = get_mhz ();
|
mhz = get_mhz ();
|
||||||
|
Loading…
Reference in New Issue
Block a user