Add micro version to wxCheckOsVersion().
This commit is contained in:
parent
84fbc12f2d
commit
3bdb4c4b21
@ -145,7 +145,7 @@ WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *verMaj = NULL,
|
||||
int *verMicro = NULL);
|
||||
|
||||
// Check is OS version is at least the specified major and minor version
|
||||
WXDLLIMPEXP_BASE bool wxCheckOsVersion(int majorVsn, int minorVsn = 0);
|
||||
WXDLLIMPEXP_BASE bool wxCheckOsVersion(int majorVsn, int minorVsn = 0, int microVsn = 0);
|
||||
|
||||
// Get platform endianness
|
||||
WXDLLIMPEXP_BASE bool wxIsPlatformLittleEndian();
|
||||
|
@ -897,7 +897,7 @@ wxOperatingSystemId wxGetOsVersion(int* major = NULL, int* minor = NULL, int* mi
|
||||
|
||||
@header{wx/utils.h}
|
||||
*/
|
||||
bool wxCheckOsVersion(int majorVsn, int minorVsn = 0);
|
||||
bool wxCheckOsVersion(int majorVsn, int minorVsn = 0, int microVsn = 0);
|
||||
|
||||
/**
|
||||
Returns @true if the operating system the program is running under is 64
|
||||
|
@ -309,7 +309,7 @@ bool wxPlatformInfo::CheckOSVersion(int major, int minor, int micro) const
|
||||
// this check gets forwarded to the wxCheckOsVersion which might do more than a simple
|
||||
// number check if supported by the platform
|
||||
if (m_initializedForCurrentPlatform)
|
||||
return wxCheckOsVersion(major, minor);
|
||||
return wxCheckOsVersion(major, minor, micro);
|
||||
else
|
||||
return DoCheckVersion(GetOSMajorVersion(),
|
||||
GetOSMinorVersion(),
|
||||
|
@ -1281,22 +1281,26 @@ wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin, int *verMicro)
|
||||
return s_version.os;
|
||||
}
|
||||
|
||||
bool wxCheckOsVersion(int majorVsn, int minorVsn)
|
||||
bool wxCheckOsVersion(int majorVsn, int minorVsn, int microVsn)
|
||||
{
|
||||
OSVERSIONINFOEX osvi;
|
||||
wxZeroMemory(osvi);
|
||||
osvi.dwOSVersionInfoSize = sizeof(osvi);
|
||||
|
||||
DWORDLONG const dwlConditionMask =
|
||||
::VerSetConditionMask(
|
||||
::VerSetConditionMask(
|
||||
::VerSetConditionMask(
|
||||
0, VER_MAJORVERSION, VER_GREATER_EQUAL),
|
||||
VER_MINORVERSION, VER_GREATER_EQUAL);
|
||||
VER_MINORVERSION, VER_GREATER_EQUAL),
|
||||
VER_BUILDNUMBER, VER_GREATER_EQUAL);
|
||||
|
||||
osvi.dwMajorVersion = majorVsn;
|
||||
osvi.dwMinorVersion = minorVsn;
|
||||
osvi.dwBuildNumber = microVsn;
|
||||
|
||||
return ::VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION, dwlConditionMask) != FALSE;
|
||||
return ::VerifyVersionInfo(&osvi,
|
||||
VER_MAJORVERSION | VER_MINORVERSION | VER_BUILDNUMBER, dwlConditionMask) != FALSE;
|
||||
}
|
||||
|
||||
wxWinVersion wxGetWinVersion()
|
||||
|
@ -75,7 +75,7 @@ wxGCC_WARNING_RESTORE()
|
||||
return wxOS_MAC_OSX_DARWIN;
|
||||
}
|
||||
|
||||
bool wxCheckOsVersion(int majorVsn, int minorVsn)
|
||||
bool wxCheckOsVersion(int majorVsn, int minorVsn, int microVsn)
|
||||
{
|
||||
#ifdef wxHAS_NSPROCESSINFO
|
||||
if ([NSProcessInfo instancesRespondToSelector:@selector(isOperatingSystemAtLeastVersion:)])
|
||||
@ -83,17 +83,19 @@ bool wxCheckOsVersion(int majorVsn, int minorVsn)
|
||||
NSOperatingSystemVersion osVer;
|
||||
osVer.majorVersion = majorVsn;
|
||||
osVer.minorVersion = minorVsn;
|
||||
osVer.patchVersion = 0;
|
||||
osVer.patchVersion = microVsn;
|
||||
|
||||
return [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:osVer] != NO;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
int majorCur, minorCur;
|
||||
wxGetOsVersion(&majorCur, &minorCur);
|
||||
int majorCur, minorCur, microCur;
|
||||
wxGetOsVersion(&majorCur, &minorCur, µCur);
|
||||
|
||||
return majorCur > majorVsn || (majorCur == majorVsn && minorCur >= minorVsn);
|
||||
return majorCur > majorVsn
|
||||
|| (majorCur == majorVsn && minorCur >= minorVsn)
|
||||
|| (majorCur == majorVsn && minorCur == minorVsn && microCur >= microVsn);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1155,12 +1155,14 @@ wxString wxGetOsDescription()
|
||||
return wxGetCommandOutput(wxT("uname -s -r -m"));
|
||||
}
|
||||
|
||||
bool wxCheckOsVersion(int majorVsn, int minorVsn)
|
||||
bool wxCheckOsVersion(int majorVsn, int minorVsn, int microVsn)
|
||||
{
|
||||
int majorCur, minorCur;
|
||||
wxGetOsVersion(&majorCur, &minorCur);
|
||||
int majorCur, minorCur, microCur;
|
||||
wxGetOsVersion(&majorCur, &minorCur, µCur);
|
||||
|
||||
return majorCur > majorVsn || (majorCur == majorVsn && minorCur >= minorVsn);
|
||||
return majorCur > majorVsn
|
||||
|| (majorCur == majorVsn && minorCur >= minorVsn)
|
||||
|| (majorCur == majorVsn && minorCur == minorVsn && microCur >= microVsn);
|
||||
}
|
||||
|
||||
#endif // !__DARWIN__
|
||||
|
Loading…
Reference in New Issue
Block a user