Fix os_compare_version a bit

This commit is contained in:
def 2015-04-18 16:23:43 +02:00
parent 1299ecb7f9
commit aead2631b6
2 changed files with 3 additions and 7 deletions

View file

@ -2371,16 +2371,12 @@ int os_compare_version(int major, int minor)
mem_zero(&ver, sizeof(OSVERSIONINFO)); mem_zero(&ver, sizeof(OSVERSIONINFO));
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&ver); GetVersionEx(&ver);
if(ver.dwMajorVersion > major && ver.dwMinorVersion > minor) if(ver.dwMajorVersion > major || (ver.dwMajorVersion == major && ver.dwMinorVersion > minor))
return 1; return 1;
else if(ver.dwMajorVersion == major && ver.dwMinorVersion == minor) else if(ver.dwMajorVersion == major && ver.dwMinorVersion == minor)
return 0; return 0;
else if(ver.dwMajorVersion < major && ver.dwMinorVersion < minor)
return -1;
else else
return -2; return -1;
#else
#error not implemented
#endif #endif
} }

View file

@ -25,7 +25,7 @@ void CAutoUpdate::Init()
m_pClient = Kernel()->RequestInterface<IClient>(); m_pClient = Kernel()->RequestInterface<IClient>();
m_pStorage = Kernel()->RequestInterface<IStorage>(); m_pStorage = Kernel()->RequestInterface<IStorage>();
m_pFetcher = Kernel()->RequestInterface<IFetcher>(); m_pFetcher = Kernel()->RequestInterface<IFetcher>();
m_IsWinXP = (os_compare_version(5, 0) == 1 && os_compare_version(6, 0) == -1); m_IsWinXP = os_compare_version(5, 1) <= 0;
} }
void CAutoUpdate::ProgressCallback(CFetchTask *pTask, void *pUser) void CAutoUpdate::ProgressCallback(CFetchTask *pTask, void *pUser)