| OLD | NEW |
| (Empty) |
| 1 // Copyright 2009-2010 Google Inc. | |
| 2 // | |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 // you may not use this file except in compliance with the License. | |
| 5 // You may obtain a copy of the License at | |
| 6 // | |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 // | |
| 9 // Unless required by applicable law or agreed to in writing, software | |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 // See the License for the specific language governing permissions and | |
| 13 // limitations under the License. | |
| 14 // ======================================================================== | |
| 15 // | |
| 16 // Contains the ATL service. | |
| 17 | |
| 18 #include "omaha/service/service_main.h" | |
| 19 | |
| 20 namespace omaha { | |
| 21 | |
| 22 // Template arguments need to be non-const TCHAR arrays. | |
| 23 TCHAR kHKRootService[] = _T("HKLM"); | |
| 24 TCHAR kProgIDUpdate3COMClassServiceLocal[] = kProgIDUpdate3COMClassService; | |
| 25 | |
| 26 // A private object map with custom registration works best, even though this | |
| 27 // stuff is deprecated. This is because GoogleUpdate.exe has other objects | |
| 28 // defined elsewhere and we do not want to expose those from the service. | |
| 29 BEGIN_OBJECT_MAP(object_map_google_update3) | |
| 30 OBJECT_ENTRY(__uuidof(GoogleUpdate3ServiceClass), Update3COMClassService) | |
| 31 END_OBJECT_MAP() | |
| 32 | |
| 33 BEGIN_OBJECT_MAP(object_map_google_update_medium) | |
| 34 OBJECT_ENTRY(__uuidof(OnDemandMachineAppsServiceClass), OnDemandService) | |
| 35 OBJECT_ENTRY(__uuidof(GoogleUpdate3WebServiceClass), Update3WebService) | |
| 36 OBJECT_ENTRY(__uuidof(GoogleUpdateCoreClass), GoogleUpdateCoreService) | |
| 37 END_OBJECT_MAP() | |
| 38 | |
| 39 CommandLineMode Update3ServiceMode::commandline_mode() { | |
| 40 return COMMANDLINE_MODE_SERVICE; | |
| 41 } | |
| 42 | |
| 43 CString Update3ServiceMode::reg_name() { | |
| 44 return kRegValueServiceName; | |
| 45 } | |
| 46 | |
| 47 CString Update3ServiceMode::default_name() { | |
| 48 return kServicePrefix; | |
| 49 } | |
| 50 | |
| 51 DWORD Update3ServiceMode::service_start_type() { | |
| 52 return SERVICE_AUTO_START; | |
| 53 } | |
| 54 | |
| 55 _ATL_OBJMAP_ENTRY* Update3ServiceMode::object_map() { | |
| 56 return object_map_google_update3; | |
| 57 } | |
| 58 | |
| 59 bool Update3ServiceMode::allow_access_from_medium() { | |
| 60 return false; | |
| 61 } | |
| 62 | |
| 63 CString Update3ServiceMode::app_id_string() { | |
| 64 return GuidToString(__uuidof(GoogleUpdate3ServiceClass)); | |
| 65 } | |
| 66 | |
| 67 CString Update3ServiceMode::GetCurrentServiceName() { | |
| 68 return goopdate_utils::GetCurrentVersionedName(true, reg_name(), | |
| 69 default_name()); | |
| 70 } | |
| 71 | |
| 72 HRESULT Update3ServiceMode::PreMessageLoop() { | |
| 73 SERVICE_LOG(L1, (_T("[Starting Google Update core...]"))); | |
| 74 CommandLineBuilder builder(COMMANDLINE_MODE_CORE); | |
| 75 CString args = builder.GetCommandLineArgs(); | |
| 76 return goopdate_utils::StartGoogleUpdateWithArgs(true, args, NULL); | |
| 77 } | |
| 78 | |
| 79 CommandLineMode UpdateMediumServiceMode::commandline_mode() { | |
| 80 return COMMANDLINE_MODE_MEDIUM_SERVICE; | |
| 81 } | |
| 82 | |
| 83 CString UpdateMediumServiceMode::reg_name() { | |
| 84 return kRegValueMediumServiceName; | |
| 85 } | |
| 86 | |
| 87 CString UpdateMediumServiceMode::default_name() { | |
| 88 return kMediumServicePrefix; | |
| 89 } | |
| 90 | |
| 91 DWORD UpdateMediumServiceMode::service_start_type() { | |
| 92 return SERVICE_DEMAND_START; | |
| 93 } | |
| 94 | |
| 95 _ATL_OBJMAP_ENTRY* UpdateMediumServiceMode::object_map() { | |
| 96 return object_map_google_update_medium; | |
| 97 } | |
| 98 | |
| 99 bool UpdateMediumServiceMode::allow_access_from_medium() { | |
| 100 return true; | |
| 101 } | |
| 102 | |
| 103 CString UpdateMediumServiceMode::app_id_string() { | |
| 104 return GuidToString(__uuidof(OnDemandMachineAppsServiceClass)); | |
| 105 } | |
| 106 | |
| 107 CString UpdateMediumServiceMode::GetCurrentServiceName() { | |
| 108 return goopdate_utils::GetCurrentVersionedName(true, reg_name(), | |
| 109 default_name()); | |
| 110 } | |
| 111 | |
| 112 HRESULT UpdateMediumServiceMode::PreMessageLoop() { | |
| 113 return S_OK; | |
| 114 } | |
| 115 | |
| 116 } // namespace omaha | |
| OLD | NEW |