Add wxCheckOsVersion() to implement platform based OS version checks.

Windows implements VerifyVersionInfo api since Win2k. Starting with Windows 8.1 GetVersionEx is deprecated and may not return the expected version number if the application does not contain the correct compatibility information in its manifest. VerifyVersionInfo works independent of manifest in the executable (and is the recommend way to check).

Existing code may already use wxPlatformInfo::CheckOSVersion() so the method forwards the call to wxCheckOsVersion if initialized for the current system.
This commit is contained in:
Tobias Taschner
2015-08-06 11:32:38 +02:00
parent d8e291c27a
commit 2b3633b3c0
6 changed files with 58 additions and 7 deletions

View File

@@ -1150,6 +1150,14 @@ wxString wxGetOsDescription()
#endif // !__DARWIN__
bool wxCheckOsVersion(int majorVsn, int minorVsn)
{
int majorCur, minorCur;
wxGetOsVersion(&majorCur, &minorCur);
return majorCur > majorVsn || (majorCur == majorVsn && minorCur >= minorVsn);
}
unsigned long wxGetProcessId()
{
return (unsigned long)getpid();