OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <windows.h> | 5 #include <windows.h> |
6 #include <tchar.h> | 6 #include <tchar.h> |
7 | 7 |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/debug_on_start.h" | 11 #include "base/debug_on_start.h" |
12 #include "base/process_util.h" | 12 #include "base/process_util.h" |
13 #include "base/win_util.h" | 13 #include "base/win_util.h" |
14 #include "chrome/app/breakpad.h" | 14 #include "chrome/app/breakpad_win.h" |
15 #include "chrome/app/client_util.h" | 15 #include "chrome/app/client_util.h" |
16 #include "chrome/app/google_update_client.h" | 16 #include "chrome/app/google_update_client.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/result_codes.h" | 18 #include "chrome/common/result_codes.h" |
19 #include "sandbox/src/sandbox_factory.h" | 19 #include "sandbox/src/sandbox_factory.h" |
20 #include "sandbox/src/dep.h" | 20 #include "sandbox/src/dep.h" |
21 | 21 |
22 int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev_instance, | 22 int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev_instance, |
23 wchar_t* command_line, int) { | 23 wchar_t* command_line, int) { |
24 base::EnableTerminationOnHeapCorruption(); | 24 base::EnableTerminationOnHeapCorruption(); |
(...skipping 20 matching lines...) Expand all Loading... |
45 | 45 |
46 const wchar_t* dll_name = L"chrome.dll"; | 46 const wchar_t* dll_name = L"chrome.dll"; |
47 #if defined(GOOGLE_CHROME_BUILD) | 47 #if defined(GOOGLE_CHROME_BUILD) |
48 google_update::GoogleUpdateClient client; | 48 google_update::GoogleUpdateClient client; |
49 | 49 |
50 // TODO(erikkay): Get guid from build macros rather than hardcoding. | 50 // TODO(erikkay): Get guid from build macros rather than hardcoding. |
51 // TODO(erikkay): verify client.Init() return value for official builds | 51 // TODO(erikkay): verify client.Init() return value for official builds |
52 client.Init(L"{8A69D345-D564-463c-AFF1-A69D9E530F96}", dll_name); | 52 client.Init(L"{8A69D345-D564-463c-AFF1-A69D9E530F96}", dll_name); |
53 | 53 |
54 // Initialize the crash reporter. | 54 // Initialize the crash reporter. |
55 InitCrashReporter(client.GetDLLPath()); | 55 InitCrashReporterWithDllPath(client.GetDLLPath()); |
56 | 56 |
57 bool exit_now = true; | 57 bool exit_now = true; |
58 if (ShowRestartDialogIfCrashed(&exit_now)) { | 58 if (ShowRestartDialogIfCrashed(&exit_now)) { |
59 // We have restarted because of a previous crash. The user might | 59 // We have restarted because of a previous crash. The user might |
60 // decide that he does not want to continue. | 60 // decide that he does not want to continue. |
61 if (exit_now) | 61 if (exit_now) |
62 return ResultCodes::NORMAL_EXIT; | 62 return ResultCodes::NORMAL_EXIT; |
63 } | 63 } |
64 | 64 |
65 int ret = 0; | 65 int ret = 0; |
(...skipping 12 matching lines...) Expand all Loading... |
78 dll_path.append(version); | 78 dll_path.append(version); |
79 if (client_util::FileExists(dll_path.c_str())) | 79 if (client_util::FileExists(dll_path.c_str())) |
80 ::SetCurrentDirectory(dll_path.c_str()); | 80 ::SetCurrentDirectory(dll_path.c_str()); |
81 delete[] version; | 81 delete[] version; |
82 } | 82 } |
83 | 83 |
84 HINSTANCE dll_handle = ::LoadLibraryEx(dll_name, NULL, | 84 HINSTANCE dll_handle = ::LoadLibraryEx(dll_name, NULL, |
85 LOAD_WITH_ALTERED_SEARCH_PATH); | 85 LOAD_WITH_ALTERED_SEARCH_PATH); |
86 | 86 |
87 // Initialize the crash reporter. | 87 // Initialize the crash reporter. |
88 InitCrashReporter(client_util::GetDLLPath(dll_name, dll_path)); | 88 InitCrashReporterWithDllPath(client_util::GetDLLPath(dll_name, dll_path)); |
89 | 89 |
90 bool exit_now = true; | 90 bool exit_now = true; |
91 if (ShowRestartDialogIfCrashed(&exit_now)) { | 91 if (ShowRestartDialogIfCrashed(&exit_now)) { |
92 // We have restarted because of a previous crash. The user might | 92 // We have restarted because of a previous crash. The user might |
93 // decide that he does not want to continue. | 93 // decide that he does not want to continue. |
94 if (exit_now) | 94 if (exit_now) |
95 return ResultCodes::NORMAL_EXIT; | 95 return ResultCodes::NORMAL_EXIT; |
96 } | 96 } |
97 | 97 |
98 if (NULL != dll_handle) { | 98 if (NULL != dll_handle) { |
99 client_util::DLL_MAIN entry = reinterpret_cast<client_util::DLL_MAIN>( | 99 client_util::DLL_MAIN entry = reinterpret_cast<client_util::DLL_MAIN>( |
100 ::GetProcAddress(dll_handle, "ChromeMain")); | 100 ::GetProcAddress(dll_handle, "ChromeMain")); |
101 if (NULL != entry) | 101 if (NULL != entry) |
102 return (entry)(instance, &sandbox_info, command_line); | 102 return (entry)(instance, &sandbox_info, command_line); |
103 } | 103 } |
104 #endif | 104 #endif |
105 | 105 |
106 return ResultCodes::GOOGLE_UPDATE_LAUNCH_FAILED; | 106 return ResultCodes::GOOGLE_UPDATE_LAUNCH_FAILED; |
107 } | 107 } |
OLD | NEW |