From 5d0b834efec950c0d09efb22fab82a059729b03d Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 20 Oct 2018 18:32:10 -0700 Subject: [PATCH] Initialize COM before ShellExecute() --- mist/mist.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mist/mist.cpp b/mist/mist.cpp index f282a29..a2ed411 100644 --- a/mist/mist.cpp +++ b/mist/mist.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #pragma comment(lib, "miniupnpc.lib") #pragma comment(lib, "libnatpmp.lib") @@ -96,7 +97,9 @@ void DisplayMessage(const char* message, bool error = true) "Moonlight Internet Streaming Tester", flags)) { case IDYES: - ShellExecuteA(nullptr, "open", logFilePath, nullptr, nullptr, SW_SHOW); + // It's recommended to initialize COM before calling ShellExecute() + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); + ShellExecuteA(nullptr, "open", logFilePath, nullptr, nullptr, SW_SHOWNORMAL); break; } }