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 <shlwapi.h> | 6 #include <shlwapi.h> |
7 | 7 |
8 #include "chrome/app/breakpad_win.h" | 8 #include "chrome/app/breakpad_win.h" |
9 #include "chrome/app/client_util.h" | 9 #include "chrome/app/client_util.h" |
10 #include "chrome/common/result_codes.h" | 10 #include "chrome/common/result_codes.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } | 89 } |
90 | 90 |
91 // Set did_run "dr" in omaha's client state for this product. | 91 // Set did_run "dr" in omaha's client state for this product. |
92 bool SetDidRunState(const wchar_t* guid, const wchar_t* value) { | 92 bool SetDidRunState(const wchar_t* guid, const wchar_t* value) { |
93 std::wstring key_path(google_update::kRegPathClientState); | 93 std::wstring key_path(google_update::kRegPathClientState); |
94 key_path.append(L"\\").append(guid); | 94 key_path.append(L"\\").append(guid); |
95 HKEY reg_key; | 95 HKEY reg_key; |
96 if (::RegCreateKeyExW(HKEY_CURRENT_USER, key_path.c_str(), 0, NULL, | 96 if (::RegCreateKeyExW(HKEY_CURRENT_USER, key_path.c_str(), 0, NULL, |
97 REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, | 97 REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, |
98 ®_key, NULL) == ERROR_SUCCESS) { | 98 ®_key, NULL) == ERROR_SUCCESS) { |
| 99 // Note that the length here must be in bytes and must account for the |
| 100 // terminating null char. |
99 ::RegSetValueExW(reg_key, google_update::kRegDidRunField, 0, REG_SZ, | 101 ::RegSetValueExW(reg_key, google_update::kRegDidRunField, 0, REG_SZ, |
100 reinterpret_cast<const BYTE *>(value), ::lstrlenW(value)); | 102 reinterpret_cast<const BYTE *>(value), |
| 103 (::lstrlenW(value) + 1) * sizeof(wchar_t)); |
101 ::RegCloseKey(reg_key); | 104 ::RegCloseKey(reg_key); |
102 return true; | 105 return true; |
103 } | 106 } |
104 return false; | 107 return false; |
105 } | 108 } |
106 | 109 |
107 bool RecordDidRun(const wchar_t* guid) { | 110 bool RecordDidRun(const wchar_t* guid) { |
108 return SetDidRunState(guid, L"1"); | 111 return SetDidRunState(guid, L"1"); |
109 } | 112 } |
110 | 113 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 } | 218 } |
216 }; | 219 }; |
217 | 220 |
218 MainDllLoader* MakeMainDllLoader() { | 221 MainDllLoader* MakeMainDllLoader() { |
219 #if defined(GOOGLE_CHROME_BUILD) | 222 #if defined(GOOGLE_CHROME_BUILD) |
220 return new ChromeDllLoader(); | 223 return new ChromeDllLoader(); |
221 #else | 224 #else |
222 return new ChromiumDllLoader(); | 225 return new ChromiumDllLoader(); |
223 #endif | 226 #endif |
224 } | 227 } |
OLD | NEW |