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/breakpad/app/breakpad_win.h" | 5 #include "components/breakpad/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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 GetBreakpadClient()->GetProductNameAndVersion( | 278 GetBreakpadClient()->GetProductNameAndVersion( |
279 base::FilePath(exe_path), | 279 base::FilePath(exe_path), |
280 &product, | 280 &product, |
281 &version, | 281 &version, |
282 &special_build, | 282 &special_build, |
283 &channel_name); | 283 &channel_name); |
284 | 284 |
285 // We only expect this method to be called once per process. | 285 // We only expect this method to be called once per process. |
286 // Common enties | 286 // Common enties |
287 custom_entries_.push_back( | 287 custom_entries_.push_back( |
288 google_breakpad::CustomInfoEntry(L"ver", | 288 google_breakpad::CustomInfoEntry(L"ver", version.c_str())); |
289 base::UTF16ToWide(version).c_str())); | |
290 custom_entries_.push_back( | 289 custom_entries_.push_back( |
291 google_breakpad::CustomInfoEntry(L"prod", | 290 google_breakpad::CustomInfoEntry(L"prod", product.c_str())); |
292 base::UTF16ToWide(product).c_str())); | |
293 custom_entries_.push_back( | 291 custom_entries_.push_back( |
294 google_breakpad::CustomInfoEntry(L"plat", L"Win32")); | 292 google_breakpad::CustomInfoEntry(L"plat", L"Win32")); |
295 custom_entries_.push_back( | 293 custom_entries_.push_back( |
296 google_breakpad::CustomInfoEntry(L"ptype", type.c_str())); | 294 google_breakpad::CustomInfoEntry(L"ptype", type.c_str())); |
297 custom_entries_.push_back(google_breakpad::CustomInfoEntry( | 295 custom_entries_.push_back(google_breakpad::CustomInfoEntry( |
298 L"pid", base::StringPrintf(L"%d", ::GetCurrentProcessId()).c_str())); | 296 L"pid", base::StringPrintf(L"%d", ::GetCurrentProcessId()).c_str())); |
299 custom_entries_.push_back(google_breakpad::CustomInfoEntry( | 297 custom_entries_.push_back(google_breakpad::CustomInfoEntry( |
300 L"channel", base::UTF16ToWide(channel_name).c_str())); | 298 L"channel", channel_name.c_str())); |
301 custom_entries_.push_back(google_breakpad::CustomInfoEntry( | 299 custom_entries_.push_back(google_breakpad::CustomInfoEntry( |
302 L"profile-type", GetProfileType().c_str())); | 300 L"profile-type", GetProfileType().c_str())); |
303 | 301 |
304 if (!special_build.empty()) | 302 if (!special_build.empty()) { |
305 custom_entries_.push_back(google_breakpad::CustomInfoEntry( | 303 custom_entries_.push_back(google_breakpad::CustomInfoEntry( |
306 L"special", base::UTF16ToWide(special_build).c_str())); | 304 L"special", special_build.c_str())); |
| 305 } |
307 | 306 |
308 if (type == L"plugin" || type == L"ppapi") { | 307 if (type == L"plugin" || type == L"ppapi") { |
309 std::wstring plugin_path = | 308 std::wstring plugin_path = |
310 CommandLine::ForCurrentProcess()->GetSwitchValueNative("plugin-path"); | 309 CommandLine::ForCurrentProcess()->GetSwitchValueNative("plugin-path"); |
311 if (!plugin_path.empty()) | 310 if (!plugin_path.empty()) |
312 SetPluginPath(plugin_path); | 311 SetPluginPath(plugin_path); |
313 } | 312 } |
314 | 313 |
315 // Check whether configuration management controls crash reporting. | 314 // Check whether configuration management controls crash reporting. |
316 bool crash_reporting_enabled = true; | 315 bool crash_reporting_enabled = true; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 &title, &message, &is_rtl_locale)) { | 530 &title, &message, &is_rtl_locale)) { |
532 return false; | 531 return false; |
533 } | 532 } |
534 | 533 |
535 // If the UI layout is right-to-left, we need to pass the appropriate MB_XXX | 534 // If the UI layout is right-to-left, we need to pass the appropriate MB_XXX |
536 // flags so that an RTL message box is displayed. | 535 // flags so that an RTL message box is displayed. |
537 UINT flags = MB_OKCANCEL | MB_ICONWARNING; | 536 UINT flags = MB_OKCANCEL | MB_ICONWARNING; |
538 if (is_rtl_locale) | 537 if (is_rtl_locale) |
539 flags |= MB_RIGHT | MB_RTLREADING; | 538 flags |= MB_RIGHT | MB_RTLREADING; |
540 | 539 |
541 return WrapMessageBoxWithSEH(base::UTF16ToWide(message).c_str(), | 540 return WrapMessageBoxWithSEH(message.c_str(), title.c_str(), flags, exit_now); |
542 base::UTF16ToWide(title).c_str(), | |
543 flags, | |
544 exit_now); | |
545 } | 541 } |
546 | 542 |
547 // Crashes the process after generating a dump for the provided exception. Note | 543 // Crashes the process after generating a dump for the provided exception. Note |
548 // that the crash reporter should be initialized before calling this function | 544 // that the crash reporter should be initialized before calling this function |
549 // for it to do anything. | 545 // for it to do anything. |
550 // NOTE: This function is used by SyzyASAN to invoke a crash. If you change the | 546 // NOTE: This function is used by SyzyASAN to invoke a crash. If you change the |
551 // the name or signature of this function you will break SyzyASAN instrumented | 547 // the name or signature of this function you will break SyzyASAN instrumented |
552 // releases of Chrome. Please contact syzygy-team@chromium.org before doing so! | 548 // releases of Chrome. Please contact syzygy-team@chromium.org before doing so! |
553 extern "C" int __declspec(dllexport) CrashForException( | 549 extern "C" int __declspec(dllexport) CrashForException( |
554 EXCEPTION_POINTERS* info) { | 550 EXCEPTION_POINTERS* info) { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 if (process_type != L"browser" && | 789 if (process_type != L"browser" && |
794 !GetBreakpadClient()->IsRunningUnattended()) { | 790 !GetBreakpadClient()->IsRunningUnattended()) { |
795 // Initialize the hook TerminateProcess to catch unexpected exits. | 791 // Initialize the hook TerminateProcess to catch unexpected exits. |
796 InitTerminateProcessHooks(); | 792 InitTerminateProcessHooks(); |
797 } | 793 } |
798 #endif | 794 #endif |
799 } | 795 } |
800 } | 796 } |
801 | 797 |
802 } // namespace breakpad | 798 } // namespace breakpad |
OLD | NEW |