Fixed detection of 64-Bit VapourSynth when 32-Bit VapourSynth is *not* installed (only relevant for 64-Bit Windows) + use registry functions from MUtils library.

This commit is contained in:
LoRd_MuldeR 2016-03-11 19:08:29 +01:00
parent 5af1d81b03
commit ff27a265da
5 changed files with 34 additions and 28 deletions

View File

@ -2,6 +2,10 @@
Simple x264/x265 Launcher version history Simple x264/x265 Launcher version history
----------------------------------------- -----------------------------------------
Version 2.67 [2016-03-??]
* Updated x265 to version 1.9+88
* Fixed detection of 64-Bit VapourSynth in certain cases
Version 2.66 [2016-02-06] Version 2.66 [2016-02-06]
* Updated x265 to version 1.9+3 * Updated x265 to version 1.9+3

View File

@ -293,28 +293,6 @@ QString x264_path2ansi(const QString &longPath, bool makeLowercase)
return shortPath; return shortPath;
} }
/*
* Read value from registry
*/
QString x264_query_reg_string(const bool bUser, const QString &path, const QString &name)
{
QString result; HKEY hKey = NULL;
if(RegOpenKey((bUser ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE), MUTILS_WCHR(path), &hKey) == ERROR_SUCCESS)
{
const size_t DATA_LEN = 2048; wchar_t data[DATA_LEN];
DWORD type = REG_NONE, size = sizeof(wchar_t) * DATA_LEN;
if(RegQueryValueEx(hKey, MUTILS_WCHR(name), NULL, &type, ((BYTE*)&data[0]), &size) == ERROR_SUCCESS)
{
if((type == REG_SZ) || (type == REG_EXPAND_SZ))
{
result = MUTILS_QSTR(&data[0]);
}
}
RegCloseKey(hKey);
}
return result;
}
/* /*
* Inform the system that it is in use, thereby preventing the system from entering sleep * Inform the system that it is in use, thereby preventing the system from entering sleep
*/ */

View File

@ -42,7 +42,6 @@ class QProcess;
//Utility functions //Utility functions
const QString &x264_data_path(void); const QString &x264_data_path(void);
QString x264_path2ansi(const QString &longPath, bool makeLowercase = false); QString x264_path2ansi(const QString &longPath, bool makeLowercase = false);
QString x264_query_reg_string(const bool bUser, const QString &path, const QString &name);
bool x264_set_thread_execution_state(const bool systemRequired); bool x264_set_thread_execution_state(const bool systemRequired);
//Version getters //Version getters

View File

@ -23,6 +23,7 @@
//Mutils //Mutils
#include <MUtils/OSSupport.h> #include <MUtils/OSSupport.h>
#include <MUtils/Registry.h>
//Qt //Qt
#include <QLibrary> #include <QLibrary>
@ -186,6 +187,12 @@ void VapourSynthCheckThread::detectVapourSynthPath3(int &success, QString &path)
"Inno Setup: App Path", "Inno Setup: App Path",
NULL NULL
}; };
static const MUtils::Registry::reg_scope_t REG_SCOPE[3] =
{
MUtils::Registry::scope_default,
MUtils::Registry::scope_wow_x32,
MUtils::Registry::scope_wow_x64
};
//Read VapourSynth path from registry //Read VapourSynth path from registry
QString vapoursynthPath; QString vapoursynthPath;
@ -193,10 +200,28 @@ void VapourSynthCheckThread::detectVapourSynthPath3(int &success, QString &path)
{ {
for(size_t j = 0; VPS_REG_NAME[j]; j++) for(size_t j = 0; VPS_REG_NAME[j]; j++)
{ {
vapoursynthPath = cleanDir(x264_query_reg_string(false, VPS_REG_KEYS[i], VPS_REG_NAME[j])); for (size_t k = 0; k < 3; k++)
if(VALID_DIR(vapoursynthPath)) break; {
QString temp;
if (MUtils::Registry::reg_value_read(MUtils::Registry::root_machine, QString::fromLatin1(VPS_REG_KEYS[i]), QString::fromLatin1(VPS_REG_NAME[j]), temp, REG_SCOPE[k]))
{
temp = cleanDir(temp);
if (VALID_DIR(temp))
{
vapoursynthPath = temp;
break;
}
}
}
if (!vapoursynthPath.isEmpty())
{
break;
}
}
if (!vapoursynthPath.isEmpty())
{
break;
} }
if(VALID_DIR(vapoursynthPath)) break;
} }
//Make sure VapourSynth does exist //Make sure VapourSynth does exist

View File

@ -25,8 +25,8 @@
#define VER_X264_MAJOR 2 #define VER_X264_MAJOR 2
#define VER_X264_MINOR 6 #define VER_X264_MINOR 6
#define VER_X264_PATCH 6 #define VER_X264_PATCH 7
#define VER_X264_BUILD 1012 #define VER_X264_BUILD 1014
#define VER_X264_PORTABLE_EDITION (0) #define VER_X264_PORTABLE_EDITION (0)