blob: ab7da0a1b6c397f018f7c0e1ff7197feba228e05 [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <windows.h>
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/process/memory.h"
#include "base/win/process_startup_helper.h"
#include "base/win/scoped_winrt_initializer.h"
#include "chrome/install_static/product_install_details.h"
#include "notification_helper/com_server_module.h"
#include "notification_helper/trace_util.h"
extern "C" int WINAPI wWinMain(HINSTANCE instance,
HINSTANCE prev_instance,
wchar_t* command_line,
int show_command) {
install_static::InitializeProductDetailsForPrimaryModule();
// The exit manager is in charge of calling the dtors of singletons.
base::AtExitManager exit_manager;
// Initialize the CommandLine singleton from the environment.
base::CommandLine::Init(0, nullptr);
// Make sure the process exits cleanly on unexpected errors.
base::EnableTerminationOnHeapCorruption();
base::EnableTerminationOnOutOfMemory();
base::win::RegisterInvalidParamHandler();
base::win::SetupCRT(*base::CommandLine::ForCurrentProcess());
base::win::ScopedWinrtInitializer winrt_initializer;
if (!winrt_initializer.Succeeded()) {
Trace(L"Failed initializing WinRT\n");
return -1;
}
notification_helper::ComServerModule com_server_module;
com_server_module.Run();
return 0;
}