From ee45c39d65ba8eeb3d04260bf21a26ea2ca8b958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Sto=C5=A1i=C4=87?= Date: Wed, 17 Feb 2021 11:36:39 +0100 Subject: [PATCH] Fix Runner stealing shortcuts on older Win10 (#9744) --- .../launcher/Microsoft.Launcher/dllmain.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/modules/launcher/Microsoft.Launcher/dllmain.cpp b/src/modules/launcher/Microsoft.Launcher/dllmain.cpp index c92338de24..1c590cf622 100644 --- a/src/modules/launcher/Microsoft.Launcher/dllmain.cpp +++ b/src/modules/launcher/Microsoft.Launcher/dllmain.cpp @@ -202,9 +202,16 @@ public: sei.lpFile = L"modules\\launcher\\PowerLauncher.exe"; sei.nShow = SW_SHOWNORMAL; sei.lpParameters = executable_args.data(); - ShellExecuteExW(&sei); - - m_hProcess = sei.hProcess; + + if (ShellExecuteExW(&sei)) + { + m_enabled = true; + m_hProcess = sei.hProcess; + } + else + { + Logger::error("Launcher failed to start"); + } } else { @@ -231,6 +238,7 @@ public: if (run_non_elevated(action_runner_path, params, pidBuffer)) { + m_enabled = true; const int maxRetries = 80; for (int retry = 0; retry < maxRetries; ++retry) { @@ -248,8 +256,6 @@ public: } } } - - m_enabled = true; } // Disable the powertoy