<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
+ <EntryPointSymbol>lamexp_entry_point</EntryPointSymbol>
</Link>
<PostBuildEvent>
<Message>Copy plugin DLL%27s</Message>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
+ <EntryPointSymbol>lamexp_entry_point</EntryPointSymbol>
</Link>
<PostBuildEvent>
<Message>Copy plugin DLL%27s</Message>
<SetChecksum>true</SetChecksum>
<TargetMachine>MachineX86</TargetMachine>
<MinimumRequiredVersion>5.0</MinimumRequiredVersion>
- <EntryPointSymbol>lamexp_crt_startup</EntryPointSymbol>
+ <EntryPointSymbol>lamexp_entry_point</EntryPointSymbol>
<MapFileName>
</MapFileName>
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
<SetChecksum>true</SetChecksum>
<TargetMachine>MachineX86</TargetMachine>
<MinimumRequiredVersion>5.0</MinimumRequiredVersion>
- <EntryPointSymbol>lamexp_crt_startup</EntryPointSymbol>
+ <EntryPointSymbol>lamexp_entry_point</EntryPointSymbol>
<GenerateMapFile>false</GenerateMapFile>
<MapFileName>
</MapFileName>
<SetChecksum>true</SetChecksum>
<TargetMachine>MachineX86</TargetMachine>
<MinimumRequiredVersion>5.0</MinimumRequiredVersion>
- <EntryPointSymbol>lamexp_crt_startup</EntryPointSymbol>
+ <EntryPointSymbol>lamexp_entry_point</EntryPointSymbol>
<GenerateMapFile>false</GenerateMapFile>
<MapFileName>
</MapFileName>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/Global.cpp" line="1059"/>
+ <location filename="../../src/Global.cpp" line="1071"/>
<source>Executable '%1' requires Qt v%2, but found Qt v%3.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/Global.cpp" line="1064"/>
+ <location filename="../../src/Global.cpp" line="1076"/>
<source>Executable '%1' was built for Qt '%2', but found Qt '%3'.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/Global.cpp" line="1077"/>
+ <location filename="../../src/Global.cpp" line="1089"/>
<source>Executable '%1' requires Windows 2000 or later.</source>
<translation type="unfinished"></translation>
</message>
<translation type="unfinished">Plik wykonywalny '%1' nie działa w trybie kompatybilności z Windows.</translation>
</message>
<message>
- <location filename="../../src/Global.cpp" line="1059"/>
+ <location filename="../../src/Global.cpp" line="1071"/>
<source>Executable '%1' requires Qt v%2, but found Qt v%3.</source>
<translation type="unfinished">Plik wykonywalny '%1' wymaga Qt v%2, znaleziono jednak Qt v%3.</translation>
</message>
<message>
- <location filename="../../src/Global.cpp" line="1064"/>
+ <location filename="../../src/Global.cpp" line="1076"/>
<source>Executable '%1' was built for Qt '%2', but found Qt '%3'.</source>
<translation type="unfinished">Plik wykonywalny "%1" został skompilowany dla Qt "%2", znaleziono "%3".</translation>
</message>
<message>
- <location filename="../../src/Global.cpp" line="1077"/>
+ <location filename="../../src/Global.cpp" line="1089"/>
<source>Executable '%1' requires Windows 2000 or later.</source>
<translation type="unfinished">Plik wykonywalny '%1' wymaga do uruchomienia Windows 2000 lub nowszego.</translation>
</message>
<translation>EXE-filen '%1' stöder inte Windows kompatibilitetsläge.</translation>
</message>
<message>
- <location filename="../../src/Global.cpp" line="1059"/>
+ <location filename="../../src/Global.cpp" line="1071"/>
<source>Executable '%1' requires Qt v%2, but found Qt v%3.</source>
<translation>EXE-filen '%1' kräver Qt v%2, du har Qt v%3.</translation>
</message>
<message>
- <location filename="../../src/Global.cpp" line="1064"/>
+ <location filename="../../src/Global.cpp" line="1076"/>
<source>Executable '%1' was built for Qt '%2', but found Qt '%3'.</source>
<translation>EXE-filen '%1' är byggd för Qt '%2', du har Qt '%3'.</translation>
</message>
<message>
- <location filename="../../src/Global.cpp" line="1077"/>
+ <location filename="../../src/Global.cpp" line="1089"/>
<source>Executable '%1' requires Windows 2000 or later.</source>
<translation>EXE-filen '%1' kräver Windows 2000 eller senare.</translation>
</message>
#define VER_LAMEXP_MINOR_LO 5
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 5
-#define VER_LAMEXP_BUILD 1040
+#define VER_LAMEXP_BUILD 1042
///////////////////////////////////////////////////////////////////////////////
// Tool versions (minimum expected versions!)
unsigned int maximumInstances = qBound(0U, m_settings->maximumInstances(), MAX_INSTANCES);
if(maximumInstances < 1)
{
- lamexp_cpu_t cpuFeatures = lamexp_detect_cpu_features();
+ lamexp_cpu_t cpuFeatures = lamexp_detect_cpu_features(lamexp_arguments());
maximumInstances = cores2instances(qBound(1, cpuFeatures.count, 64));
}
/*
* Detect CPU features
*/
-lamexp_cpu_t lamexp_detect_cpu_features(int argc, char **argv)
+lamexp_cpu_t lamexp_detect_cpu_features(const QStringList &argv)
{
typedef BOOL (WINAPI *IsWow64ProcessFun)(__in HANDLE hProcess, __out PBOOL Wow64Process);
typedef VOID (WINAPI *GetNativeSystemInfoFun)(__out LPSYSTEM_INFO lpSystemInfo);
features.x64 = true;
#endif
- if((argv != NULL) && (argc > 0))
+ if(argv.count() > 0)
{
bool flag = false;
- for(int i = 0; i < argc; i++)
+ for(int i = 0; i < argv.count(); i++)
{
- if(!_stricmp("--force-cpu-no-64bit", argv[i])) { flag = true; features.x64 = false; }
- if(!_stricmp("--force-cpu-no-sse", argv[i])) { flag = true; features.sse = features.sse2 = features.sse3 = features.ssse3 = false; }
- if(!_stricmp("--force-cpu-no-intel", argv[i])) { flag = true; features.intel = false; }
+ if(!argv[i].compare("--force-cpu-no-64bit", Qt::CaseInsensitive)) { flag = true; features.x64 = false; }
+ if(!argv[i].compare("--force-cpu-no-sse", Qt::CaseInsensitive)) { flag = true; features.sse = features.sse2 = features.sse3 = features.ssse3 = false; }
+ if(!argv[i].compare("--force-cpu-no-intel", Qt::CaseInsensitive)) { flag = true; features.intel = false; }
}
if(flag) qWarning("CPU flags overwritten by user-defined parameters. Take care!\n");
}
/*
* Check for compatibility mode
*/
-static bool lamexp_check_compatibility_mode(const char *exportName, const char *executableName)
+static bool lamexp_check_compatibility_mode(const char *exportName, const QString &executableName)
{
QLibrary kernel32("kernel32.dll");
if(kernel32.resolve(exportName) != NULL)
{
qWarning("Function '%s' exported from 'kernel32.dll' -> Windows compatibility mode!", exportName);
- qFatal("%s", QApplication::tr("Executable '%1' doesn't support Windows compatibility mode.").arg(QString::fromLatin1(executableName)).toLatin1().constData());
+ qFatal("%s", QApplication::tr("Executable '%1' doesn't support Windows compatibility mode.").arg(executableName).toLatin1().constData());
return false;
}
}
{
static bool qt_initialized = false;
typedef BOOL (WINAPI *SetDllDirectoryProc)(WCHAR *lpPathName);
+ const QStringList &arguments = lamexp_arguments();
//Don't initialized again, if done already
if(qt_initialized)
}
//Extract executable name from argv[] array
- char *executableName = argv[0];
- while(char *temp = strpbrk(executableName, "\\/:?"))
+ QString executableName = QLatin1String("LameXP.exe");
+ if(arguments.count() > 0)
{
- executableName = temp + 1;
+ static const char *delimiters = "\\/:?";
+ executableName = arguments[0].trimmed();
+ for(int i = 0; delimiters[i]; i++)
+ {
+ int temp = executableName.lastIndexOf(QChar(delimiters[i]));
+ if(temp >= 0) executableName = executableName.mid(temp + 1);
+ }
+ executableName = executableName.trimmed();
+ if(executableName.isEmpty())
+ {
+ executableName = QLatin1String("LameXP.exe");
+ }
}
//Check Qt version
qDebug("Compiled with Qt v%s [%s], %s\n", QT_VERSION_STR, QT_PACKAGEDATE_STR, QT_BUILD_KEY);
if(_stricmp(qVersion(), QT_VERSION_STR))
{
- qFatal("%s", QApplication::tr("Executable '%1' requires Qt v%2, but found Qt v%3.").arg(QString::fromLatin1(executableName), QString::fromLatin1(QT_VERSION_STR), QString::fromLatin1(qVersion())).toLatin1().constData());
+ qFatal("%s", QApplication::tr("Executable '%1' requires Qt v%2, but found Qt v%3.").arg(executableName, QString::fromLatin1(QT_VERSION_STR), QString::fromLatin1(qVersion())).toLatin1().constData());
return false;
}
if(QLibraryInfo::buildKey().compare(QString::fromLatin1(QT_BUILD_KEY), Qt::CaseInsensitive))
{
- qFatal("%s", QApplication::tr("Executable '%1' was built for Qt '%2', but found Qt '%3'.").arg(QString::fromLatin1(executableName), QString::fromLatin1(QT_BUILD_KEY), QLibraryInfo::buildKey()).toLatin1().constData());
+ qFatal("%s", QApplication::tr("Executable '%1' was built for Qt '%2', but found Qt '%3'.").arg(executableName, QString::fromLatin1(QT_BUILD_KEY), QLibraryInfo::buildKey()).toLatin1().constData());
return false;
}
#else
{
case 0:
case QSysInfo::WV_NT:
- qFatal("%s", QApplication::tr("Executable '%1' requires Windows 2000 or later.").arg(QString::fromLatin1(executableName)).toLatin1().constData());
+ qFatal("%s", QApplication::tr("Executable '%1' requires Windows 2000 or later.").arg(executableName).toLatin1().constData());
break;
case QSysInfo::WV_2000:
qDebug("Running on Windows 2000 (not officially supported!).\n");
}
/*
+ * Application entry point (runs before static initializers)
+ */
+extern "C"
+{
+ int WinMainCRTStartup(void);
+
+ int lamexp_entry_point(void)
+ {
+ if((!LAMEXP_DEBUG) && lamexp_check_for_debugger())
+ {
+ FatalAppExit(0, L"Not a debug build. Please unload debugger and try again!");
+ TerminateProcess(GetCurrentProcess(), -1);
+ }
+ return WinMainCRTStartup();
+ }
+}
+
+/*
* Finalization function (final clean-up)
*/
void lamexp_finalization(void)
const QString &lamexp_temp_folder2(void);
void lamexp_ipc_read(unsigned int *command, char* message, size_t buffSize);
void lamexp_ipc_send(unsigned int command, const char* message);
-lamexp_cpu_t lamexp_detect_cpu_features(int argc = 0, char **argv = NULL);
+lamexp_cpu_t lamexp_detect_cpu_features(const QStringList &argv);
bool lamexp_portable_mode(void);
bool lamexp_shutdown_computer(const QString &message, const unsigned long timeout = 30, const bool forceShutdown = true, const bool hibernate = false);
bool lamexp_is_hibernation_supported(void);
qDebug("");
//Detect CPU capabilities
- lamexp_cpu_t cpuFeatures = lamexp_detect_cpu_features(argc, argv);
+ lamexp_cpu_t cpuFeatures = lamexp_detect_cpu_features(arguments);
qDebug(" CPU vendor id : %s (Intel: %s)", cpuFeatures.vendor, LAMEXP_BOOL(cpuFeatures.intel));
qDebug("CPU brand string : %s", cpuFeatures.brand);
qDebug(" CPU signature : Family: %d, Model: %d, Stepping: %d", cpuFeatures.family, cpuFeatures.model, cpuFeatures.stepping);
//Kill application?
for(int i = 0; i < argc; i++)
{
- if(!_stricmp("--kill", argv[i]) || !_stricmp("--force-kill", argv[i]))
+ if(!arguments[i].compare("--kill", Qt::CaseInsensitive) || !arguments[i].compare("--force-kill", Qt::CaseInsensitive))
{
return 0;
}
}
}
}
-
-///////////////////////////////////////////////////////////////////////////////
-// CRT initialization
-///////////////////////////////////////////////////////////////////////////////
-
-extern "C"
-{
- int WinMainCRTStartup(void);
-
- int lamexp_crt_startup(void)
- {
- return WinMainCRTStartup();
- }
-}