Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(567)

Unified Diff: chrome/app/google_update_client.cc

Issue 10300: Implement the load chrome.dll before file version for Google Chrome builds. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/app/google_update_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/google_update_client.cc
===================================================================
--- chrome/app/google_update_client.cc (revision 5105)
+++ chrome/app/google_update_client.cc (working copy)
@@ -32,7 +32,7 @@
namespace google_update {
-GoogleUpdateClient::GoogleUpdateClient() : version_(NULL) {
+GoogleUpdateClient::GoogleUpdateClient() : version_(NULL), dll_handle_(NULL) {
}
GoogleUpdateClient::~GoogleUpdateClient() {
@@ -47,12 +47,7 @@
return version_;
}
-bool GoogleUpdateClient::Launch(HINSTANCE instance,
- sandbox::SandboxInterfaceInfo* sandbox,
- wchar_t* command_line,
- int show_command,
- const char* entry_name,
- int* ret) {
+bool GoogleUpdateClient::Load() {
if (client_util::FileExists(dll_path_)) {
::SetCurrentDirectory(dll_path_);
// Setting the version on the environment block is a 'best effort' deal.
@@ -63,22 +58,32 @@
// The dll can be in the exe's directory or in the current directory.
// Use the alternate search path to be sure that it's not trying to load it
// calling application's directory.
- HINSTANCE dll_handle = ::LoadLibraryEx(dll_.c_str(), NULL,
- LOAD_WITH_ALTERED_SEARCH_PATH);
- if (NULL == dll_handle) {
- unsigned long err = GetLastError();
- if (err) {
- WCHAR message[500] = {0};
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0,
- reinterpret_cast<LPWSTR>(&message), 500, NULL);
- ::OutputDebugStringW(message);
- }
- return false;
+ dll_handle_ = ::LoadLibraryEx(dll_.c_str(),
+ NULL,
+ LOAD_WITH_ALTERED_SEARCH_PATH);
+ if (dll_handle_)
+ return true;
+
+ unsigned long err = GetLastError();
+ if (err) {
+ WCHAR message[500] = {0};
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0,
+ reinterpret_cast<LPWSTR>(&message), 500, NULL);
+ ::OutputDebugStringW(message);
}
+ return false;
+}
+
+bool GoogleUpdateClient::Launch(HINSTANCE instance,
+ sandbox::SandboxInterfaceInfo* sandbox,
+ wchar_t* command_line,
+ int show_command,
+ const char* entry_name,
+ int* ret) {
bool did_launch = false;
client_util::DLL_MAIN entry = reinterpret_cast<client_util::DLL_MAIN>(
- ::GetProcAddress(dll_handle, entry_name));
+ ::GetProcAddress(dll_handle_, entry_name));
if (NULL != entry) {
// record did_run "dr" in client state
std::wstring key_path(google_update::kRegPathClientState);
@@ -101,7 +106,7 @@
#ifdef PURIFY
// We should never unload the dll. There is only risk and no gain from
// doing so. The singleton dtors have been already run by AtExitManager.
- ::FreeLibrary(dll_handle);
+ ::FreeLibrary(dll_handle_);
#endif
return did_launch;
}
« no previous file with comments | « chrome/app/google_update_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698