Added compatibility manifest file. This allows for detection Windows 8.1 correctly via GetVersionEx(), though GetVersionEx() will still be broken for *future* Windows versions.

This commit is contained in:
LoRd_MuldeR 2013-10-21 15:00:03 +02:00
parent 2e1973445c
commit b3046a46a7
4 changed files with 64 additions and 28 deletions

View File

@ -110,6 +110,11 @@ copy /Y "$(SolutionDir)\etc\Prerequisites\VisualLeakDetector\bin\Win32\*.manifes
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>_CONFIG_NAME=$(ConfigurationName);%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CONFIG_NAME=$(ConfigurationName);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile> </ResourceCompile>
<Manifest>
<AdditionalOptions>
</AdditionalOptions>
<EnableDpiAwareness>true</EnableDpiAwareness>
</Manifest>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent> <PreBuildEvent>
@ -184,6 +189,11 @@ del "$(TargetDir)imageformats\q???d4.dll"
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>_CONFIG_NAME=$(ConfigurationName);%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CONFIG_NAME=$(ConfigurationName);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile> </ResourceCompile>
<Manifest>
<EnableDpiAwareness>true</EnableDpiAwareness>
<AdditionalOptions>
</AdditionalOptions>
</Manifest>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">
<PreBuildEvent> <PreBuildEvent>
@ -253,7 +263,9 @@ del "$(TargetDir)imageformats\q???d4.dll"
<AdditionalOptions>/wd4005 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/wd4005 %(AdditionalOptions)</AdditionalOptions>
</ResourceCompile> </ResourceCompile>
<Manifest> <Manifest>
<AdditionalOptions>/wd4005 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>
</AdditionalOptions>
<EnableDpiAwareness>true</EnableDpiAwareness>
</Manifest> </Manifest>
<Xdcmake> <Xdcmake>
<AdditionalOptions>/wd4005 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/wd4005 %(AdditionalOptions)</AdditionalOptions>
@ -1299,6 +1311,9 @@ del "$(TargetDir)imageformats\q???d4.dll"
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CONFIG_NAME=$(ConfigurationName);%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CONFIG_NAME=$(ConfigurationName);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile> </ResourceCompile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Manifest Include="etc\Manifest\Compatibility.manifest" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" /> <ImportGroup Label="ExtensionTargets" />
</Project> </Project>

View File

@ -535,9 +535,6 @@
<Filter>Header Files\Misc\3rd Party</Filter> <Filter>Header Files\Misc\3rd Party</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="LameXP.rc" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="gui\DropBox.ui"> <CustomBuild Include="gui\DropBox.ui">
<Filter>Dialogs</Filter> <Filter>Dialogs</Filter>
@ -742,8 +739,10 @@
</CustomBuild> </CustomBuild>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="res\MainIcon.ico" />
<None Include="ReadMe.txt" /> <None Include="ReadMe.txt" />
<None Include="res\MainIcon.ico">
<Filter>Miscellaneous</Filter>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Filter Include="Header Files"> <Filter Include="Header Files">
@ -818,5 +817,18 @@
<Filter Include="Header Files\Misc\3rd Party"> <Filter Include="Header Files\Misc\3rd Party">
<UniqueIdentifier>{574b856b-cea0-4c37-ba58-17f15f7911da}</UniqueIdentifier> <UniqueIdentifier>{574b856b-cea0-4c37-ba58-17f15f7911da}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Miscellaneous">
<UniqueIdentifier>{da2c1d3e-888f-4f4d-98b3-3392faa475c3}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="LameXP.rc">
<Filter>Miscellaneous</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Manifest Include="etc\Manifest\Compatibility.manifest">
<Filter>Miscellaneous</Filter>
</Manifest>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
</application>
</compatibility>
</assembly>

View File

