Improved Windows version detection code.

This commit is contained in:
LoRd_MuldeR 2013-10-20 19:12:00 +02:00
parent 26d186cdf8
commit be9cf25645
8 changed files with 169 additions and 150 deletions

View File

@ -3290,23 +3290,22 @@
<context>
<name>QApplication</name>
<message>
<location filename="../../src/Global.cpp" line="935"/>
<location filename="../../src/Global.cpp" line="1013"/>
<source>Executable &apos;%1&apos; doesn&apos;t support Windows compatibility mode.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Global.cpp" line="1188"/>
<location filename="../../src/Global.cpp" line="1266"/>
<source>Executable &apos;%1&apos; requires Qt v%2, but found Qt v%3.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Global.cpp" line="1193"/>
<location filename="../../src/Global.cpp" line="1271"/>
<source>Executable &apos;%1&apos; was built for Qt &apos;%2&apos;, but found Qt &apos;%3&apos;.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Global.cpp" line="1207"/>
<location filename="../../src/Global.cpp" line="1234"/>
<location filename="../../src/Global.cpp" line="1283"/>
<source>Executable &apos;%1&apos; requires Windows XP or later.</source>
<translation type="unfinished"></translation>
</message>
@ -3375,105 +3374,105 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="263"/>
<location filename="../../src/Dialog_Update.cpp" line="540"/>
<location filename="../../src/Dialog_Update.cpp" line="276"/>
<location filename="../../src/Dialog_Update.cpp" line="548"/>
<source>Build</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="264"/>
<location filename="../../src/Dialog_Update.cpp" line="277"/>
<source>Unknown</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="372"/>
<location filename="../../src/Dialog_Update.cpp" line="385"/>
<source>Testing your internet connection, please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="392"/>
<location filename="../../src/Dialog_Update.cpp" line="984"/>
<location filename="../../src/Dialog_Update.cpp" line="400"/>
<location filename="../../src/Dialog_Update.cpp" line="987"/>
<source>It appears that the computer currently is offline!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="395"/>
<location filename="../../src/Dialog_Update.cpp" line="987"/>
<location filename="../../src/Dialog_Update.cpp" line="403"/>
<location filename="../../src/Dialog_Update.cpp" line="990"/>
<source>Please make sure your computer is connected to the internet and try again.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="453"/>
<location filename="../../src/Dialog_Update.cpp" line="461"/>
<source>Network connectivity test has failed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="456"/>
<location filename="../../src/Dialog_Update.cpp" line="464"/>
<source>Please make sure your internet connection is working properly and try again.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="470"/>
<location filename="../../src/Dialog_Update.cpp" line="478"/>
<source>Checking for new updates online, please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="525"/>
<location filename="../../src/Dialog_Update.cpp" line="533"/>
<source>Failed to fetch update information from server!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="530"/>
<location filename="../../src/Dialog_Update.cpp" line="538"/>
<source>Sorry, the update server might be busy at this time. Plase try again later.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="542"/>
<location filename="../../src/Dialog_Update.cpp" line="550"/>
<source>More information available at:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="548"/>
<location filename="../../src/Dialog_Update.cpp" line="556"/>
<source>A new version of LameXP is available!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="550"/>
<location filename="../../src/Dialog_Update.cpp" line="558"/>
<source>We highly recommend all users to install this update as soon as possible.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="559"/>
<location filename="../../src/Dialog_Update.cpp" line="567"/>
<source>No new updates available at this time.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="561"/>
<location filename="../../src/Dialog_Update.cpp" line="569"/>
<source>Your version of LameXP is still up-to-date. Please check for updates regularly!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="570"/>
<location filename="../../src/Dialog_Update.cpp" line="578"/>
<source>Your version appears to be newer than the latest release.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="572"/>
<location filename="../../src/Dialog_Update.cpp" line="580"/>
<source>This usually indicates your are currently using a pre-release version of LameXP.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="865"/>
<location filename="../../src/Dialog_Update.cpp" line="873"/>
<source>Update is being downloaded, please be patient...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="910"/>
<location filename="../../src/Dialog_Update.cpp" line="918"/>
<source>Update ready to install. Applicaion will quit...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="918"/>
<location filename="../../src/Dialog_Update.cpp" line="926"/>
<source>Update failed. Please try again or download manually!</source>
<translation type="unfinished"></translation>
</message>

View File

