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

Side by Side Diff: ceee/installer_dll/installer_helper.cc

Issue 6090006: Regkey functions return error code instead of bool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Small DLL shim to register and unregister all CEEE components. 5 // Small DLL shim to register and unregister all CEEE components.
6 6
7 #include "ceee/installer_dll/installer_helper.h" 7 #include "ceee/installer_dll/installer_helper.h"
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 219 }
220 } 220 }
221 221
222 HRESULT RegisterFirefoxCeee(bool do_register) { 222 HRESULT RegisterFirefoxCeee(bool do_register) {
223 HRESULT hr = STG_E_FILENOTFOUND; 223 HRESULT hr = STG_E_FILENOTFOUND;
224 if (do_register) { 224 if (do_register) {
225 FilePath path(GetFirefoxCeeePath()); 225 FilePath path(GetFirefoxCeeePath());
226 226
227 if (file_util::PathExists(path)) { 227 if (file_util::PathExists(path)) {
228 base::win::RegKey key(HKEY_LOCAL_MACHINE, L"SOFTWARE", KEY_WRITE); 228 base::win::RegKey key(HKEY_LOCAL_MACHINE, L"SOFTWARE", KEY_WRITE);
229 if (key.CreateKey(L"Mozilla", KEY_WRITE) && 229 if ((key.CreateKey(L"Mozilla", KEY_WRITE) == ERROR_SUCCESS) &&
Sigurður Ásgeirsson 2011/01/10 21:02:43 looks like this would be simpler with a path to a
230 key.CreateKey(L"Firefox", KEY_WRITE) && 230 (key.CreateKey(L"Firefox", KEY_WRITE) == ERROR_SUCCESS) &&
231 key.CreateKey(L"extensions", KEY_WRITE) && 231 (key.CreateKey(L"extensions", KEY_WRITE) == ERROR_SUCCESS) &&
232 key.WriteValue(kCeeeFirefoxExtensionName, path.value().c_str())) { 232 (key.WriteValue(kCeeeFirefoxExtensionName, path.value().c_str()))
233 == ERROR_SUCCESS) {
233 hr = S_OK; 234 hr = S_OK;
234 } else { 235 } else {
235 hr = com::AlwaysErrorFromLastError(); 236 hr = com::AlwaysErrorFromLastError();
236 } 237 }
237 } 238 }
238 } else { 239 } else {
239 hr = S_OK; // OK if not found, then there's nothing to do 240 hr = S_OK; // OK if not found, then there's nothing to do
240 base::win::RegKey key(HKEY_LOCAL_MACHINE, L"SOFTWARE", KEY_READ); 241 base::win::RegKey key(HKEY_LOCAL_MACHINE, L"SOFTWARE", KEY_READ);
241 if (key.OpenKey(L"Mozilla", KEY_READ) && 242 if ((key.OpenKey(L"Mozilla", KEY_READ) == ERROR_SUCCESS) &&
242 key.OpenKey(L"Firefox", KEY_READ) && 243 (key.OpenKey(L"Firefox", KEY_READ) == ERROR_SUCCESS) &&
243 key.OpenKey(L"extensions", KEY_WRITE) && 244 (key.OpenKey(L"extensions", KEY_WRITE) == ERROR_SUCCESS) &&
244 key.ValueExists(kCeeeFirefoxExtensionName)) { 245 key.ValueExists(kCeeeFirefoxExtensionName)) {
245 if (!key.DeleteValue(kCeeeFirefoxExtensionName)) { 246 LONG result = key.DeleteValue(kCeeeFirefoxExtensionName);
246 hr = com::AlwaysErrorFromLastError(); 247 hr = HRESULT_FROM_WIN32(result);
247 }
248 } 248 }
249 } 249 }
250 250
251 return hr; 251 return hr;
252 } 252 }
253 253
254 // Registers or unregisters this install as coming from the CEEE+CF channel if 254 // Registers or unregisters this install as coming from the CEEE+CF channel if
255 // it was installed using Omaha. 255 // it was installed using Omaha.
256 HRESULT SetCeeeChannelModifier(bool new_value) { 256 HRESULT SetCeeeChannelModifier(bool new_value) {
257 std::wstring reg_key(ceee_module_util::GetCromeFrameClientStateKey()); 257 std::wstring reg_key(ceee_module_util::GetCromeFrameClientStateKey());
258 258
259 base::win::RegKey key; 259 base::win::RegKey key;
260 if (!key.Open(HKEY_LOCAL_MACHINE, reg_key.c_str(), KEY_ALL_ACCESS)) { 260 LONG result = key.Open(HKEY_LOCAL_MACHINE, reg_key.c_str(), KEY_ALL_ACCESS);
261 if (result != ERROR_SUCCESS) {
261 // Omaha didn't install the key. Perhaps no Omaha? That's ok. 262 // Omaha didn't install the key. Perhaps no Omaha? That's ok.
262 return S_OK; 263 return S_OK;
263 } 264 }
264 265
265 // We create the "ap" value if it doesn't exist. 266 // We create the "ap" value if it doesn't exist.
266 installer::ChannelInfo channel_info; 267 installer::ChannelInfo channel_info;
267 channel_info.Initialize(key); 268 channel_info.Initialize(key);
268 269
269 if (channel_info.SetCeee(new_value) && !channel_info.Write(&key)) { 270 if (channel_info.SetCeee(new_value) && !channel_info.Write(&key)) {
270 return E_FAIL; 271 return E_FAIL;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 LOG(WARNING) << "Call to unimplemented DllRegisterUserServer."; 397 LOG(WARNING) << "Call to unimplemented DllRegisterUserServer.";
397 return S_OK; 398 return S_OK;
398 } 399 }
399 400
400 // No-op entry point to keep user-level unregistration happy. 401 // No-op entry point to keep user-level unregistration happy.
401 // TODO(robertshield): Remove this as part of registration re-org. 402 // TODO(robertshield): Remove this as part of registration re-org.
402 STDAPI DllUnregisterUserServer() { 403 STDAPI DllUnregisterUserServer() {
403 LOG(WARNING) << "Call to unimplemented DllUnregisterUserServer."; 404 LOG(WARNING) << "Call to unimplemented DllUnregisterUserServer.";
404 return S_OK; 405 return S_OK;
405 } 406 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698