diff options
author | rahulk@google.com <rahulk@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-29 23:58:10 +0000 |
---|---|---|
committer | rahulk@google.com <rahulk@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-29 23:58:10 +0000 |
commit | 4522cfd1ec9feba623eee66116e2aeda4081198e (patch) | |
tree | 9edf7953640b0cc016eee15602d451f124915161 /chrome | |
parent | 5daa269e3d3c10e9169f7c4ec23cc218f3ea5347 (diff) | |
download | chromium_src-4522cfd1ec9feba623eee66116e2aeda4081198e.zip chromium_src-4522cfd1ec9feba623eee66116e2aeda4081198e.tar.gz chromium_src-4522cfd1ec9feba623eee66116e2aeda4081198e.tar.bz2 |
Initialize Breakpad for Chromium as well.
BU=1296800
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1572 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/chrome_exe_main.cc | 7 | ||||
-rw-r--r-- | chrome/app/client_util.cc | 17 | ||||
-rw-r--r-- | chrome/app/client_util.h | 8 | ||||
-rw-r--r-- | chrome/app/google_update_client.cc | 14 |
4 files changed, 32 insertions, 14 deletions
diff --git a/chrome/app/chrome_exe_main.cc b/chrome/app/chrome_exe_main.cc index 7804626..3bf6439 100644 --- a/chrome/app/chrome_exe_main.cc +++ b/chrome/app/chrome_exe_main.cc @@ -78,14 +78,19 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev_instance, wchar_t exe_path[MAX_PATH] = {0}; client_util::GetExecutablePath(exe_path); wchar_t *version; + std::wstring dll_path; if (client_util::GetChromiumVersion(exe_path, L"Software\\Chromium", &version)) { - std::wstring dll_path(exe_path); + dll_path = exe_path; dll_path.append(version); if (client_util::FileExists(dll_path.c_str())) ::SetCurrentDirectory(dll_path.c_str()); delete[] version; } + + // Initialize the crash reporter. + InitCrashReporter(client_util::GetDLLPath(dll_name, dll_path)); + HINSTANCE dll_handle = ::LoadLibraryEx(dll_name, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (NULL != dll_handle) { diff --git a/chrome/app/client_util.cc b/chrome/app/client_util.cc index 0e51e42..333a525 100644 --- a/chrome/app/client_util.cc +++ b/chrome/app/client_util.cc @@ -41,6 +41,23 @@ bool GetChromiumVersion(const wchar_t* const exe_path, return ret; } +std::wstring GetDLLPath(const std::wstring dll_name, + const std::wstring dll_path) { + if (!dll_path.empty() && FileExists(dll_path.c_str())) + return dll_path + L"\\" + dll_name; + + // This is not an official build. Find the dll using the default + // path order in LoadLibrary. + wchar_t path[MAX_PATH] = {0}; + wchar_t* file_part = NULL; + DWORD result = ::SearchPath(NULL, dll_name.c_str(), NULL, MAX_PATH, + path, &file_part); + if (result == 0 || result > MAX_PATH) + return std::wstring(); + + return path; +} + void GetExecutablePath(wchar_t* exe_path) { DWORD len = ::GetModuleFileName(NULL, exe_path, MAX_PATH); wchar_t* tmp = exe_path + len - 1; diff --git a/chrome/app/client_util.h b/chrome/app/client_util.h index 6616ac9..e4b479e 100644 --- a/chrome/app/client_util.h +++ b/chrome/app/client_util.h @@ -10,6 +10,8 @@ #include <windows.h> +#include <string> + #include "sandbox/src/sandbox_factory.h" namespace client_util { @@ -28,6 +30,12 @@ bool GetChromiumVersion(const wchar_t* const exe_path, const wchar_t* const reg_key_path, wchar_t** version); +// Get path to DLL specified by dll_name. If dll_path is specified and it +// exists we assume DLL is in that directory and return that. Else we search +// for that DLL by calling Windows API. +std::wstring GetDLLPath(const std::wstring dll_name, + const std::wstring dll_path); + // Returns the path to the exe (without the file name) that called this // function. The buffer should already be allocated (ideally of MAX_PATH size). void GetExecutablePath(wchar_t* exe_path); diff --git a/chrome/app/google_update_client.cc b/chrome/app/google_update_client.cc index 11ea6ec..8c0e168 100644 --- a/chrome/app/google_update_client.cc +++ b/chrome/app/google_update_client.cc @@ -44,19 +44,7 @@ GoogleUpdateClient::~GoogleUpdateClient() { } std::wstring GoogleUpdateClient::GetDLLPath() { - if (client_util::FileExists(dll_path_)) - return std::wstring(dll_path_) + L"\\" + dll_; - - // This is not an official build. Find the dll using the default - // path order in LoadLibrary. - wchar_t path[MAX_PATH] = {0}; - wchar_t* file_part = NULL; - DWORD result = ::SearchPath(NULL, dll_.c_str(), NULL, MAX_PATH, - path, &file_part); - if (result == 0 || result > MAX_PATH) - return std::wstring(); - - return path; + return client_util::GetDLLPath(dll_, dll_path_); } const wchar_t* GoogleUpdateClient::GetVersion() const { |