OLD | NEW |
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 #include "chrome/installer/util/self_reg_work_item.h" | 5 #include "chrome/installer/util/self_reg_work_item.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/stringprintf.h" |
9 #include "chrome/installer/util/logging_installer.h" | 10 #include "chrome/installer/util/logging_installer.h" |
10 | 11 |
11 // Default registration export names. | 12 // Default registration export names. |
12 const char kDefaultRegistrationEntryPoint[] = "DllRegisterServer"; | 13 const char kDefaultRegistrationEntryPoint[] = "DllRegisterServer"; |
13 const char kDefaultUnregistrationEntryPoint[] = "DllUnregisterServer"; | 14 const char kDefaultUnregistrationEntryPoint[] = "DllUnregisterServer"; |
14 | 15 |
15 // User-level registration export names. | 16 // User-level registration export names. |
16 const char kUserRegistrationEntryPoint[] = "DllRegisterUserServer"; | 17 const char kUserRegistrationEntryPoint[] = "DllRegisterUserServer"; |
17 const char kUserUnregistrationEntryPoint[] = "DllUnregisterUserServer"; | 18 const char kUserUnregistrationEntryPoint[] = "DllUnregisterUserServer"; |
18 | 19 |
(...skipping 27 matching lines...) Expand all Loading... |
46 kUserUnregistrationEntryPoint : | 47 kUserUnregistrationEntryPoint : |
47 kDefaultUnregistrationEntryPoint)); | 48 kDefaultUnregistrationEntryPoint)); |
48 } | 49 } |
49 | 50 |
50 if (NULL != register_server_func) { | 51 if (NULL != register_server_func) { |
51 HRESULT hr = register_server_func(); | 52 HRESULT hr = register_server_func(); |
52 success = SUCCEEDED(hr); | 53 success = SUCCEEDED(hr); |
53 if (!success) { | 54 if (!success) { |
54 PLOG(ERROR) << "Failed to " << (do_register ? "register" : "unregister") | 55 PLOG(ERROR) << "Failed to " << (do_register ? "register" : "unregister") |
55 << " DLL at " << dll_path_.c_str() << | 56 << " DLL at " << dll_path_.c_str() << |
56 StringPrintf(" 0x%08X", hr); | 57 base::StringPrintf(" 0x%08X", hr); |
57 } | 58 } |
58 } else { | 59 } else { |
59 LOG(ERROR) << "COM registration export function not found"; | 60 LOG(ERROR) << "COM registration export function not found"; |
60 } | 61 } |
61 ::FreeLibrary(dll_module); | 62 ::FreeLibrary(dll_module); |
62 } else { | 63 } else { |
63 PLOG(WARNING) << "Failed to load: " << dll_path_; | 64 PLOG(WARNING) << "Failed to load: " << dll_path_; |
64 } | 65 } |
65 return success; | 66 return success; |
66 } | 67 } |
67 | 68 |
68 bool SelfRegWorkItem::Do() { | 69 bool SelfRegWorkItem::Do() { |
69 bool success = RegisterDll(do_register_); | 70 bool success = RegisterDll(do_register_); |
70 if (ignore_failure_) | 71 if (ignore_failure_) |
71 success = true; | 72 success = true; |
72 return success; | 73 return success; |
73 } | 74 } |
74 | 75 |
75 void SelfRegWorkItem::Rollback() { | 76 void SelfRegWorkItem::Rollback() { |
76 if (!ignore_failure_) { | 77 if (!ignore_failure_) { |
77 RegisterDll(!do_register_); | 78 RegisterDll(!do_register_); |
78 } | 79 } |
79 } | 80 } |
OLD | NEW |