Skip to content
Browse files

Work around Windows permissions preventing Mumble restart

Mumble fails to restart itself when asked to do so from the configuration menu.
This failure is handled correctly and the shutdown in general is clean.

This is because we run with uiaccess=true resulting in the normal
QProcess::startDetached failing with the following in the windows
error log: "The process failed to handle ERROR_ELEVATION_REQUIRED
during the creation of a child process."

QProcess doesn't correctly consider windows permissions when performing
launch operations as can be seen in QTBUG-7645 so we have to work
around this ourselves. As we do not need full admin privileges and
do not want the user to be prompted use the ShellExecuteEx function
which transparently acquires the needed permissions.

Fixes #1747
  • Loading branch information...
hacst committed Jul 24, 2015
1 parent 9797e92 commit 459022deeea3b6dfea54af07791b0e73327e1f11
Showing with 21 additions and 1 deletion.
  1. +21 −1 src/mumble/main.cpp
@@ -559,7 +559,27 @@ int main(int argc, char **argv) {

qWarning() << "Triggering restart of Mumble with arguments: " << arguments;

if(!QProcess::startDetached(qApp->applicationFilePath(), arguments)) {
#ifdef Q_OS_WIN
// Work around bug related to QTBUG-7645. Mumble has uiaccess=true set
// on windows which makes normal CreateProcess calls (like Qt uses in
// startDetached) fail unless they specifically enable additional priviledges.
// Note that we do not actually require user interaction by UAC nor full admin
// rights but only the right token on launch. Here we use ShellExecuteEx
// which handles this transparently for us.
const std::wstring applicationFilePath = qApp->applicationFilePath().toStdWString();
const std::wstring argumentsString = arguments.join(QLatin1String(" ")).toStdWString();

ZeroMemory(&si, sizeof(SHELLEXECUTEINFO));
si.cbSize = sizeof(SHELLEXECUTEINFO);
si.lpFile =;
si.lpParameters =;

bool ok = (ShellExecuteEx(&si) == TRUE);
bool ok = QProcess::startDetached(qApp->applicationFilePath(), arguments)
if(!ok) {
QApplication::tr("Failed to restart mumble"),
QApplication::tr("Mumble failed to restart itself. Please restart it manually.")

0 comments on commit 459022d

Please sign in to comment.
You can’t perform that action at this time.