@ -3327,23 +3327,22 @@
<context>
<name>QApplication</name>
<message>
<location filename="../../src/Global.cpp" line="935"/>
<location filename="../../src/Global.cpp" line="1013"/>
<source>Executable &apos;%1&apos; doesn&apos;t support Windows compatibility mode.</source>
<translation type="unfinished">Plik wykonywalny &apos;%1&apos; nie działa w trybie kompatybilności z Windows.</translation>
</message>
<message>
<location filename="../../src/Global.cpp" line="1188"/>
<location filename="../../src/Global.cpp" line="1266"/>
<source>Executable &apos;%1&apos; requires Qt v%2, but found Qt v%3.</source>
<translation type="unfinished">Plik wykonywalny &apos;%1&apos; wymaga Qt v%2, znaleziono jednak Qt v%3.</translation>
</message>
<message>
<location filename="../../src/Global.cpp" line="1193"/>
<location filename="../../src/Global.cpp" line="1271"/>
<source>Executable &apos;%1&apos; was built for Qt &apos;%2&apos;, but found Qt &apos;%3&apos;.</source>
<translation type="unfinished">Plik wykonywalny &quot;%1&quot; został skompilowany dla Qt &quot;%2&quot;, znaleziono &quot;%3&quot;.</translation>
</message>
<message>
<location filename="../../src/Global.cpp" line="1207"/>
<location filename="../../src/Global.cpp" line="1234"/>
<location filename="../../src/Global.cpp" line="1283"/>
<source>Executable &apos;%1&apos; requires Windows XP or later.</source>
<translation type="unfinished"></translation>
</message>
@ -3412,105 +3411,105 @@
<translation type="unfinished">Zamknij</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="263"/>
<location filename="../../src/Dialog_Update.cpp" line="540"/>
<location filename="../../src/Dialog_Update.cpp" line="276"/>
<location filename="../../src/Dialog_Update.cpp" line="548"/>
<source>Build</source>
<translation type="unfinished">Build</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="264"/>
<location filename="../../src/Dialog_Update.cpp" line="277"/>
<source>Unknown</source>
<translation type="unfinished">Nieznana</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="372"/>
<location filename="../../src/Dialog_Update.cpp" line="385"/>
<source>Testing your internet connection, please wait...</source>
<translation type="unfinished">Testowanie połączenia internetowego, prosze czekać...</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="392"/>
<location filename="../../src/Dialog_Update.cpp" line="984"/>
<location filename="../../src/Dialog_Update.cpp" line="400"/>
<location filename="../../src/Dialog_Update.cpp" line="987"/>
<source>It appears that the computer currently is offline!</source>
<translation type="unfinished">LameXP wykrył brak dostępu do internetu!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="395"/>
<location filename="../../src/Dialog_Update.cpp" line="987"/>
<location filename="../../src/Dialog_Update.cpp" line="403"/>
<location filename="../../src/Dialog_Update.cpp" line="990"/>
<source>Please make sure your computer is connected to the internet and try again.</source>
<translation type="unfinished">Upewnij się że komputer jest podłączony do internetu i spróbuj ponownie.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="453"/>
<location filename="../../src/Dialog_Update.cpp" line="461"/>
<source>Network connectivity test has failed!</source>
<translation type="unfinished">Test połączenia internetowego zakończony niepowodzeniem!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="456"/>
<location filename="../../src/Dialog_Update.cpp" line="464"/>
<source>Please make sure your internet connection is working properly and try again.</source>
<translation type="unfinished">Upewnij się że połączenie internetowe działa prawidłowo i spróbuj ponownie.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="470"/>
<location filename="../../src/Dialog_Update.cpp" line="478"/>
<source>Checking for new updates online, please wait...</source>
<translation type="unfinished">Sprawdzanie aktualizacji online, prosze czekać...</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="525"/>
<location filename="../../src/Dialog_Update.cpp" line="533"/>
<source>Failed to fetch update information from server!</source>
<translation type="unfinished">Pobieranie informacji z serwera zakończone niepowodzeniem!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="530"/>
<location filename="../../src/Dialog_Update.cpp" line="538"/>
<source>Sorry, the update server might be busy at this time. Plase try again later.</source>
<translation type="unfinished">Serwer aktualizacji wydaje się nie odpowiadać w tej chwili. Prosze spróbować później.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="542"/>
<location filename="../../src/Dialog_Update.cpp" line="550"/>
<source>More information available at:</source>
<translation type="unfinished">Więcej informacji tutaj:</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="548"/>
<location filename="../../src/Dialog_Update.cpp" line="556"/>
<source>A new version of LameXP is available!</source>
<translation type="unfinished">Dostępna nowa wersja LameXP!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="550"/>
<location filename="../../src/Dialog_Update.cpp" line="558"/>
<source>We highly recommend all users to install this update as soon as possible.</source>
<translation type="unfinished">Jest wysoce zalecane aby zainstalować aktualizację jak najszybciej.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="559"/>
<location filename="../../src/Dialog_Update.cpp" line="567"/>
<source>No new updates available at this time.</source>
<translation type="unfinished">Nie ma nowych aktualizacji w tej chwili.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="561"/>
<location filename="../../src/Dialog_Update.cpp" line="569"/>
<source>Your version of LameXP is still up-to-date. Please check for updates regularly!</source>
<translation type="unfinished">Posiadasz najnowszą wersję LameXP. Sprawdzaj aktualizacje regularnie!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="570"/>
<location filename="../../src/Dialog_Update.cpp" line="578"/>
<source>Your version appears to be newer than the latest release.</source>
<translation type="unfinished">Posiadasz nowszą wersję LameXP niż ostatnie wydanie.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="572"/>
<location filename="../../src/Dialog_Update.cpp" line="580"/>
<source>This usually indicates your are currently using a pre-release version of LameXP.</source>
<translation type="unfinished">To wskazuje na to, że posiadasz wersję alfa LameXP.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="865"/>
<location filename="../../src/Dialog_Update.cpp" line="873"/>
<source>Update is being downloaded, please be patient...</source>
<translation type="unfinished">Pobieranie aktualizacji w toku, prosze czekać...</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="910"/>
<location filename="../../src/Dialog_Update.cpp" line="918"/>
<source>Update ready to install. Applicaion will quit...</source>
<translation type="unfinished">Aktualizacja gotowa do instalacji. Teraz program zostanie zamknięty...</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="918"/>
<location filename="../../src/Dialog_Update.cpp" line="926"/>
<source>Update failed. Please try again or download manually!</source>
<translation type="unfinished">Aktualizacja zakończona niepowodzeniem. Prosze spróbować ponownie lub zainstalować ręcznie!</translation>
</message>

