Detect Windows 8 and detect if Windows 8 is running in "compatibility mode" for Windows 7.
This commit is contained in:
parent
d2d9a60b13
commit
c41c904ffa
@ -30,7 +30,7 @@
|
||||
#define VER_LAMEXP_MINOR_LO 4
|
||||
#define VER_LAMEXP_TYPE RC
|
||||
#define VER_LAMEXP_PATCH 1
|
||||
#define VER_LAMEXP_BUILD 972
|
||||
#define VER_LAMEXP_BUILD 974
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Tool versions (minimum expected versions!)
|
||||
|
@ -359,7 +359,7 @@ bool ProcessingDialog::winEvent(MSG *message, long *result)
|
||||
|
||||
void ProcessingDialog::initEncoding(void)
|
||||
{
|
||||
qWarning("ProcessingDialog::initEncoding()");
|
||||
qDebug("Initializing encoding process...");
|
||||
|
||||
m_runningThreads = 0;
|
||||
m_currentFile = 0;
|
||||
|
@ -361,7 +361,13 @@ DWORD lamexp_get_os_version(void)
|
||||
{
|
||||
throw "Ouuups: Not running under Windows NT. This is not supposed to happen!";
|
||||
}
|
||||
osVersion = (DWORD)((osVerInfo.dwMajorVersion << 16) | (osVerInfo.dwMinorVersion & 0xffff));
|
||||
const DWORD osVerHi = (DWORD)(((DWORD)(osVerInfo.dwMajorVersion)) << 16);
|
||||
const DWORD osVerLo = (DWORD)(((DWORD)(osVerInfo.dwMinorVersion)) & ((DWORD)(0xffff)));
|
||||
osVersion = (DWORD)(((DWORD)(osVerHi)) | ((DWORD)(osVerLo)));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw "GetVersionEx() has failed. This is not supposed to happen!";
|
||||
}
|
||||
}
|
||||
|
||||
@ -792,7 +798,7 @@ static bool lamexp_check_compatibility_mode(const char *exportName, const char *
|
||||
{
|
||||
QLibrary kernel32("kernel32.dll");
|
||||
|
||||
if(exportName != NULL)
|
||||
if((exportName != NULL) && kernel32.load())
|
||||
{
|
||||
if(kernel32.resolve(exportName) != NULL)
|
||||
{
|
||||
@ -1078,12 +1084,20 @@ bool lamexp_init_qt(int argc, char* argv[])
|
||||
break;
|
||||
case QSysInfo::WV_WINDOWS7:
|
||||
qDebug("Running on Windows 7 or Windows Server 2008 R2.\n");
|
||||
lamexp_check_compatibility_mode(NULL, executableName);
|
||||
lamexp_check_compatibility_mode("CreateFile2", executableName);
|
||||
break;
|
||||
default:
|
||||
{
|
||||
DWORD osVersionNo = lamexp_get_os_version();
|
||||
qWarning("Running on an unknown/untested WinNT-based OS (v%u.%u).\n", HIWORD(osVersionNo), LOWORD(osVersionNo));
|
||||
if(LAMEXP_EQL_OS_VER(osVersionNo, 6, 2))
|
||||
{
|
||||
qDebug("Running on Windows 8 (still experimental!)\n");
|
||||
lamexp_check_compatibility_mode(NULL, executableName);
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning("Running on an unknown/untested WinNT-based OS (v%u.%u).\n", HIWORD(osVersionNo), LOWORD(osVersionNo));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -156,6 +156,8 @@ SIZE_T lamexp_dbg_private_bytes(void);
|
||||
#define LAMEXP_SAFE_FREE(PTR) if(PTR) { free((void*) PTR); PTR = NULL; }
|
||||
#define LAMEXP_CLOSE(HANDLE) if(HANDLE != NULL && HANDLE != INVALID_HANDLE_VALUE) { CloseHandle(HANDLE); HANDLE = NULL; }
|
||||
#define LAMEXP_MIN_OS_VER(VER_INFO, VER_MAJ, VER_MIN) ((HIWORD(VER_INFO) > (VER_MAJ)) || ((HIWORD(VER_INFO) == (VER_MAJ)) && (LOWORD(VER_INFO) >= (VER_MIN))))
|
||||
#define LAMEXP_MAX_OS_VER(VER_INFO, VER_MAJ, VER_MIN) ((HIWORD(VER_INFO) < (VER_MAJ)) || ((HIWORD(VER_INFO) == (VER_MAJ)) && (LOWORD(VER_INFO) <= (VER_MIN))))
|
||||
#define LAMEXP_EQL_OS_VER(VER_INFO, VER_MAJ, VER_MIN) ((HIWORD(VER_INFO) == (VER_MAJ)) && (LOWORD(VER_INFO) == (VER_MIN)))
|
||||
#define QWCHAR(STR) reinterpret_cast<const wchar_t*>(STR.utf16())
|
||||
#define WCHAR2QSTR(STR) QString::fromUtf16(reinterpret_cast<const unsigned short*>(STR))
|
||||
#define LAMEXP_DYNCAST(OUT,CLASS,SRC) try { OUT = dynamic_cast<CLASS>(SRC); } catch(std::bad_cast) { OUT = NULL; }
|
||||
|
Loading…
Reference in New Issue
Block a user