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

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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 220 }
221 } 221 }
222 222
223 HRESULT RegisterFirefoxCeee(bool do_register) { 223 HRESULT RegisterFirefoxCeee(bool do_register) {
224 HRESULT hr = STG_E_FILENOTFOUND; 224 HRESULT hr = STG_E_FILENOTFOUND;
225 if (do_register) { 225 if (do_register) {
226 FilePath path(GetFirefoxCeeePath()); 226 FilePath path(GetFirefoxCeeePath());
227 227
228 if (file_util::PathExists(path)) { 228 if (file_util::PathExists(path)) {
229 base::win::RegKey key(HKEY_LOCAL_MACHINE, L"SOFTWARE", KEY_WRITE); 229 base::win::RegKey key(HKEY_LOCAL_MACHINE, L"SOFTWARE", KEY_WRITE);
230 if (key.CreateKey(L"Mozilla", KEY_WRITE) && 230 if ((key.CreateKey(L"Mozilla", KEY_WRITE) == ERROR_SUCCESS) &&
231 key.CreateKey(L"Firefox", KEY_WRITE) && 231 (key.CreateKey(L"Firefox", KEY_WRITE) == ERROR_SUCCESS) &&
232 key.CreateKey(L"extensions", KEY_WRITE) && 232 (key.CreateKey(L"extensions", KEY_WRITE) == ERROR_SUCCESS) &&
233 key.WriteValue(kCeeeFirefoxExtensionName, path.value().c_str())) { 233 (key.WriteValue(kCeeeFirefoxExtensionName, path.value().c_str()))
234 == ERROR_SUCCESS) {
234 hr = S_OK; 235 hr = S_OK;
235 } else { 236 } else {
236 hr = com::AlwaysErrorFromLastError(); 237 hr = com::AlwaysErrorFromLastError();
237 } 238 }
238 } 239 }
239 } else { 240 } else {
240 hr = S_OK; // OK if not found, then there's nothing to do 241 hr = S_OK; // OK if not found, then there's nothing to do
241 base::win::RegKey key(HKEY_LOCAL_MACHINE, L"SOFTWARE", KEY_READ); 242 base::win::RegKey key(HKEY_LOCAL_MACHINE, L"SOFTWARE", KEY_READ);
242 if (key.OpenKey(L"Mozilla", KEY_READ) && 243 if ((key.OpenKey(L"Mozilla", KEY_READ) == ERROR_SUCCESS) &&
243 key.OpenKey(L"Firefox", KEY_READ) && 244 (key.OpenKey(L"Firefox", KEY_READ) == ERROR_SUCCESS) &&
244 key.OpenKey(L"extensions", KEY_WRITE) && 245 (key.OpenKey(L"extensions", KEY_WRITE) == ERROR_SUCCESS) &&
245 key.ValueExists(kCeeeFirefoxExtensionName)) { 246 key.ValueExists(kCeeeFirefoxExtensionName)) {
246 if (!key.DeleteValue(kCeeeFirefoxExtensionName)) { 247 LONG result = key.DeleteValue(kCeeeFirefoxExtensionName);
247 hr = com::AlwaysErrorFromLastError(); 248 hr = HRESULT_FROM_WIN32(result);
248 }
249 } 249 }
250 } 250 }
251 251
252 return hr; 252 return hr;
253 } 253 }
254 254
255 // Registers or unregisters this install as coming from the CEEE+CF channel if 255 // Registers or unregisters this install as coming from the CEEE+CF channel if
256 // it was installed using Omaha. 256 // it was installed using Omaha.
257 HRESULT SetCeeeChannelModifier(bool new_value) { 257 HRESULT SetCeeeChannelModifier(bool new_value) {
258 std::wstring reg_key(ceee_module_util::GetCromeFrameClientStateKey()); 258 std::wstring reg_key(ceee_module_util::GetCromeFrameClientStateKey());
259 259
260 base::win::RegKey key; 260 base::win::RegKey key;
261 if (!key.Open(HKEY_LOCAL_MACHINE, reg_key.c_str(), KEY_ALL_ACCESS)) { 261 if (key.Open(HKEY_LOCAL_MACHINE, reg_key.c_str(), KEY_ALL_ACCESS)
262 != ERROR_SUCCESS) {
grt (UTC plus 2) 2011/01/16 04:19:48 Wrapping
amit 2011/01/16 07:54:28 Done.
262 // Omaha didn't install the key. Perhaps no Omaha? That's ok. 263 // Omaha didn't install the key. Perhaps no Omaha? That's ok.
263 return S_OK; 264 return S_OK;
264 } 265 }
265 266
266 // We create the "ap" value if it doesn't exist. 267 // We create the "ap" value if it doesn't exist.
267 installer::ChannelInfo channel_info; 268 installer::ChannelInfo channel_info;
268 channel_info.Initialize(key); 269 channel_info.Initialize(key);
269 270
270 if (channel_info.SetCeee(new_value) && !channel_info.Write(&key)) { 271 if (channel_info.SetCeee(new_value) && !channel_info.Write(&key)) {
271 return E_FAIL; 272 return E_FAIL;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 LOG(WARNING) << "Call to unimplemented DllRegisterUserServer."; 398 LOG(WARNING) << "Call to unimplemented DllRegisterUserServer.";
398 return S_OK; 399 return S_OK;
399 } 400 }
400 401
401 // No-op entry point to keep user-level unregistration happy. 402 // No-op entry point to keep user-level unregistration happy.
402 // TODO(robertshield): Remove this as part of registration re-org. 403 // TODO(robertshield): Remove this as part of registration re-org.
403 STDAPI DllUnregisterUserServer() { 404 STDAPI DllUnregisterUserServer() {
404 LOG(WARNING) << "Call to unimplemented DllUnregisterUserServer."; 405 LOG(WARNING) << "Call to unimplemented DllUnregisterUserServer.";
405 return S_OK; 406 return S_OK;
406 } 407 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698