mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
Missing CoUninitialize (#27732)
This commit is contained in:
@@ -331,20 +331,19 @@ inline bool run_non_elevated(const std::wstring& file, const std::wstring& param
|
|||||||
|
|
||||||
inline bool RunNonElevatedEx(const std::wstring& file, const std::wstring& params, const std::wstring& working_dir)
|
inline bool RunNonElevatedEx(const std::wstring& file, const std::wstring& params, const std::wstring& working_dir)
|
||||||
{
|
{
|
||||||
|
bool success = false;
|
||||||
|
HRESULT co_init = E_FAIL;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CoInitialize(nullptr);
|
co_init = CoInitialize(nullptr);
|
||||||
if (!ShellExecuteFromExplorer(file.c_str(), params.c_str(), working_dir.c_str()))
|
success = ShellExecuteFromExplorer(file.c_str(), params.c_str(), working_dir.c_str());
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
if (SUCCEEDED(co_init)) CoUninitialize();
|
||||||
|
|
||||||
return true;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ProcessInfo
|
struct ProcessInfo
|
||||||
|
|||||||
Reference in New Issue
Block a user