OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/crash/app/breakpad_win.h" | 5 #include "components/crash/app/breakpad_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 #include <tchar.h> | 9 #include <tchar.h> |
10 #include <userenv.h> | 10 #include <userenv.h> |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
604 // restarted instance will still contain the pipe environment variable, which | 604 // restarted instance will still contain the pipe environment variable, which |
605 // will allow the restarted process to still upload crash reports. This function | 605 // will allow the restarted process to still upload crash reports. This function |
606 // clears the environment variable, so that the restarted Chrome, which inherits | 606 // clears the environment variable, so that the restarted Chrome, which inherits |
607 // its environment from the current Chrome, will no longer contain the variable. | 607 // its environment from the current Chrome, will no longer contain the variable. |
608 extern "C" void __declspec(dllexport) __cdecl | 608 extern "C" void __declspec(dllexport) __cdecl |
609 ClearBreakpadPipeEnvironmentVariable() { | 609 ClearBreakpadPipeEnvironmentVariable() { |
610 scoped_ptr<base::Environment> env(base::Environment::Create()); | 610 scoped_ptr<base::Environment> env(base::Environment::Create()); |
611 env->UnSetVar(kPipeNameVar); | 611 env->UnSetVar(kPipeNameVar); |
612 } | 612 } |
613 | 613 |
614 #ifdef _WIN64 | |
615 PRUNTIME_FUNCTION GetRuntimeFunctionCallback(DWORD64 ControlPC, PVOID Context) { | |
616 if (g_breakpad) { | |
617 g_breakpad->WriteMinidump(); | |
618 // Patched stub exists based on conditions (See InitCrashReporter). | |
619 // As a side note this function also gets called from | |
620 // WindowProcExceptionFilter. | |
621 if (g_real_terminate_process_stub == NULL) { | |
622 ::TerminateProcess(::GetCurrentProcess(), content::RESULT_CODE_KILLED); | |
623 } else { | |
624 NtTerminateProcessPtr real_terminate_proc = | |
625 reinterpret_cast<NtTerminateProcessPtr>( | |
626 static_cast<char*>(g_real_terminate_process_stub)); | |
627 real_terminate_proc(::GetCurrentProcess(), content::RESULT_CODE_KILLED); | |
628 } | |
629 } | |
630 return NULL; | |
631 } | |
632 | |
633 extern "C" void __declspec(dllexport) __cdecl | |
634 RegisterNonABICompliantCodeRange(void* start, size_t size_in_bytes) { | |
635 RtlInstallFunctionTableCallback( | |
636 reinterpret_cast<DWORD64>(start) | 0x3, // Required by API. | |
637 reinterpret_cast<DWORD64>(start), | |
638 static_cast<DWORD>(size_in_bytes), | |
Will Harris
2014/09/30 20:39:59
check limits here during size_t -> DWORD conversio
| |
639 GetRuntimeFunctionCallback, | |
640 NULL, | |
641 NULL); | |
642 } | |
643 #endif | |
644 | |
614 } // namespace breakpad | 645 } // namespace breakpad |
OLD | NEW |