Updater: Add missing CoInitializeEx() call
This commit is contained in:
parent
d8bf0c81a7
commit
d9b1d39638
|
@ -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)
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||||
|
|
||||||
#include "updater.h"
|
#include "updater.h"
|
||||||
|
@ -7,9 +7,11 @@
|
||||||
#include "common/file_system.h"
|
#include "common/file_system.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include "common/path.h"
|
#include "common/path.h"
|
||||||
|
#include "common/scoped_guard.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "common/windows_headers.h"
|
#include "common/windows_headers.h"
|
||||||
|
|
||||||
|
#include <combaseapi.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
|
||||||
static void WaitForProcessToExit(int process_id)
|
static void WaitForProcessToExit(int process_id)
|
||||||
|
@ -26,6 +28,12 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
|
||||||
{
|
{
|
||||||
Win32ProgressCallback progress;
|
Win32ProgressCallback progress;
|
||||||
|
|
||||||
|
const bool com_initialized = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||||
|
const ScopedGuard com_guard = [com_initialized]() {
|
||||||
|
if (com_initialized)
|
||||||
|
CoUninitialize();
|
||||||
|
};
|
||||||
|
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
LPWSTR* argv = CommandLineToArgvW(lpCmdLine, &argc);
|
LPWSTR* argv = CommandLineToArgvW(lpCmdLine, &argc);
|
||||||
if (!argv || argc <= 0)
|
if (!argv || argc <= 0)
|
||||||
|
|
Loading…
Reference in New Issue