Some more Wine workarounds: Disable x64 binaries, as it seems they fail to load under Wine (tested with Wine 1.4 under Ubuntu 12.04 x64).

This commit is contained in:
LoRd_MuldeR 2012-04-05 13:40:52 +02:00
parent 6adb7b94e7
commit cdf300cd22
5 changed files with 60 additions and 32 deletions

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 4
#define VER_LAMEXP_TYPE Beta
#define VER_LAMEXP_PATCH 12
#define VER_LAMEXP_BUILD 950
#define VER_LAMEXP_BUILD 951
///////////////////////////////////////////////////////////////////////////////
// Tool versions (minimum expected versions!)

View File

@ -342,21 +342,48 @@ const QDate &lamexp_version_date(void)
*/
DWORD lamexp_get_os_version(void)
{
OSVERSIONINFO osVerInfo;
memset(&osVerInfo, 0, sizeof(OSVERSIONINFO));
osVerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
DWORD version = 0;
static DWORD osVersion = 0;
if(GetVersionEx(&osVerInfo) == TRUE)
if(!osVersion)
{
if(osVerInfo.dwPlatformId != VER_PLATFORM_WIN32_NT)
OSVERSIONINFO osVerInfo;
memset(&osVerInfo, 0, sizeof(OSVERSIONINFO));
osVerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if(GetVersionEx(&osVerInfo) == TRUE)
{
throw "Ouuups: Not running under Windows NT. This is not supposed to happen!";
if(osVerInfo.dwPlatformId != VER_PLATFORM_WIN32_NT)
{
throw "Ouuups: Not running under Windows NT. This is not supposed to happen!";
}
osVersion = (DWORD)((osVerInfo.dwMajorVersion << 16) | (osVerInfo.dwMinorVersion & 0xffff));
}
version = (DWORD)((osVerInfo.dwMajorVersion << 16) | (osVerInfo.dwMinorVersion & 0xffff));
}
return version;
return osVersion;
}
/*
* Check if we are running under wine
*/
bool lamexp_detect_wine(void)
{
static bool isWine = false;
static bool isWine_initialized = false;
if(!isWine_initialized)
{
QLibrary ntdll("ntdll.dll");
if(ntdll.load())
{
if(ntdll.resolve("wine_nt_to_unix_file_name") != NULL) isWine = true;
if(ntdll.resolve("wine_get_version") != NULL) isWine = true;
ntdll.unload();
}
isWine_initialized = true;
}
return isWine;
}
/*
@ -978,7 +1005,6 @@ static bool lamexp_check_elevation(void)
bool lamexp_init_qt(int argc, char* argv[])
{
static bool qt_initialized = false;
bool isWine = false;
typedef BOOL (WINAPI *SetDllDirectoryProc)(WCHAR *lpPathName);
//Don't initialized again, if done already
@ -1053,15 +1079,12 @@ bool lamexp_init_qt(int argc, char* argv[])
}
//Check for Wine
QLibrary ntdll("ntdll.dll");
if(ntdll.load())
if(lamexp_detect_wine())
{
if(ntdll.resolve("wine_nt_to_unix_file_name") != NULL) isWine = true;
if(ntdll.resolve("wine_get_version") != NULL) isWine = true;
if(isWine) qWarning("It appears we are running under Wine, unexpected things might happen!\n");
ntdll.unload();
qWarning("It appears we are running under Wine, unexpected things might happen!\n");
}
//Create Qt application instance and setup version info
QApplication *application = new QApplication(argc, argv);
application->setApplicationName("LameXP - Audio Encoder Front-End");
@ -1103,7 +1126,7 @@ bool lamexp_init_qt(int argc, char* argv[])
}
//Update console icon, if a console is attached
if(g_lamexp_console_attached && !isWine)
if(g_lamexp_console_attached && (!lamexp_detect_wine()))
{
typedef DWORD (__stdcall *SetConsoleIconFun)(HICON);
QLibrary kernel32("kernel32.dll");

View File

@ -98,6 +98,7 @@ unsigned int lamexp_toolver_coreaudio(void);
const char *lamexp_website_url(void);
const char *lamexp_support_url(void);
DWORD lamexp_get_os_version(void);
bool lamexp_detect_wine(void);
//Public functions
void lamexp_init_console(int argc, char* argv[]);

View File

@ -240,10 +240,13 @@ bool QFileSystemModelEx::hasSubfolders(const QString &path)
{
if(!FindFirstFileExInitialized)
{
QLibrary Kernel32Lib("kernel32.dll");
FindFirstFileExPtr = Kernel32Lib.resolve("FindFirstFileExW");
DWORD osVersionNo = lamexp_get_os_version();
FindFirstFileExInfoBasicOK = LAMEXP_MIN_OS_VER(osVersionNo, 6, 1);
QLibrary kernel32Lib("kernel32.dll");
if(kernel32Lib.load())
{
FindFirstFileExPtr = kernel32Lib.resolve("FindFirstFileExW");
DWORD osVersionNo = lamexp_get_os_version();
FindFirstFileExInfoBasicOK = LAMEXP_MIN_OS_VER(osVersionNo, 6, 1);
}
FindFirstFileExInitialized = true;
}

View File

@ -75,16 +75,17 @@ void InitializationThread::run()
cpuSupport = m_cpuFeatures.x64 ? CPU_TYPE_X64_GEN : CPU_TYPE_X86_GEN;
}
//Hack to disable x64 on the Windows 8 Developer Preview (not required anymore)
//if(cpuSupport & CPU_TYPE_X64_ALL)
//{
// DWORD osVerNo = lamexp_get_os_version();
// if((HIWORD(osVerNo) == 6) && (LOWORD(osVerNo) == 2))
// {
// qWarning("Windows 8 (x64) developer preview detected. Going to disable all x64 support!\n");
// cpuSupport = (cpuSupport == CPU_TYPE_X64_SSE) ? CPU_TYPE_X86_SSE : CPU_TYPE_X86_GEN;
// }
//}
//Hack to disable x64 on Wine, as x64 binaries won't run under Wine (tested with Wine 1.4 under Ubuntu 12.04 x64)
if(cpuSupport & CPU_TYPE_X64_ALL)
{
//DWORD osVerNo = lamexp_get_os_version();
//if((HIWORD(osVerNo) == 6) && (LOWORD(osVerNo) == 2))
if(lamexp_detect_wine())
{
qWarning("Running under Wine on a 64-Bit system. Going to disable all x64 support!\n");
cpuSupport = (cpuSupport == CPU_TYPE_X64_SSE) ? CPU_TYPE_X86_SSE : CPU_TYPE_X86_GEN;
}
}
//Print selected CPU type
switch(cpuSupport)