Start PowerToys Run through the ActionRunner (#12043)

This commit is contained in:
Mykhailo Pylyp
2021-07-01 12:26:58 +03:00
committed by GitHub
parent 086394d455
commit b42eb08ec6
2 changed files with 14 additions and 11 deletions

View File

@@ -307,25 +307,17 @@ inline bool run_non_elevated(const std::wstring& file, const std::wstring& param
inline bool RunNonElevatedEx(const std::wstring& file, const std::wstring& params)
{
bool failedToStart = false;
try
{
CoInitialize(nullptr);
if (!ShellExecuteFromExplorer(file.c_str(), params.c_str()))
{
failedToStart = true;
return false;
}
}
catch(...)
{
failedToStart = true;
}
if (failedToStart)
{
Logger::warn(L"Failed to delegate process creation. Try a fallback");
DWORD returnPid;
return run_non_elevated(file, params, &returnPid);
return false;
}
return true;