| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/content/app/fallback_crash_handler_launcher_win.h" | 5 #include "components/crash/content/app/fallback_crash_handler_launcher_win.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/win/win_util.h" | 9 #include "base/win/win_util.h" |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 FallbackCrashHandlerLauncher::FallbackCrashHandlerLauncher() { | 21 FallbackCrashHandlerLauncher::FallbackCrashHandlerLauncher() { |
| 22 memset(&exception_pointers_, 0, sizeof(exception_pointers_)); | 22 memset(&exception_pointers_, 0, sizeof(exception_pointers_)); |
| 23 } | 23 } |
| 24 | 24 |
| 25 FallbackCrashHandlerLauncher::~FallbackCrashHandlerLauncher() {} | 25 FallbackCrashHandlerLauncher::~FallbackCrashHandlerLauncher() {} |
| 26 | 26 |
| 27 bool FallbackCrashHandlerLauncher::Initialize( | 27 bool FallbackCrashHandlerLauncher::Initialize( |
| 28 const base::CommandLine& program, | 28 const base::CommandLine& program, |
| 29 const base::FilePath& crashpad_database) { | 29 const base::FilePath& crashpad_database) { |
| 30 // Open an inheritable handle to self. This will be inherited to the handler. | 30 // Open an inheritable handle to self. This will be inherited to the handler. |
| 31 const DWORD kAccessMask = | 31 const DWORD kAccessMask = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | |
| 32 PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_DUP_HANDLE; | 32 PROCESS_DUP_HANDLE | PROCESS_TERMINATE; |
| 33 self_process_handle_.Set( | 33 self_process_handle_.Set( |
| 34 OpenProcess(kAccessMask, TRUE, ::GetCurrentProcessId())); | 34 OpenProcess(kAccessMask, TRUE, ::GetCurrentProcessId())); |
| 35 if (!self_process_handle_.IsValid()) | 35 if (!self_process_handle_.IsValid()) |
| 36 return false; | 36 return false; |
| 37 | 37 |
| 38 // Setup the startup info for inheriting the self process handle into the | 38 // Setup the startup info for inheriting the self process handle into the |
| 39 // fallback crash handler. | 39 // fallback crash handler. |
| 40 if (!startup_info_.InitializeProcThreadAttributeList(1)) | 40 if (!startup_info_.InitializeProcThreadAttributeList(1)) |
| 41 return false; | 41 return false; |
| 42 | 42 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 122 } |
| 123 | 123 |
| 124 // Close the handles returned from CreateProcess. | 124 // Close the handles returned from CreateProcess. |
| 125 CloseHandle(process_info.hProcess); | 125 CloseHandle(process_info.hProcess); |
| 126 CloseHandle(process_info.hThread); | 126 CloseHandle(process_info.hThread); |
| 127 | 127 |
| 128 return error; | 128 return error; |
| 129 } | 129 } |
| 130 | 130 |
| 131 } // namespace crash_reporter | 131 } // namespace crash_reporter |
| OLD | NEW |