OSDN Git Service

Try to detect "compatibility mode".
authorlordmulder <mulder2@gmx.de>
Thu, 23 Dec 2010 02:13:11 +0000 (03:13 +0100)
committerlordmulder <mulder2@gmx.de>
Thu, 23 Dec 2010 02:13:11 +0000 (03:13 +0100)
LameXP.vcproj
gui/DropBox.ui
src/Config.h
src/Global.cpp
src/Targetver.h

index 8ae4fd5..329963f 100644 (file)
@@ -45,7 +45,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="0"
                                AdditionalIncludeDirectories="&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;"
-                               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"
                                FavorSizeOrSpeed="1"
                                OmitFramePointers="true"
                                AdditionalIncludeDirectories="&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;"
-                               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"
                                OmitFramePointers="true"
                                WholeProgramOptimization="true"
                                AdditionalIncludeDirectories="&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;"
-                               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"
                                        <Tool
                                                Name="VCCustomBuildTool"
                                                Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
-                                               CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;"
+                                               CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
                                                Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
                                        />
                                </FileConfiguration>
                                        <Tool
                                                Name="VCCustomBuildTool"
                                                Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
-                                               CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;"
+                                               CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
                                                Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
                                        />
                                </FileConfiguration>
                                        <Tool
                                                Name="VCCustomBuildTool"
                                                Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
-                                               CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;"
+                                               CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
                                                Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
                                        />
                                </FileConfiguration>
                                        <Tool
                                                Name="VCCustomBuildTool"
                                                Description="UIC &quot;$(SolutionDir)tmp\UIC_$(SafeInputName).h&quot;"
-                                               CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;$(SolutionDir)tmp\UIC_$(SafeInputName).h&quot; &quot;$(InputPath)&quot;"
+                                               CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;$(SolutionDir)tmp\UIC_$(SafeInputName).h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
                                                Outputs="&quot;$(SolutionDir)tmp\UIC_$(SafeInputName).h&quot;"
                                        />
                                </FileConfiguration>
                                        <Tool
                                                Name="VCCustomBuildTool"
                                                Description="UIC &quot;$(SolutionDir)tmp\UIC_$(SafeInputName).h&quot;"
-                                               CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;$(SolutionDir)tmp\UIC_$(SafeInputName).h&quot; &quot;$(InputPath)&quot;"
+                                               CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;$(SolutionDir)tmp\UIC_$(SafeInputName).h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
                                                Outputs="&quot;$(SolutionDir)tmp\UIC_$(SafeInputName).h&quot;"
                                        />
                                </FileConfiguration>
                                        <Tool
                                                Name="VCCustomBuildTool"
                                                Description="UIC &quot;$(SolutionDir)tmp\UIC_$(SafeInputName).h&quot;"
-                                               CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;$(SolutionDir)tmp\UIC_$(SafeInputName).h&quot; &quot;$(InputPath)&quot;"
+                                               CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;$(SolutionDir)tmp\UIC_$(SafeInputName).h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
                                                Outputs="&quot;$(SolutionDir)tmp\UIC_$(SafeInputName).h&quot;"
                                        />
                                </FileConfiguration>
index 3508513..c828b1f 100644 (file)
@@ -26,7 +26,7 @@
      <item row="0" column="1">
       <widget class="QLabel" name="dropBoxLabel">
        <property name="toolTip">
-        <string>&lt;b&gt;LameXP DropBox&lt;/b&gt;&lt;br&gt;&lt;nobr&gt;You can add files to LameXP via Drag&amp;amp;Drop here!&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;(Right-click to close to DropBox)&lt;/nobr&gt;</string>
+        <string>&lt;b&gt;LameXP DropBox&lt;/b&gt;&lt;br&gt;&lt;nobr&gt;You can add files to LameXP via Drag&amp;amp;Drop here!&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;(Right-click to close the DropBox)&lt;/nobr&gt;</string>
        </property>
        <property name="lineWidth">
         <number>0</number>
@@ -53,6 +53,7 @@
   <include location="../res/Images.qrc"/>
   <include location="../res/Images.qrc"/>
   <include location="../res/Images.qrc"/>
+  <include location="../res/Images.qrc"/>
  </resources>
  <connections/>
 </ui>
index 889d9cf..db20f26 100644 (file)
@@ -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
 
 /*
index 1438ff1..327f571 100644 (file)
@@ -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");
index b000332..6005fd4 100644 (file)
@@ -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