View File

@ -3310,23 +3310,22 @@
<context>
<name>QApplication</name>
<message>
<location filename="../../src/Global.cpp" line="935"/>
<location filename="../../src/Global.cpp" line="1013"/>
<source>Executable &apos;%1&apos; doesn&apos;t support Windows compatibility mode.</source>
<translation>EXE-filen &apos;%1&apos; stöder inte Windows kompatibilitetsläge.</translation>
</message>
<message>
<location filename="../../src/Global.cpp" line="1188"/>
<location filename="../../src/Global.cpp" line="1266"/>
<source>Executable &apos;%1&apos; requires Qt v%2, but found Qt v%3.</source>
<translation>EXE-filen &apos;%1&apos; kräver Qt v%2, du har Qt v%3.</translation>
</message>
<message>
<location filename="../../src/Global.cpp" line="1193"/>
<location filename="../../src/Global.cpp" line="1271"/>
<source>Executable &apos;%1&apos; was built for Qt &apos;%2&apos;, but found Qt &apos;%3&apos;.</source>
<translation>EXE-filen &apos;%1&apos; är byggd för Qt &apos;%2&apos;, du har Qt &apos;%3&apos;.</translation>
</message>
<message>
<location filename="../../src/Global.cpp" line="1207"/>
<location filename="../../src/Global.cpp" line="1234"/>
<location filename="../../src/Global.cpp" line="1283"/>
<source>Executable &apos;%1&apos; requires Windows XP or later.</source>
<translation type="unfinished"></translation>
</message>
@ -3395,105 +3394,105 @@
<translation>Stäng</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="263"/>
<location filename="../../src/Dialog_Update.cpp" line="540"/>
<location filename="../../src/Dialog_Update.cpp" line="276"/>
<location filename="../../src/Dialog_Update.cpp" line="548"/>
<source>Build</source>
<translation>Build</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="264"/>
<location filename="../../src/Dialog_Update.cpp" line="277"/>
<source>Unknown</source>
<translation>Okänd</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="372"/>
<location filename="../../src/Dialog_Update.cpp" line="385"/>
<source>Testing your internet connection, please wait...</source>
<translation>Kontrollerar iInternetanslutningen, vänta...</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="392"/>
<location filename="../../src/Dialog_Update.cpp" line="984"/>
<location filename="../../src/Dialog_Update.cpp" line="400"/>
<location filename="../../src/Dialog_Update.cpp" line="987"/>
<source>It appears that the computer currently is offline!</source>
<translation>Datorn verkar inte vara ansluten till Internet!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="395"/>
<location filename="../../src/Dialog_Update.cpp" line="987"/>
<location filename="../../src/Dialog_Update.cpp" line="403"/>
<location filename="../../src/Dialog_Update.cpp" line="990"/>
<source>Please make sure your computer is connected to the internet and try again.</source>
<translation>Tillse att datorn är ansluten till Internet och försök igen.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="453"/>
<location filename="../../src/Dialog_Update.cpp" line="461"/>
<source>Network connectivity test has failed!</source>
<translation>Anslutningskontrollen misslyckades!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="456"/>
<location filename="../../src/Dialog_Update.cpp" line="464"/>
<source>Please make sure your internet connection is working properly and try again.</source>
<translation>Tillse att Internetuppkopplingen fungerar korrekt och försök igen.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="470"/>
<location filename="../../src/Dialog_Update.cpp" line="478"/>
<source>Checking for new updates online, please wait...</source>
<translation>Söker nya uppdateringar, vänta...</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="525"/>
<location filename="../../src/Dialog_Update.cpp" line="533"/>
<source>Failed to fetch update information from server!</source>
<translation>Kunde inte hämta uppdateringsinformation från servern!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="530"/>
<location filename="../../src/Dialog_Update.cpp" line="538"/>
<source>Sorry, the update server might be busy at this time. Plase try again later.</source>
<translation>Uppdateringsservern kan vara upptagen. Försök senare.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="542"/>
<location filename="../../src/Dialog_Update.cpp" line="550"/>
<source>More information available at:</source>
<translation>Mer information hittas :</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="548"/>
<location filename="../../src/Dialog_Update.cpp" line="556"/>
<source>A new version of LameXP is available!</source>
<translation>En ny version av LameXP finns tillgänglig!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="550"/>
<location filename="../../src/Dialog_Update.cpp" line="558"/>
<source>We highly recommend all users to install this update as soon as possible.</source>
<translation>Vi rekommenderar alla användare att installera denna uppdatering snart som möjligt.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="559"/>
<location filename="../../src/Dialog_Update.cpp" line="567"/>
<source>No new updates available at this time.</source>
<translation>Det finns inga nya uppdateringar.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="561"/>
<location filename="../../src/Dialog_Update.cpp" line="569"/>
<source>Your version of LameXP is still up-to-date. Please check for updates regularly!</source>
<translation>Din version av LameXP är uppdaterad. Kontrollera regelbundet!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="570"/>
<location filename="../../src/Dialog_Update.cpp" line="578"/>
<source>Your version appears to be newer than the latest release.</source>
<translation>Din version verkar vara nyare än senaste &apos;Release&apos;.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="572"/>
<location filename="../../src/Dialog_Update.cpp" line="580"/>
<source>This usually indicates your are currently using a pre-release version of LameXP.</source>
<translation>Det innebär normalt att du använder en beta-version av LameXP.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="865"/>
<location filename="../../src/Dialog_Update.cpp" line="873"/>
<source>Update is being downloaded, please be patient...</source>
<translation>Uppdatering laddas ner, vänta...</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="910"/>
<location filename="../../src/Dialog_Update.cpp" line="918"/>
<source>Update ready to install. Applicaion will quit...</source>
<translation>Uppdatering klar att installeras. Programmet kommer att avslutas...</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="918"/>
<location filename="../../src/Dialog_Update.cpp" line="926"/>
<source>Update failed. Please try again or download manually!</source>
<translation>Uppdateringen misslyckades. Försök igen, eller ladda ner manuellt!</translation>
</message>

