aboutsummaryrefslogtreecommitdiff
path: root/backends/taskbar
diff options
context:
space:
mode:
authorLittleboy2011-06-26 16:01:08 -0400
committerLittleboy2011-06-26 16:02:33 -0400
commit3931de4235fc1eb2993968c7880d473f4e2a6077 (patch)
tree5a77c6c79815db3d7f928f2dba8f1730b760206c /backends/taskbar
parent3f43619ea8b5b80b7211467ec27abc45de152ff2 (diff)
downloadscummvm-rg350-3931de4235fc1eb2993968c7880d473f4e2a6077.tar.gz
scummvm-rg350-3931de4235fc1eb2993968c7880d473f4e2a6077.tar.bz2
scummvm-rg350-3931de4235fc1eb2993968c7880d473f4e2a6077.zip
BACKENDS: Fix running on pre-Windows 2000 operating systems
The Windows taskbar manager uses VerSetConditionMask and VerifyVersionInfo to check for Windows 7 or later before enabling the taskbar integration features. Those functions did not appear until Windows 2000, so we have to check for them at runtime.
Diffstat (limited to 'backends/taskbar')
-rw-r--r--backends/taskbar/win32/win32-taskbar.cpp28
1 files changed, 25 insertions, 3 deletions
diff --git a/backends/taskbar/win32/win32-taskbar.cpp b/backends/taskbar/win32/win32-taskbar.cpp
index 7d063f49ba..d6be566263 100644
--- a/backends/taskbar/win32/win32-taskbar.cpp
+++ b/backends/taskbar/win32/win32-taskbar.cpp
@@ -232,6 +232,28 @@ Common::String Win32TaskbarManager::getIconPath(Common::String target) {
return "";
}
+// VerSetConditionMask and VerifyVersionInfo didn't appear until Windows 2000,
+// so we need to check for them at runtime
+LONGLONG VerSetConditionMaskFunc(ULONGLONG conditionMask, DWORD typeMask, BYTE condition) {
+ typedef BOOL (WINAPI *VerSetConditionMaskFunction)(ULONGLONG ConditionMask, DWORD TypeMask, BYTE Condition);
+
+ VerSetConditionMaskFunction verSetConditionMask = (VerSetConditionMaskFunction)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "VerSetConditionMask");
+ if (verSetConditionMask == NULL)
+ return 0;
+
+ return verSetConditionMask(conditionMask, typeMask, condition);
+}
+
+BOOL VerifyVersionInfoFunc(LPOSVERSIONINFOEXA lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask) {
+ typedef BOOL (WINAPI *VerifyVersionInfoFunction)(LPOSVERSIONINFOEXA lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
+
+ VerifyVersionInfoFunction verifyVersionInfo = (VerifyVersionInfoFunction)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "VerifyVersionInfoA");
+ if (verifyVersionInfo == NULL)
+ return FALSE;
+
+ return verifyVersionInfo(lpVersionInformation, dwTypeMask, dwlConditionMask);
+}
+
bool Win32TaskbarManager::isWin7OrLater() {
OSVERSIONINFOEX versionInfo;
DWORDLONG conditionMask = 0;
@@ -241,10 +263,10 @@ bool Win32TaskbarManager::isWin7OrLater() {
versionInfo.dwMajorVersion = 6;
versionInfo.dwMinorVersion = 1;
- VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
- VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
+ conditionMask = VerSetConditionMaskFunc(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
+ conditionMask = VerSetConditionMaskFunc(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
- return VerifyVersionInfo(&versionInfo, VER_MAJORVERSION | VER_MINORVERSION, conditionMask);
+ return VerifyVersionInfoFunc(&versionInfo, VER_MAJORVERSION | VER_MINORVERSION, conditionMask);
}
LPWSTR Win32TaskbarManager::ansiToUnicode(const char *s) {