From 0dcb65d57587b0507eedb5b6b4388bb96fc21ce5 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 17 Jun 2013 12:05:55 +0200 Subject: Check return value of ShellExecuteExW instead of GetLastError It's unclear from the MSDN documentation whether LastError is also set if ShellExecuteEx succeeds. Therefore rather check for the return value. Task-number: QTBUG-31788 Change-Id: Id74377445c5e64a056d4f1c0ec6ae29b02a0d98e Reviewed-by: Karsten Heimrich --- src/libs/installer/adminauthorization_win.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/libs') diff --git a/src/libs/installer/adminauthorization_win.cpp b/src/libs/installer/adminauthorization_win.cpp index d162f9d2d..5337747fc 100644 --- a/src/libs/installer/adminauthorization_win.cpp +++ b/src/libs/installer/adminauthorization_win.cpp @@ -139,9 +139,8 @@ bool AdminAuthorization::execute(QWidget *, const QString &program, const QStrin shellExecuteInfo.lpParameters = (wchar_t *)args.utf16(); qDebug() << QString::fromLatin1("Starting elevated process %1 with arguments: %2.").arg(file, args); - ShellExecuteExW(&shellExecuteInfo); - if (GetLastError() == ERROR_SUCCESS) { + if (ShellExecuteExW(&shellExecuteInfo)) { qDebug() << "Finished starting elevated process."; return true; } else { -- cgit v1.2.3