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

View File

@ -535,9 +535,6 @@
<Filter>Header Files\Misc\3rd Party</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="LameXP.rc" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="gui\DropBox.ui">
<Filter>Dialogs</Filter>
@ -742,8 +739,10 @@
</CustomBuild>
</ItemGroup>
<ItemGroup>
<None Include="res\MainIcon.ico" />
<None Include="ReadMe.txt" />
<None Include="res\MainIcon.ico">
<Filter>Miscellaneous</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Filter Include="Header Files">
@ -818,5 +817,18 @@
<Filter Include="Header Files\Misc\3rd Party">
<UniqueIdentifier>{574b856b-cea0-4c37-ba58-17f15f7911da}</UniqueIdentifier>
</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>
</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);
unsigned int timestamp = static_cast<unsigned int>(_time64(NULL) % 3600I64);
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);
}
@ -1299,43 +1299,37 @@ bool lamexp_init_qt(int argc, char* argv[])
//Supported Windows version?
if(osVersionNo == lamexp_winver_winxp)
{
qDebug("Running on Windows XP or Windows XP Media Center Edition.\n");
//lamexp_check_compatibility_mode("GetLargePageMinimum", executableName);
qDebug("Running on Windows XP or Windows XP Media Center Edition.\n"); //lamexp_check_compatibility_mode("GetLargePageMinimum", executableName);
}
else if(osVersionNo == lamexp_winver_xpx64)
{
qDebug("Running on Windows Server 2003, Windows Server 2003 R2 or Windows XP x64.\n");
//lamexp_check_compatibility_mode("GetLocaleInfoEx", executableName);
qDebug("Running on Windows Server 2003, Windows Server 2003 R2 or Windows XP x64.\n"); //lamexp_check_compatibility_mode("GetLocaleInfoEx", executableName);
}
else if(osVersionNo == lamexp_winver_vista)
{
qDebug("Running on Windows Vista or Windows Server 2008.\n");
//lamexp_check_compatibility_mode("CreateRemoteThreadEx", executableName*/);
qDebug("Running on Windows Vista or Windows Server 2008.\n"); //lamexp_check_compatibility_mode("CreateRemoteThreadEx", executableName*/);
}
else if(osVersionNo == lamexp_winver_win70)
{
qDebug("Running on Windows 7 or Windows Server 2008 R2.\n");
//lamexp_check_compatibility_mode("CreateFile2", executableName);
qDebug("Running on Windows 7 or Windows Server 2008 R2.\n"); //lamexp_check_compatibility_mode("CreateFile2", executableName);
}
else if(osVersionNo == lamexp_winver_win80)
{
qDebug("Running on Windows 8 or Windows Server 2012.\n");
//lamexp_check_compatibility_mode("FindPackagesByPackageFamily", executableName);
qDebug("Running on Windows 8 or Windows Server 2012.\n"); //lamexp_check_compatibility_mode("FindPackagesByPackageFamily", executableName);
}
else if(osVersionNo == lamexp_winver_win81)
{
qDebug("Running on Windows 8.1 or Windows Server 2012 R2.\n");
//lamexp_check_compatibility_mode(NULL, executableName);
qDebug("Running on Windows 8.1 or Windows Server 2012 R2.\n"); //lamexp_check_compatibility_mode(NULL, executableName);
}
else
{
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);
}
//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());
return false;
@ -1355,7 +1349,7 @@ bool lamexp_init_qt(int argc, char* argv[])
//Load plugins from application directory
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
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_read_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;
}
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_read_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;
}
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_read_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;
}
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_read_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;
}
@ -1489,7 +1483,7 @@ int lamexp_init_ipc(void)
{
QString errorMessage = g_lamexp_ipc_ptr.sharedmem->errorString();
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;
}
}
@ -1497,7 +1491,7 @@ int lamexp_init_ipc(void)
{
QString errorMessage = g_lamexp_ipc_ptr.sharedmem->errorString();
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;
}
}
@ -2957,7 +2951,7 @@ bool lamexp_open_media_file(const QString &mediaFilePath)
{
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));
return true;
}