summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess_win.cpp
diff options
context:
space:
mode:
authorStephan Reiter <stephan.reiter@gmail.com>2017-02-17 20:40:19 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-02-22 07:47:18 +0000
commit1d44b6bedbc50c565487fbda6564f3e81c5d4bd0 (patch)
tree06895fefc2600026f0c03e2ece818fb0cfa9b752 /src/corelib/io/qprocess_win.cpp
parentdab01380434c60e088c5c8e7416b35e867e8733f (diff)
QProcess::startDetached(): Support privilege elevation for non-.exe files
Pass classname 'exefile' to ShellExecuteEx() for UAC prompt. This allows running executable files that do not have a .exe extension. Task-number: QTBUG-59008 Change-Id: I88d669481e893db50edccd7b30259e5366477556 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/corelib/io/qprocess_win.cpp')
-rw-r--r--src/corelib/io/qprocess_win.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index 8579db1694..d0e922bf2b 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -841,7 +841,8 @@ static bool startDetachedUacPrompt(const QString &programIn, const QStringList &
SHELLEXECUTEINFOW shellExecuteExInfo;
memset(&shellExecuteExInfo, 0, sizeof(SHELLEXECUTEINFOW));
shellExecuteExInfo.cbSize = sizeof(SHELLEXECUTEINFOW);
- shellExecuteExInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_UNICODE | SEE_MASK_FLAG_NO_UI;
+ shellExecuteExInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_UNICODE | SEE_MASK_FLAG_NO_UI | SEE_MASK_CLASSNAME;
+ shellExecuteExInfo.lpClass = L"exefile";
shellExecuteExInfo.lpVerb = L"runas";
const QString program = QDir::toNativeSeparators(programIn);
shellExecuteExInfo.lpFile = reinterpret_cast<LPCWSTR>(program.utf16());