From 574abc7cdbb90427431ad68fba0ea1b3a69edc36 Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Sun, 14 Sep 2014 21:07:20 +0300 Subject: [PATCH] WINDOWS: Don't create keys in the registry if python isn't found. Closes #1370. --- src/preferences/preferences.cpp | 106 +++++++++++++++++++++++++++----- 1 file changed, 90 insertions(+), 16 deletions(-) diff --git a/src/preferences/preferences.cpp b/src/preferences/preferences.cpp index c4ddd3ee8..d89f4e46d 100644 --- a/src/preferences/preferences.cpp +++ b/src/preferences/preferences.cpp @@ -47,6 +47,7 @@ #ifdef Q_OS_WIN #include +#include #endif #include "misc.h" @@ -55,7 +56,6 @@ Preferences* Preferences::m_instance = 0; - Preferences::Preferences() : dirty(false), lock(QReadWriteLock::Recursive) { QIniSettings *settings = new QIniSettings; #ifndef Q_OS_MAC @@ -1339,29 +1339,103 @@ void Preferences::disableRecursiveDownload(bool disable) { } #ifdef Q_OS_WIN +namespace { +QStringList getRegSubkeys(const HKEY &handle) { + QStringList keys; + DWORD subkeys_count = 0; + DWORD max_subkey_len = 0; + long res = ::RegQueryInfoKey(handle, NULL, NULL, NULL, &subkeys_count, &max_subkey_len, NULL, NULL, NULL, NULL, NULL, NULL); + if (res == ERROR_SUCCESS) { + max_subkey_len++; //For null character + LPTSTR key_name = new TCHAR[max_subkey_len]; + + for (uint i=0; i