diff options
author | kh1 <karsten.heimrich@digia.com> | 2013-11-01 15:16:52 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@digia.com> | 2013-11-06 13:07:06 +0100 |
commit | 113c0e0450b09816aaa43e26f9646e594533b33c (patch) | |
tree | c5d205ba4b9198246984c9b07469df547c2b6aad /src/libs/installer/environmentvariablesoperation.cpp | |
parent | 902a1cad328d5877f8086a19d28c26cdf7e485e9 (diff) |
Environment variables changes are not propagated to the system.
Note: we already used the Unicode version of the function call,
though without passing the right LPARAM. Might fix the issue...
Task-number: QTIFW-391
Change-Id: I28e0afd45ea7e4d1b904dcf8357fc990dec6767a
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
Diffstat (limited to 'src/libs/installer/environmentvariablesoperation.cpp')
-rw-r--r-- | src/libs/installer/environmentvariablesoperation.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/libs/installer/environmentvariablesoperation.cpp b/src/libs/installer/environmentvariablesoperation.cpp index e66c6fc0d..36b5d6273 100644 --- a/src/libs/installer/environmentvariablesoperation.cpp +++ b/src/libs/installer/environmentvariablesoperation.cpp @@ -67,19 +67,15 @@ void EnvironmentVariableOperation::backup() } #ifdef Q_OS_WIN -static bool broadcastChange() { +static void broadcastEnvironmentChange() +{ // Use SendMessageTimeout to Broadcast a message to the whole system to update settings of all // running applications. This is needed to activate the changes done above without logout+login. - // Note that cmd.exe does not respond to any WM_SETTINGCHANGE messages... DWORD_PTR aResult = 0; - LRESULT sendresult = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, - 0, (LPARAM) "Environment", SMTO_BLOCK | SMTO_ABORTIFHUNG, 5000, &aResult); - if (sendresult == 0 || aResult != 0) { - qWarning("Failed to broadcast a WM_SETTINGCHANGE message\n"); - return false; - } - - return true; + LRESULT sendresult = SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, + 0, (LPARAM) L"Environment", SMTO_BLOCK | SMTO_ABORTIFHUNG, 5000, &aResult); + if (sendresult == 0 || aResult != 0) + qWarning("Failed to broadcast the WM_SETTINGCHANGE message."); } #endif @@ -169,8 +165,9 @@ bool EnvironmentVariableOperation::performOperation() setErrorString(errorString); return false; } - const bool bret = broadcastChange(); - Q_UNUSED(bret); // this is not critical, so fall-through + + broadcastEnvironmentChange(); + setValue(QLatin1String("oldvalue"), oldvalue); return true; } |