View File

@ -1,11 +0,0 @@
@echo off
REM ---------------------------
call "..\Deployment\_paths.bat"
if exist "%PATH_QTMSVC%\bin\qtenv2.bat" call "%PATH_QTMSVC%\bin\qtenv2.bat"
if exist "%PATH_QTMSVC%\bin\qtvars.bat" call "%PATH_QTMSVC%\bin\qtvars.bat"
REM ---------------------------
for %%f in (LameXP_??.ts) do (
lrelease.exe %%f -qm ..\..\res\localization\%%~nf.qm
)
REM ---------------------------
pause

View File

@ -34,7 +34,7 @@
#define VER_LAMEXP_MINOR_LO 9
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 3
#define VER_LAMEXP_BUILD 1403
#define VER_LAMEXP_BUILD 1407
#define VER_LAMEXP_CONFG 1348
///////////////////////////////////////////////////////////////////////////////

View File

@ -291,6 +291,15 @@ static FILE *g_lamexp_log_file = NULL;
const char* LAMEXP_DEFAULT_LANGID = "en";
const char* LAMEXP_DEFAULT_TRANSLATION = "LameXP_EN.qm";
//Known Windows versions - maps marketing names to the actual Windows NT versions
const lamexp_os_version_t lamexp_winver_win2k = {5,0};
const lamexp_os_version_t lamexp_winver_winxp = {5,1};
const lamexp_os_version_t lamexp_winver_xpx64 = {5,2};
const lamexp_os_version_t lamexp_winver_vista = {6,0};
const lamexp_os_version_t lamexp_winver_win70 = {6,1};
const lamexp_os_version_t lamexp_winver_win80 = {6,2};
const lamexp_os_version_t lamexp_winver_win81 = {6,3};
///////////////////////////////////////////////////////////////////////////////
// COMPILER INFO
///////////////////////////////////////////////////////////////////////////////
@ -492,27 +501,25 @@ const QDate &lamexp_version_date(void)
return g_lamexp_version_date;
}
static bool lamexp_verify_os_version(const DWORD major, const DWORD minor, const BYTE opMajor, const BYTE opMinor)
static bool lamexp_verify_os_version(const DWORD major, const DWORD minor)
{
qDebug("checkOsVersion %u.%u (%u,%u)\n", major, minor, (unsigned int)opMajor, (unsigned int)opMinor);
OSVERSIONINFOEX osvi;
OSVERSIONINFOEXW osvi;
DWORDLONG dwlConditionMask = 0;
//Initialize the OSVERSIONINFOEX structure.
memset(&osvi, 0, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
//Initialize the OSVERSIONINFOEX structure
memset(&osvi, 0, sizeof(OSVERSIONINFOEXW));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW);
osvi.dwMajorVersion = major;
osvi.dwMinorVersion = minor;
osvi.dwPlatformId = VER_PLATFORM_WIN32_NT;
//Initialize the condition mask
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, opMajor);
VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, opMinor);
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
VER_SET_CONDITION(dwlConditionMask, VER_PLATFORMID, VER_EQUAL);
// Perform the test
const BOOL ret = VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_PLATFORMID, dwlConditionMask);
const BOOL ret = VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_PLATFORMID, dwlConditionMask);
//Error checking
if(!ret)
@ -531,54 +538,62 @@ static bool lamexp_verify_os_version(const DWORD major, const DWORD minor, const
*/
static bool lamexp_get_real_os_version(unsigned int *major, unsigned int *minor)
{
*major = *minor = UINT_MAX;
//Determine the *major* version first
for(DWORD i = 3; i < 100; i++)
{
if(lamexp_verify_os_version(i, 0, VER_GREATER_EQUAL, VER_GREATER_EQUAL))
{
*major = i;
continue;
}
break;
}
//Now also determine the *minor* version
if((*major) != UINT_MAX)
{
for(DWORD i = 0; i < 100; i++)
{
if(lamexp_verify_os_version((*major), i, VER_EQUAL, VER_GREATER_EQUAL))
{
*minor = i;
continue;
}
break;
}
}
//Check for completeness
if(((*major) == UINT_MAX) || ((*minor) == UINT_MAX))
{
*major = *minor = 0;
return false;
//Initialize local variables
OSVERSIONINFOEXW osvi;
memset(&osvi, 0, sizeof(OSVERSIONINFOEXW));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW);
//Try GetVersionEx() first
if(GetVersionExW((LPOSVERSIONINFOW)&osvi) != FALSE)
{
if(osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)
{
*major = osvi.dwMajorVersion;
*minor = osvi.dwMinorVersion;
}
}
return true;
//Determine the real *major* version first
forever
{
const DWORD nextMajor = (*major) + 1;
if(lamexp_verify_os_version(nextMajor, 0))
{
*major = nextMajor;
*minor = 0;
continue;
}
break;
}
//Now also determine the real *minor* version
forever
{
const DWORD nextMinor = (*minor) + 1;
if(lamexp_verify_os_version((*major), nextMinor))
{
*minor = nextMinor;
continue;
}
break;
}
return ((*major) > 0);
}
/*
* Get the native operating system version
*/
const lamexp_os_version_t *lamexp_get_os_version(void)
const lamexp_os_version_t &lamexp_get_os_version(void)
{
QReadLocker readLock(&g_lamexp_os_version.lock);
//Already initialized?
if(g_lamexp_os_version.bInitialized)
{
return &g_lamexp_os_version.version;
return g_lamexp_os_version.version;
}
readLock.unlock();
@ -600,7 +615,7 @@ const lamexp_os_version_t *lamexp_get_os_version(void)
}
}
return &g_lamexp_os_version.version;
return g_lamexp_os_version.version;
}
/*
@ -1262,44 +1277,48 @@ bool lamexp_init_qt(int argc, char* argv[])
#endif
//Check the Windows version
const lamexp_os_version_t *osVersionNo = lamexp_get_os_version();
if(LAMEXP_MAX_OS_VER(osVersionNo, 5, 0))
const lamexp_os_version_t &osVersionNo = lamexp_get_os_version();
if(osVersionNo < lamexp_winver_winxp)
{
qFatal("%s", QApplication::tr("Executable '%1' requires Windows XP or later.").arg(executableName).toLatin1().constData());
}
else if(LAMEXP_EQL_OS_VER(osVersionNo, 5, 1))
//Check for compat mode
if(osVersionNo == lamexp_winver_winxp)
{
qDebug("Running on Windows XP.\n");
lamexp_check_compatibility_mode("GetLargePageMinimum", executableName);
}
else if(LAMEXP_EQL_OS_VER(osVersionNo, 5, 2))
else if(osVersionNo == lamexp_winver_xpx64)
{
qDebug("Running on Windows Server 2003 or Windows XP x64-Edition.\n");
lamexp_check_compatibility_mode("GetLocaleInfoEx", executableName);
}
else if(LAMEXP_EQL_OS_VER(osVersionNo, 6, 0))
else if(osVersionNo == lamexp_winver_vista)
{
qDebug("Running on Windows Vista or Windows Server 2008.\n");
lamexp_check_compatibility_mode("CreateRemoteThreadEx", executableName);
}
else if(LAMEXP_EQL_OS_VER(osVersionNo, 6, 1))
else if(osVersionNo == lamexp_winver_win70)
{
qDebug("Running on Windows 7 or Windows Server 2008 R2.\n");
lamexp_check_compatibility_mode("CreateFile2", executableName);
}
else if(LAMEXP_EQL_OS_VER(osVersionNo, 6, 2))
else if(osVersionNo == lamexp_winver_win80)
{
qDebug("Running on Windows 8 or Windows Server 2012.\n");
lamexp_check_compatibility_mode(NULL, executableName);
lamexp_check_compatibility_mode("FindPackagesByPackageFamily", executableName);
}
else if(LAMEXP_EQL_OS_VER(osVersionNo, 6, 3))
else if(osVersionNo == lamexp_winver_win81)
{
qDebug("Running on Windows 8.1 or Windows Server 2012 R2.\n");
lamexp_check_compatibility_mode(NULL, executableName);
}
else
{
qWarning("Running on an unknown/untested WindowsNT-based OS (v%u.%u).\n", 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());
MessageBoxW(NULL, QWCHAR(message), L"LameXP", MB_OK | MB_TOPMOST | MB_ICONWARNING);
}
//Check for Wine
@ -2196,8 +2215,8 @@ bool lamexp_themes_enabled(void)
if(!g_lamexp_themes_enabled.bInitialized)
{
g_lamexp_themes_enabled.bThemesEnabled = false;
const lamexp_os_version_t * osVersion = lamexp_get_os_version();
if(LAMEXP_MIN_OS_VER(osVersion, 5, 1))
const lamexp_os_version_t &osVersion = lamexp_get_os_version();
if(osVersion >= lamexp_winver_winxp)
{
IsAppThemedFun IsAppThemedPtr = NULL;
QLibrary uxTheme(QString("%1/UxTheme.dll").arg(lamexp_known_folder(lamexp_folder_systemfolder)));

View File

@ -81,13 +81,30 @@ typedef enum
lamexp_event_t;
//OS version number
typedef struct
typedef struct _lamexp_os_version_t
{
unsigned int versionMajor;
unsigned int versionMinor;
//comparision operators
inline bool operator== (const _lamexp_os_version_t &rhs) const { return (versionMajor == rhs.versionMajor) && (versionMinor == rhs.versionMinor); }
inline bool operator!= (const _lamexp_os_version_t &rhs) const { return (versionMajor != rhs.versionMajor) || (versionMinor != rhs.versionMinor); }
inline bool operator> (const _lamexp_os_version_t &rhs) const { return (versionMajor > rhs.versionMajor) || ((versionMajor == rhs.versionMajor) && (versionMinor > rhs.versionMinor)); }
inline bool operator>= (const _lamexp_os_version_t &rhs) const { return (versionMajor > rhs.versionMajor) || ((versionMajor == rhs.versionMajor) && (versionMinor >= rhs.versionMinor)); }
inline bool operator< (const _lamexp_os_version_t &rhs) const { return (versionMajor < rhs.versionMajor) || ((versionMajor == rhs.versionMajor) && (versionMinor < rhs.versionMinor)); }
inline bool operator<= (const _lamexp_os_version_t &rhs) const { return (versionMajor < rhs.versionMajor) || ((versionMajor == rhs.versionMajor) && (versionMinor <= rhs.versionMinor)); }
}
lamexp_os_version_t;
//Known Windows versions
extern const lamexp_os_version_t lamexp_winver_win2k;
extern const lamexp_os_version_t lamexp_winver_winxp;
extern const lamexp_os_version_t lamexp_winver_xpx64;
extern const lamexp_os_version_t lamexp_winver_vista;
extern const lamexp_os_version_t lamexp_winver_win70;
extern const lamexp_os_version_t lamexp_winver_win80;
extern const lamexp_os_version_t lamexp_winver_win81;
//Beep types
typedef enum
{
@ -125,7 +142,7 @@ unsigned int lamexp_toolver_coreaudio(void);
const char *lamexp_website_url(void);
const char *lamexp_mulders_url(void);
const char *lamexp_support_url(void);
const lamexp_os_version_t *lamexp_get_os_version(void);
const lamexp_os_version_t &lamexp_get_os_version(void);
bool lamexp_detect_wine(void);
//Public functions
@ -209,9 +226,6 @@ unsigned long lamexp_dbg_private_bytes(void);
#define LAMEXP_DELETE_ARRAY(PTR) do { if(PTR) { delete [] PTR; PTR = NULL; } } while(0)
#define LAMEXP_SAFE_FREE(PTR) do { if(PTR) { free((void*) PTR); PTR = NULL; } } while(0)
#define LAMEXP_CLOSE(HANDLE) do { if(HANDLE != NULL && HANDLE != INVALID_HANDLE_VALUE) { CloseHandle(HANDLE); HANDLE = NULL; } } while(0)
#define LAMEXP_MIN_OS_VER(VER_INFO, VER_MAJ, VER_MIN) (((VER_INFO)->versionMajor > (VER_MAJ)) || (((VER_INFO)->versionMajor == (VER_MAJ)) && ((VER_INFO)->versionMinor >= (VER_MIN))))
#define LAMEXP_MAX_OS_VER(VER_INFO, VER_MAJ, VER_MIN) (((VER_INFO)->versionMajor < (VER_MAJ)) || (((VER_INFO)->versionMajor == (VER_MAJ)) && ((VER_INFO)->versionMinor <= (VER_MIN))))
#define LAMEXP_EQL_OS_VER(VER_INFO, VER_MAJ, VER_MIN) (((VER_INFO)->versionMajor == (VER_MAJ)) && ((VER_INFO)->versionMinor == (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_BOOL2STR(X) (X ? "1" : "0")

View File

@ -264,8 +264,8 @@ bool QFileSystemModelEx::hasSubfolders(const QString &path)
{
if(s_findFirstFileExInfoLevel == INT_MAX)
{
const lamexp_os_version_t *osVersionNo = lamexp_get_os_version();
s_findFirstFileExInfoLevel = LAMEXP_MIN_OS_VER(osVersionNo, 6, 1) ? FindExInfoBasic : FindExInfoStandard;
const lamexp_os_version_t &osVersionNo = lamexp_get_os_version();
s_findFirstFileExInfoLevel = (osVersionNo >= lamexp_winver_win70) ? FindExInfoBasic : FindExInfoStandard;
}
WIN32_FIND_DATAW findData;