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 "chrome/app/google_update_client.h" | 5 #include "chrome/app/google_update_client.h" |
6 | 6 |
7 #include <shlobj.h> | 7 #include <shlobj.h> |
8 #include <strsafe.h> | 8 #include <strsafe.h> |
9 | 9 |
10 #include "chrome/app/client_util.h" | 10 #include "chrome/app/client_util.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 return client_util::GetDLLPath(dll_, dll_path_); | 41 return client_util::GetDLLPath(dll_, dll_path_); |
42 } | 42 } |
43 | 43 |
44 const wchar_t* GoogleUpdateClient::GetVersion() const { | 44 const wchar_t* GoogleUpdateClient::GetVersion() const { |
45 return version_; | 45 return version_; |
46 } | 46 } |
47 | 47 |
48 bool GoogleUpdateClient::Launch(HINSTANCE instance, | 48 bool GoogleUpdateClient::Launch(HINSTANCE instance, |
49 sandbox::SandboxInterfaceInfo* sandbox, | 49 sandbox::SandboxInterfaceInfo* sandbox, |
50 wchar_t* command_line, | 50 wchar_t* command_line, |
51 int show_command, | |
52 const char* entry_name, | 51 const char* entry_name, |
53 int* ret) { | 52 int* ret) { |
54 if (client_util::FileExists(dll_path_)) { | 53 if (client_util::FileExists(dll_path_)) { |
55 ::SetCurrentDirectory(dll_path_); | 54 ::SetCurrentDirectory(dll_path_); |
56 // Setting the version on the environment block is a 'best effort' deal. | 55 // Setting the version on the environment block is a 'best effort' deal. |
57 // It enables Google Update running on a child to load the same DLL version. | 56 // It enables Google Update running on a child to load the same DLL version. |
58 ::SetEnvironmentVariableW(google_update::kEnvProductVersionKey, version_); | 57 ::SetEnvironmentVariableW(google_update::kEnvProductVersionKey, version_); |
59 } | 58 } |
60 | 59 |
61 // The dll can be in the exe's directory or in the current directory. | 60 // The dll can be in the exe's directory or in the current directory. |
(...skipping 21 matching lines...) Expand all Loading... |
83 key_path.append(L"\\" + guid_); | 82 key_path.append(L"\\" + guid_); |
84 HKEY reg_key; | 83 HKEY reg_key; |
85 if (::RegOpenKeyEx(HKEY_CURRENT_USER, key_path.c_str(), 0, | 84 if (::RegOpenKeyEx(HKEY_CURRENT_USER, key_path.c_str(), 0, |
86 KEY_WRITE, ®_key) == ERROR_SUCCESS) { | 85 KEY_WRITE, ®_key) == ERROR_SUCCESS) { |
87 const wchar_t kVal[] = L"1"; | 86 const wchar_t kVal[] = L"1"; |
88 ::RegSetValueEx(reg_key, google_update::kRegDidRunField, 0, REG_SZ, | 87 ::RegSetValueEx(reg_key, google_update::kRegDidRunField, 0, REG_SZ, |
89 reinterpret_cast<const BYTE *>(kVal), sizeof(kVal)); | 88 reinterpret_cast<const BYTE *>(kVal), sizeof(kVal)); |
90 ::RegCloseKey(reg_key); | 89 ::RegCloseKey(reg_key); |
91 } | 90 } |
92 | 91 |
93 int rc = (entry)(instance, sandbox, command_line, show_command); | 92 int rc = (entry)(instance, sandbox, command_line); |
94 if (ret) { | 93 if (ret) { |
95 *ret = rc; | 94 *ret = rc; |
96 } | 95 } |
97 did_launch = true; | 96 did_launch = true; |
98 } | 97 } |
99 #ifdef PURIFY | 98 #ifdef PURIFY |
100 // We should never unload the dll. There is only risk and no gain from | 99 // We should never unload the dll. There is only risk and no gain from |
101 // doing so. The singleton dtors have been already run by AtExitManager. | 100 // doing so. The singleton dtors have been already run by AtExitManager. |
102 ::FreeLibrary(dll_handle); | 101 ::FreeLibrary(dll_handle); |
103 #endif | 102 #endif |
(...skipping 17 matching lines...) Expand all Loading... |
121 ret = true; | 120 ret = true; |
122 } | 121 } |
123 } | 122 } |
124 | 123 |
125 if (version_) { | 124 if (version_) { |
126 ::StringCchCat(dll_path_, MAX_PATH, version_); | 125 ::StringCchCat(dll_path_, MAX_PATH, version_); |
127 } | 126 } |
128 return ret; | 127 return ret; |
129 } | 128 } |
130 } // namespace google_update | 129 } // namespace google_update |
OLD | NEW |