#4978 Removed deprecated GetVersionEx call when checking Windows version

This commit is contained in:
Andrew Nelless 2016-06-24 13:30:44 +01:00 committed by Jerry (Xinyu Hou)
parent 74c48c6516
commit bc24568a6f
1 changed files with 4 additions and 8 deletions

View File

@ -35,6 +35,7 @@
#include <sstream> #include <sstream>
#include <iostream> #include <iostream>
#include <conio.h> #include <conio.h>
#include <VersionHelpers.h>
AppUtilWindows::AppUtilWindows(IEventQueue* events) : AppUtilWindows::AppUtilWindows(IEventQueue* events) :
m_events(events), m_events(events),
@ -133,14 +134,9 @@ AppUtilWindows::beforeAppExit()
int int
AppUtilWindows::run(int argc, char** argv) AppUtilWindows::run(int argc, char** argv)
{ {
OSVERSIONINFO osvi; if (!IsWindowsXPSP3OrGreater()) {
ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); throw std::runtime_error("Synergy only supports Windows XP SP3 and above.");
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); }
GetVersionEx(&osvi);
if (osvi.dwMajorVersion < 5 || (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion < 1)) {
throw std::runtime_error("synergy only supports windows xp and above.");
}
// record window instance for tray icon, etc // record window instance for tray icon, etc
ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));