Updater: Add missing CoInitializeEx() call

This commit is contained in:
Stenzek 2024-04-05 20:02:39 +10:00
parent d8bf0c81a7
commit d9b1d39638
No known key found for this signature in database
1 changed files with 9 additions and 1 deletions

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "updater.h"
@ -7,9 +7,11 @@
#include "common/file_system.h"
#include "common/log.h"
#include "common/path.h"
#include "common/scoped_guard.h"
#include "common/string_util.h"
#include "common/windows_headers.h"
#include <combaseapi.h>
#include <shellapi.h>
static void WaitForProcessToExit(int process_id)
@ -26,6 +28,12 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
{
Win32ProgressCallback progress;
const bool com_initialized = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
const ScopedGuard com_guard = [com_initialized]() {
if (com_initialized)
CoUninitialize();
};
int argc = 0;
LPWSTR* argv = CommandLineToArgvW(lpCmdLine, &argc);
if (!argv || argc <= 0)