Remove EWK_BRINGUPS for M120 #3
[platform/framework/web/chromium-efl.git] / chrome / app / delay_load_failure_hook_win.cc
1 // Copyright 2022 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/app/delay_load_failure_hook_win.h"
6
7 // windows.h needs to be included before delayimp.h.
8 #include <windows.h>
9
10 #include <delayimp.h>
11
12 #include "chrome/common/win/delay_load_failure_support.h"
13
14 namespace chrome {
15
16 namespace {
17
18 bool g_hooks_enabled = true;
19
20 // Delay load failure hook that generates a crash report. By default a failure
21 // to delay load will trigger an exception handled by the delay load runtime and
22 // this won't generate a crash report.
23 FARPROC WINAPI DelayLoadFailureHookEXE(unsigned reason,
24                                        DelayLoadInfo* dll_info) {
25   if (!g_hooks_enabled)
26     return 0;
27
28   return HandleDelayLoadFailureCommon(reason, dll_info);
29 }
30
31 }  // namespace
32
33 void DisableDelayLoadFailureHooksForMainExecutable() {
34   g_hooks_enabled = false;
35 }
36
37 }  // namespace chrome
38
39 // Set the delay load failure hook to the function above.
40 //
41 // The |__pfnDliFailureHook2| failure notification hook gets called
42 // automatically by the delay load runtime in case of failure, see
43 // https://docs.microsoft.com/en-us/cpp/build/reference/failure-hooks?view=vs-2019
44 // for more information about this.
45 extern "C" const PfnDliHook __pfnDliFailureHook2 =
46     chrome::DelayLoadFailureHookEXE;