Skip to content

Commit

Permalink
Use wil::CoInitializeEx
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbymcr committed Jun 24, 2023
1 parent 3b7288c commit 3ae6ee9
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/tasksched/exe/main.cpp
Expand Up @@ -11,8 +11,6 @@
#include <wil/resource.h>
#include <wil/win32_helpers.h>

using unique_couninitialize_call = wil::unique_call<decltype(&::CoUninitialize), ::CoUninitialize>;

int run()
{
// Print every log message to standard out.
Expand All @@ -27,17 +25,10 @@ int run()

// ------------------------------------------------------
// Initialize COM.
HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
if (FAILED(hr))
{
printf("\nCoInitializeEx failed: %x", hr);
return 1;
}

unique_couninitialize_call cleanup;
auto cleanup = wil::CoInitializeEx(COINIT_MULTITHREADED);

// Set general COM security levels.
hr = CoInitializeSecurity(
HRESULT hr = CoInitializeSecurity(
nullptr,
-1,
nullptr,
Expand Down

0 comments on commit 3ae6ee9

Please sign in to comment.