diff --git a/include/wx/utils.h b/include/wx/utils.h index 48b8842924..eda281cb8d 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -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(); diff --git a/interface/wx/utils.h b/interface/wx/utils.h index f5a3b424c2..4b640351dc 100644 --- a/interface/wx/utils.h +++ b/interface/wx/utils.h @@ -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 diff --git a/src/common/platinfo.cpp b/src/common/platinfo.cpp index cd6f4862eb..f5a870f33b 100644 --- a/src/common/platinfo.cpp +++ b/src/common/platinfo.cpp @@ -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(), diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index 0210afbc86..95506b9097 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -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() diff --git a/src/osx/cocoa/utils_base.mm b/src/osx/cocoa/utils_base.mm index e02137935f..d1a660ab1b 100644 --- a/src/osx/cocoa/utils_base.mm +++ b/src/osx/cocoa/utils_base.mm @@ -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); } } diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index 88ae40c66a..fdaa04b17a 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -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__