From ff27a265da55ad67403a21ecb2ac166034a0771b Mon Sep 17 00:00:00 2001 From: lordmulder Date: Fri, 11 Mar 2016 19:08:29 +0100 Subject: [PATCH] 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. --- HISTORY.txt | 4 ++++ src/global.cpp | 22 ---------------------- src/global.h | 1 - src/thread_vapoursynth.cpp | 31 ++++++++++++++++++++++++++++--- src/version.h | 4 ++-- 5 files changed, 34 insertions(+), 28 deletions(-) diff --git a/HISTORY.txt b/HISTORY.txt index 839c3f6..7350bf9 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -2,6 +2,10 @@ 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] * Updated x265 to version 1.9+3 diff --git a/src/global.cpp b/src/global.cpp index 73170c9..f1f33a3 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -294,28 +294,6 @@ QString x264_path2ansi(const QString &longPath, bool makeLowercase) } /* - * 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 */ bool x264_set_thread_execution_state(const bool systemRequired) diff --git a/src/global.h b/src/global.h index 979e717..81ae32f 100644 --- a/src/global.h +++ b/src/global.h @@ -42,7 +42,6 @@ class QProcess; //Utility functions const QString &x264_data_path(void); 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); //Version getters diff --git a/src/thread_vapoursynth.cpp b/src/thread_vapoursynth.cpp index df2de79..e3991de 100644 --- a/src/thread_vapoursynth.cpp +++ b/src/thread_vapoursynth.cpp @@ -23,6 +23,7 @@ //Mutils #include +#include //Qt #include @@ -186,6 +187,12 @@ void VapourSynthCheckThread::detectVapourSynthPath3(int &success, QString &path) "Inno Setup: App Path", 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 QString vapoursynthPath; @@ -193,10 +200,28 @@ void VapourSynthCheckThread::detectVapourSynthPath3(int &success, QString &path) { 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])); - if(VALID_DIR(vapoursynthPath)) break; + for (size_t k = 0; k < 3; k++) + { + 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 diff --git a/src/version.h b/src/version.h index 4538e8f..8941966 100644 --- a/src/version.h +++ b/src/version.h @@ -25,8 +25,8 @@ #define VER_X264_MAJOR 2 #define VER_X264_MINOR 6 -#define VER_X264_PATCH 6 -#define VER_X264_BUILD 1012 +#define VER_X264_PATCH 7 +#define VER_X264_BUILD 1014 #define VER_X264_PORTABLE_EDITION (0) -- 2.11.4.GIT