• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2012 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 <windows.h>
6 
7 #include "base/compiler_specific.h"
8 #include "base/win/win_util.h"
9 
10 // Custom crash code to get a unique entry in crash reports.
CrashOnProcessDetach()11 NOINLINE static void CrashOnProcessDetach() {
12   *static_cast<volatile int*>(nullptr) = 0x356;
13 }
14 
15 // Make DllMain call the listed callbacks.  This way any third parties that are
16 // linked in will also be called.
DllMain(PVOID h,DWORD reason,PVOID reserved)17 BOOL WINAPI DllMain(PVOID h, DWORD reason, PVOID reserved) {
18   if (DLL_PROCESS_DETACH == reason && base::win::ShouldCrashOnProcessDetach())
19     CrashOnProcessDetach();
20   return true;
21 }
22