From: lordmulder Date: Thu, 23 Dec 2010 02:13:11 +0000 (+0100) Subject: Try to detect "compatibility mode". X-Git-Tag: Release_400~128 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=29954feae2c3d6c1dbcb38cb53f5142048b5ff38;p=lamexp%2FLameXP.git Try to detect "compatibility mode". --- diff --git a/LameXP.vcproj b/LameXP.vcproj index 8ae4fd54..329963f9 100644 --- a/LameXP.vcproj +++ b/LameXP.vcproj @@ -45,7 +45,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""$(QTDIR)\include";"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui"" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;QT_LARGEFILE_SUPPORT;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_DEBUG" + PreprocessorDefinitions="WIN32;_DEBUG;_WIN32_WINNT 0x0500;_CONSOLE;QT_LARGEFILE_SUPPORT;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_DEBUG" MinimalRebuild="false" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -131,7 +131,7 @@ FavorSizeOrSpeed="1" OmitFramePointers="true" AdditionalIncludeDirectories=""$(QTDIR)\include";"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui"" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;QT_LARGEFILE_SUPPORT;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_NO_DEBUG" + PreprocessorDefinitions="WIN32;NDEBUG;_WIN32_WINNT 0x0500;_CONSOLE;QT_LARGEFILE_SUPPORT;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_NO_DEBUG" MinimalRebuild="false" BasicRuntimeChecks="0" RuntimeLibrary="2" @@ -223,7 +223,7 @@ OmitFramePointers="true" WholeProgramOptimization="true" AdditionalIncludeDirectories=""$(QTDIR)\include";"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui"" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;QT_LARGEFILE_SUPPORT;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_NO_DEBUG;QT_NODLL" + PreprocessorDefinitions="WIN32;NDEBUG;_WIN32_WINNT 0x0500;_CONSOLE;QT_LARGEFILE_SUPPORT;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_NO_DEBUG;QT_NODLL" MinimalRebuild="false" BasicRuntimeChecks="0" RuntimeLibrary="0" @@ -577,7 +577,7 @@ @@ -587,7 +587,7 @@ @@ -597,7 +597,7 @@ @@ -1715,7 +1715,7 @@ @@ -1725,7 +1725,7 @@ @@ -1735,7 +1735,7 @@ diff --git a/gui/DropBox.ui b/gui/DropBox.ui index 3508513e..c828b1f1 100644 --- a/gui/DropBox.ui +++ b/gui/DropBox.ui @@ -26,7 +26,7 @@ - <b>LameXP DropBox</b><br><nobr>You can add files to LameXP via Drag&amp;Drop here!</nobr><br><nobr>(Right-click to close to DropBox)</nobr> + <b>LameXP DropBox</b><br><nobr>You can add files to LameXP via Drag&amp;Drop here!</nobr><br><nobr>(Right-click to close the DropBox)</nobr> 0 @@ -53,6 +53,7 @@ + diff --git a/src/Config.h b/src/Config.h index 889d9cf9..db20f262 100644 --- a/src/Config.h +++ b/src/Config.h @@ -25,7 +25,7 @@ #define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_LO 0 -#define VER_LAMEXP_BUILD 182 +#define VER_LAMEXP_BUILD 183 #define VER_LAMEXP_SUFFIX TechPreview /* diff --git a/src/Global.cpp b/src/Global.cpp index 1438ff1d..327f571d 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -66,6 +66,8 @@ #define LAMEXP_INIT_QT_STATIC_PLUGIN(X) #endif +#define X ULONG_MAX + /////////////////////////////////////////////////////////////////////////////// // TYPES /////////////////////////////////////////////////////////////////////////////// @@ -78,6 +80,23 @@ typedef struct char parameter[4096]; } lamexp_ipc_t; +struct lamexp_oscomp_t +{ + DWORD verMajor; + DWORD verMinor; + char *pcExport; +}; + +static const struct lamexp_oscomp_t g_lamexp_oscomp[] = +{ + {4, X, "OpenThread"}, // Windows NT 4.0 + {5, 0, "GetNativeSystemInfo"}, // Windows 2000 + {5, 1, "GetLargePageMinimum"}, // Windows XP + {5, 2, "GetLocaleInfoEx"}, // Windows Server 2003 + {6, 0, "CreateRemoteThreadEx"}, // Windows Vista + {0, 0, NULL} // EOL +}; + /////////////////////////////////////////////////////////////////////////////// // GLOBAL VARS /////////////////////////////////////////////////////////////////////////////// @@ -390,6 +409,34 @@ void WINAPI debugThreadProc(__in LPVOID lpParameter) TerminateProcess(GetCurrentProcess(), -1); } +/* + * Check for compatibility mode + */ +static bool lamexp_check_compatibility_mode(void) +{ + QLibrary kernel32("kernel32.dll"); + + OSVERSIONINFOW versionInfo; + memset(&versionInfo, 0, sizeof(OSVERSIONINFOW)); + versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); + + if(GetVersionEx(&versionInfo)) + { + for(int i = 0; g_lamexp_oscomp[i].pcExport; i++) + { + if((g_lamexp_oscomp[i].verMajor == X || g_lamexp_oscomp[i].verMajor == versionInfo.dwMajorVersion) && (g_lamexp_oscomp[i].verMinor == X || g_lamexp_oscomp[i].verMinor == versionInfo.dwMinorVersion)) + { + if(kernel32.resolve(g_lamexp_oscomp[i].pcExport) != NULL) + { + qFatal("Windows NT %u.%u compatibility mode detected. Aborting!", versionInfo.dwMajorVersion, versionInfo.dwMinorVersion); + return false; + } + } + } + } + + return true; +} /* * Initialize Qt framework @@ -431,6 +478,9 @@ bool lamexp_init_qt(int argc, char* argv[]) break; } + //Check if "compatibility mode" is enabled + lamexp_check_compatibility_mode(); + //Create Qt application instance and setup version info QApplication *application = new QApplication(argc, argv); application->setApplicationName("LameXP - Audio Encoder Front-End"); diff --git a/src/Targetver.h b/src/Targetver.h index b000332f..6005fd4d 100644 --- a/src/Targetver.h +++ b/src/Targetver.h @@ -29,7 +29,7 @@ // Modify the following defines if you have to target a platform prior to the ones specified below. // Refer to MSDN for the latest info on corresponding values for different platforms. -#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows XP. -#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. +#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows 2000. +#define _WIN32_WINNT 0x0500 // Change this to the appropriate value to target other versions of Windows. #endif