From 3c8f8f1ffcc0669b0a31aca0f6fa138606bfa061 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint
Date: Thu, 20 Sep 2018 08:39:59 +0200
Subject: qtcdebugger: Extend help text
Factor out a helper function to read out the current debugger.
Display the currently registered debugger and the Qt version used in the
help. Enable copying the message box text.
This offers a convenient way of checking since the debugger settings often
get overwritten by OS or MSVC updates.
Change-Id: If61e30ae22802b71960cb6f3da96100f5fd9e47c
Reviewed-by: Eike Ziller
Reviewed-by: hjk
Reviewed-by: David Schulz
---
src/tools/qtcdebugger/main.cpp | 48 ++++++++++++++++++++++++++----------------
1 file changed, 30 insertions(+), 18 deletions(-)
(limited to 'src/tools')
diff --git a/src/tools/qtcdebugger/main.cpp b/src/tools/qtcdebugger/main.cpp
index 7453c08afc..38507c8539 100644
--- a/src/tools/qtcdebugger/main.cpp
+++ b/src/tools/qtcdebugger/main.cpp
@@ -35,6 +35,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -138,6 +139,26 @@ static bool parseArguments(const QStringList &args, QString *errorMessage)
return true;
}
+static bool readDebugger(const wchar_t *key, QString *debugger,
+ QString *errorMessage)
+{
+ bool success = false;
+ HKEY handle;
+ const RegistryAccess::AccessMode accessMode = optIsWow
+#ifdef Q_OS_WIN64
+ ? RegistryAccess::Registry32Mode
+#else
+ ? RegistryAccess::Registry64Mode
+#endif
+ : RegistryAccess::DefaultAccessMode;
+
+ if (openRegistryKey(HKEY_LOCAL_MACHINE, debuggerRegistryKeyC, false, &handle, accessMode, errorMessage)) {
+ success = registryReadStringKey(handle, key, debugger, errorMessage);
+ RegCloseKey(handle);
+ }
+ return success;
+}
+
static void usage(const QString &binary, const QString &message = QString())
{
QString msg;
@@ -170,10 +191,16 @@ static void usage(const QString &binary, const QString &message = QString())
<< "On 64-bit systems, do the same for the key HKEY_LOCAL_MACHINE\\" << wCharToQString(debuggerWow32RegistryKeyC) << ", "
<< "setting the new value to
\"" << QDir::toNativeSeparators(binary) << "\" -wow %ld %ld
"
<< "How to run a command with administrative privileges:
"
- << "runas /env /noprofile /user:Administrator \"command arguments\"
"
- << "