@ -700,7 +700,7 @@ void lamexp_message_handler(QtMsgType type, const char *msg)
int index = qBound(0, static_cast<int>(type), 3); int index = qBound(0, static_cast<int>(type), 3);
unsigned int timestamp = static_cast<unsigned int>(_time64(NULL) % 3600I64); unsigned int timestamp = static_cast<unsigned int>(_time64(NULL) % 3600I64);
QString str = QString::fromUtf8(msg).trimmed().replace('\n', '\t'); QString str = QString::fromUtf8(msg).trimmed().replace('\n', '\t');
fprintf(g_lamexp_log_file, "[%c][%04u] %s\r\n", prefix[index], timestamp, str.toUtf8().constData()); fprintf(g_lamexp_log_file, "[%c][%04u] %s\r\n", prefix[index], timestamp, QUTF8(str));
fflush(g_lamexp_log_file); fflush(g_lamexp_log_file);
} }
@ -1299,43 +1299,37 @@ bool lamexp_init_qt(int argc, char* argv[])
//Supported Windows version? //Supported Windows version?
if(osVersionNo == lamexp_winver_winxp) if(osVersionNo == lamexp_winver_winxp)
{ {
qDebug("Running on Windows XP or Windows XP Media Center Edition.\n"); qDebug("Running on Windows XP or Windows XP Media Center Edition.\n"); //lamexp_check_compatibility_mode("GetLargePageMinimum", executableName);
//lamexp_check_compatibility_mode("GetLargePageMinimum", executableName);
} }
else if(osVersionNo == lamexp_winver_xpx64) else if(osVersionNo == lamexp_winver_xpx64)
{ {
qDebug("Running on Windows Server 2003, Windows Server 2003 R2 or Windows XP x64.\n"); qDebug("Running on Windows Server 2003, Windows Server 2003 R2 or Windows XP x64.\n"); //lamexp_check_compatibility_mode("GetLocaleInfoEx", executableName);
//lamexp_check_compatibility_mode("GetLocaleInfoEx", executableName);
} }
else if(osVersionNo == lamexp_winver_vista) else if(osVersionNo == lamexp_winver_vista)
{ {
qDebug("Running on Windows Vista or Windows Server 2008.\n"); qDebug("Running on Windows Vista or Windows Server 2008.\n"); //lamexp_check_compatibility_mode("CreateRemoteThreadEx", executableName*/);
//lamexp_check_compatibility_mode("CreateRemoteThreadEx", executableName*/);
} }
else if(osVersionNo == lamexp_winver_win70) else if(osVersionNo == lamexp_winver_win70)
{ {
qDebug("Running on Windows 7 or Windows Server 2008 R2.\n"); qDebug("Running on Windows 7 or Windows Server 2008 R2.\n"); //lamexp_check_compatibility_mode("CreateFile2", executableName);
//lamexp_check_compatibility_mode("CreateFile2", executableName);
} }
else if(osVersionNo == lamexp_winver_win80) else if(osVersionNo == lamexp_winver_win80)
{ {
qDebug("Running on Windows 8 or Windows Server 2012.\n"); qDebug("Running on Windows 8 or Windows Server 2012.\n"); //lamexp_check_compatibility_mode("FindPackagesByPackageFamily", executableName);
//lamexp_check_compatibility_mode("FindPackagesByPackageFamily", executableName);
} }
else if(osVersionNo == lamexp_winver_win81) else if(osVersionNo == lamexp_winver_win81)
{ {
qDebug("Running on Windows 8.1 or Windows Server 2012 R2.\n"); qDebug("Running on Windows 8.1 or Windows Server 2012 R2.\n"); //lamexp_check_compatibility_mode(NULL, executableName);
//lamexp_check_compatibility_mode(NULL, executableName);
} }
else else
{ {
const QString message = QString().sprintf("Running on an unknown WindowsNT-based system (v%u.%u).", osVersionNo.versionMajor, osVersionNo.versionMinor); const QString message = QString().sprintf("Running on an unknown WindowsNT-based system (v%u.%u).", osVersionNo.versionMajor, osVersionNo.versionMinor);
qWarning("%s\n", message.toUtf8().constData()); qWarning("%s\n", QUTF8(message));
MessageBoxW(NULL, QWCHAR(message), L"LameXP", MB_OK | MB_TOPMOST | MB_ICONWARNING); MessageBoxW(NULL, QWCHAR(message), L"LameXP", MB_OK | MB_TOPMOST | MB_ICONWARNING);
} }
//Check for compat mode //Check for compat mode
if(osVersionNo.overrideFlag && (osVersionNo < lamexp_winver_win81)) if(osVersionNo.overrideFlag && (osVersionNo <= lamexp_winver_win81))
{ {
qFatal("%s", QApplication::tr("Executable '%1' doesn't support Windows compatibility mode.").arg(executableName).toLatin1().constData()); qFatal("%s", QApplication::tr("Executable '%1' doesn't support Windows compatibility mode.").arg(executableName).toLatin1().constData());
return false; return false;
@ -1355,7 +1349,7 @@ bool lamexp_init_qt(int argc, char* argv[])
//Load plugins from application directory //Load plugins from application directory
QCoreApplication::setLibraryPaths(QStringList() << QApplication::applicationDirPath()); QCoreApplication::setLibraryPaths(QStringList() << QApplication::applicationDirPath());
qDebug("Library Path:\n%s\n", QApplication::libraryPaths().first().toUtf8().constData()); qDebug("Library Path:\n%s\n", QUTF8(QApplication::libraryPaths().first()));
//Set application properties //Set application properties
application->setApplicationName("LameXP - Audio Encoder Front-End"); application->setApplicationName("LameXP - Audio Encoder Front-End");
@ -1440,7 +1434,7 @@ int lamexp_init_ipc(void)
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write); LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write);
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_read_mutex); LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_read_mutex);
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write_mutex); LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write_mutex);
qFatal("Failed to create system smaphore: %s", errorMessage.toUtf8().constData()); qFatal("Failed to create system smaphore: %s", QUTF8(errorMessage));
return -1; return -1;
} }
if(g_lamexp_ipc_ptr.semaphore_write->error() != QSystemSemaphore::NoError) if(g_lamexp_ipc_ptr.semaphore_write->error() != QSystemSemaphore::NoError)
@ -1450,7 +1444,7 @@ int lamexp_init_ipc(void)
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write); LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write);
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_read_mutex); LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_read_mutex);
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write_mutex); LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write_mutex);
qFatal("Failed to create system smaphore: %s", errorMessage.toUtf8().constData()); qFatal("Failed to create system smaphore: %s", QUTF8(errorMessage));
return -1; return -1;
} }
if(g_lamexp_ipc_ptr.semaphore_read_mutex->error() != QSystemSemaphore::NoError) if(g_lamexp_ipc_ptr.semaphore_read_mutex->error() != QSystemSemaphore::NoError)
@ -1460,7 +1454,7 @@ int lamexp_init_ipc(void)
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write); LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write);
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_read_mutex); LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_read_mutex);
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write_mutex); LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write_mutex);
qFatal("Failed to create system smaphore: %s", errorMessage.toUtf8().constData()); qFatal("Failed to create system smaphore: %s", QUTF8(errorMessage));
return -1; return -1;
} }
if(g_lamexp_ipc_ptr.semaphore_write_mutex->error() != QSystemSemaphore::NoError) if(g_lamexp_ipc_ptr.semaphore_write_mutex->error() != QSystemSemaphore::NoError)
@ -1470,7 +1464,7 @@ int lamexp_init_ipc(void)
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write); LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write);
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_read_mutex); LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_read_mutex);
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write_mutex); LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write_mutex);
qFatal("Failed to create system smaphore: %s", errorMessage.toUtf8().constData()); qFatal("Failed to create system smaphore: %s", QUTF8(errorMessage));
return -1; return -1;
} }
@ -1489,7 +1483,7 @@ int lamexp_init_ipc(void)
{ {
QString errorMessage = g_lamexp_ipc_ptr.sharedmem->errorString(); QString errorMessage = g_lamexp_ipc_ptr.sharedmem->errorString();
LAMEXP_DELETE(g_lamexp_ipc_ptr.sharedmem); LAMEXP_DELETE(g_lamexp_ipc_ptr.sharedmem);
qFatal("Failed to attach to shared memory: %s", errorMessage.toUtf8().constData()); qFatal("Failed to attach to shared memory: %s", QUTF8(errorMessage));
return -1; return -1;
} }
} }
@ -1497,7 +1491,7 @@ int lamexp_init_ipc(void)
{ {
QString errorMessage = g_lamexp_ipc_ptr.sharedmem->errorString(); QString errorMessage = g_lamexp_ipc_ptr.sharedmem->errorString();
LAMEXP_DELETE(g_lamexp_ipc_ptr.sharedmem); LAMEXP_DELETE(g_lamexp_ipc_ptr.sharedmem);
qFatal("Failed to create shared memory: %s", errorMessage.toUtf8().constData()); qFatal("Failed to create shared memory: %s", QUTF8(errorMessage));
return -1; return -1;
} }
} }
@ -2957,7 +2951,7 @@ bool lamexp_open_media_file(const QString &mediaFilePath)
{ {
if(mplayerDir.exists(WCHAR2QSTR(appNames[k]))) if(mplayerDir.exists(WCHAR2QSTR(appNames[k])))
{ {
qDebug("Player found at:\n%s\n", mplayerDir.absoluteFilePath(WCHAR2QSTR(appNames[k])).toUtf8().constData()); qDebug("Player found at:\n%s\n", QUTF8(mplayerDir.absoluteFilePath(WCHAR2QSTR(appNames[k]))));
QProcess::startDetached(mplayerDir.absoluteFilePath(WCHAR2QSTR(appNames[k])), QStringList() << QDir::toNativeSeparators(mediaFilePath)); QProcess::startDetached(mplayerDir.absoluteFilePath(WCHAR2QSTR(appNames[k])), QStringList() << QDir::toNativeSeparators(mediaFilePath));
return true; return true;
} }