| 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;
|
| }
|
|
|