OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
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 "win8/delegate_execute/crash_server_init.h" | |
6 | |
7 #include <sddl.h> | |
grt (UTC plus 2)
2012/11/22 16:15:02
this is causing problems on win_rel. i don't see t
robertshield
2012/11/22 18:18:28
Done.
| |
8 #include <shlobj.h> | |
9 #include <stdlib.h> | |
grt (UTC plus 2)
2012/11/22 16:15:02
remove this
robertshield
2012/11/22 18:18:28
Done.
| |
10 | |
11 #include "base/file_version_info.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/win/win_util.h" | |
14 #include "breakpad/src/client/windows/handler/exception_handler.h" | |
15 | |
16 const wchar_t kGoogleUpdatePipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\"; | |
17 const wchar_t kSystemPrincipalSid[] = L"S-1-5-18"; | |
18 | |
19 const MINIDUMP_TYPE kLargerDumpType = static_cast<MINIDUMP_TYPE>( | |
20 MiniDumpWithProcessThreadData | // Get PEB and TEB. | |
21 MiniDumpWithUnloadedModules | // Get unloaded modules when available. | |
22 MiniDumpWithIndirectlyReferencedMemory); // Get memory referenced by stack. | |
23 | |
24 extern "C" IMAGE_DOS_HEADER __ImageBase; | |
25 | |
26 namespace { | |
27 | |
28 bool IsRunningSystemInstall() { | |
29 wchar_t exe_path[MAX_PATH * 2] = {0}; | |
30 GetModuleFileName(reinterpret_cast<HMODULE>(&__ImageBase), | |
grt (UTC plus 2)
2012/11/22 16:15:02
#include <windows.h> for this
robertshield
2012/11/22 18:18:28
Done.
| |
31 exe_path, | |
32 _countof(exe_path)); | |
33 | |
34 bool is_system = false; | |
35 | |
36 wchar_t program_files_path[MAX_PATH] = {0}; | |
37 if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, | |
38 SHGFP_TYPE_CURRENT, program_files_path))) { | |
39 if (wcsstr(exe_path, program_files_path) == exe_path) { | |
grt (UTC plus 2)
2012/11/22 16:15:02
#include <cwchar> for this
robertshield
2012/11/22 18:18:28
Done.
| |
40 is_system = true; | |
41 } | |
42 } | |
43 | |
44 return is_system; | |
45 } | |
46 | |
47 google_breakpad::CustomClientInfo* GetCustomInfo() { | |
48 scoped_ptr<FileVersionInfo> version_info( | |
49 FileVersionInfo::CreateFileVersionInfoForCurrentModule()); | |
50 | |
51 static google_breakpad::CustomInfoEntry ver_entry( | |
52 L"ver", version_info->file_version().c_str()); | |
53 static google_breakpad::CustomInfoEntry prod_entry(L"prod", L"Chrome"); | |
54 static google_breakpad::CustomInfoEntry plat_entry(L"plat", L"Win32"); | |
55 static google_breakpad::CustomInfoEntry type_entry(L"ptype", | |
56 L"delegate_execute"); | |
57 static google_breakpad::CustomInfoEntry entries[] = { | |
58 ver_entry, prod_entry, plat_entry, type_entry }; | |
59 static google_breakpad::CustomClientInfo custom_info = { | |
60 entries, ARRAYSIZE(entries) }; | |
61 return &custom_info; | |
62 } | |
63 | |
64 } // namespace | |
65 | |
66 namespace delegate_execute { | |
67 | |
68 scoped_ptr<google_breakpad::ExceptionHandler> InitializeCrashReporting() { | |
69 wchar_t temp_path[MAX_PATH + 1] = {0}; | |
70 DWORD path_len = ::GetTempPath(MAX_PATH, temp_path); | |
grt (UTC plus 2)
2012/11/22 16:15:02
#include <windows.h> for this
robertshield
2012/11/22 18:18:28
Done.
| |
71 | |
72 string16 pipe_name; | |
73 pipe_name = kGoogleUpdatePipeName; | |
74 if (IsRunningSystemInstall()) { | |
75 pipe_name += kSystemPrincipalSid; | |
76 } else { | |
77 string16 user_sid; | |
78 if (base::win::GetUserSidString(&user_sid)) { | |
79 pipe_name += user_sid; | |
80 } else { | |
81 // We don't think we're a system install, but we couldn't get the | |
82 // user SID. Try connecting to the system-level crash service as a | |
83 // last ditch effort. | |
84 pipe_name += kSystemPrincipalSid; | |
85 } | |
86 } | |
87 | |
88 return scoped_ptr<google_breakpad::ExceptionHandler>( | |
89 new google_breakpad::ExceptionHandler( | |
90 temp_path, NULL, NULL, NULL, | |
91 google_breakpad::ExceptionHandler::HANDLER_ALL, kLargerDumpType, | |
92 pipe_name.c_str(), GetCustomInfo())); | |
93 } | |
94 | |
95 } // namespace delegate_execute | |
OLD | NEW |