| OLD | NEW |
| (Empty) |
| 1 // Copyright 2008-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 #ifndef OMAHA_CORE_GOOGLE_UPDATE_CORE_H_ | |
| 17 #define OMAHA_CORE_GOOGLE_UPDATE_CORE_H_ | |
| 18 | |
| 19 #include <windows.h> | |
| 20 #include <atlbase.h> | |
| 21 #include <atlcom.h> | |
| 22 #include <atlstr.h> | |
| 23 #include "base/atlregmapex.h" | |
| 24 #include "base/preprocessor_fun.h" | |
| 25 #include "base/synchronized.h" | |
| 26 #include "omaha/common/const_goopdate.h" | |
| 27 #include "omaha/goopdate/com_proxy.h" | |
| 28 #include "omaha/goopdate/elevation_moniker_resource.h" | |
| 29 #include "omaha/goopdate/non_localized_resource.h" | |
| 30 | |
| 31 // Generated by MIDL in the "BUILD_MODE.OBJ_ROOT + SETTINGS.SUBDIR". | |
| 32 #include "goopdate/omaha3_idl.h" | |
| 33 | |
| 34 namespace omaha { | |
| 35 | |
| 36 #pragma warning(push) | |
| 37 // Construction of local static object is not thread-safe | |
| 38 #pragma warning(disable:4640) | |
| 39 | |
| 40 class ATL_NO_VTABLE GoogleUpdateCoreBase | |
| 41 : public CComObjectRootEx<CComMultiThreadModel>, | |
| 42 public IGoogleUpdateCore, | |
| 43 public StdMarshalInfo { | |
| 44 public: | |
| 45 GoogleUpdateCoreBase(); | |
| 46 virtual ~GoogleUpdateCoreBase(); | |
| 47 | |
| 48 BEGIN_COM_MAP(GoogleUpdateCoreBase) | |
| 49 COM_INTERFACE_ENTRY(IGoogleUpdateCore) | |
| 50 COM_INTERFACE_ENTRY(IStdMarshalInfo) | |
| 51 END_COM_MAP() | |
| 52 | |
| 53 // Launches a command line elevated. | |
| 54 STDMETHOD(LaunchCmdElevated)(const WCHAR* app_guid, | |
| 55 const WCHAR* cmd_id, | |
| 56 DWORD caller_proc_id, | |
| 57 ULONG_PTR* proc_handle); | |
| 58 private: | |
| 59 // If the COM caller has permissions for process proc_id, opens and returns | |
| 60 // the process handle. | |
| 61 static HRESULT OpenCallerProcessHandle(DWORD proc_id, HANDLE* proc_handle); | |
| 62 | |
| 63 friend class GoogleUpdateCoreTest; | |
| 64 | |
| 65 DISALLOW_EVIL_CONSTRUCTORS(GoogleUpdateCoreBase); | |
| 66 }; | |
| 67 | |
| 68 template <bool is_service> | |
| 69 class ATL_NO_VTABLE GoogleUpdateCore | |
| 70 : public GoogleUpdateCoreBase, | |
| 71 public CComCoClass<GoogleUpdateCore<is_service> > { | |
| 72 public: | |
| 73 GoogleUpdateCore() {} | |
| 74 virtual ~GoogleUpdateCore() {} | |
| 75 | |
| 76 DECLARE_NOT_AGGREGATABLE(GoogleUpdateCore) | |
| 77 DECLARE_REGISTRY_RESOURCEID_EX(is_service ? IDR_LOCAL_SERVICE_RGS : | |
| 78 IDR_LOCAL_SERVER_ELEVATION_RGS) | |
| 79 | |
| 80 BEGIN_REGISTRY_MAP() | |
| 81 REGMAP_ENTRY(_T("PROGID"), is_service ? kProgIDGoogleUpdateCoreService : | |
| 82 kProgIDGoogleUpdateCoreMachine) | |
| 83 REGMAP_ENTRY(_T("VERSION"), _T("1")) | |
| 84 REGMAP_ENTRY(_T("NAME"), _T("GoogleUpdateCoreClass")) | |
| 85 REGMAP_ENTRY(_T("DESCRIPTION"), _T("Google Update Core Class")) | |
| 86 REGMAP_UUID(_T("CLSID"), is_service ? | |
| 87 __uuidof(GoogleUpdateCoreClass) : | |
| 88 __uuidof(GoogleUpdateCoreMachineClass)) | |
| 89 REGMAP_ENTRY(L"ICONRESID", PP_STRINGIZE(IDI_ELEVATION_MONIKER_ICON)) | |
| 90 REGMAP_ENTRY(L"STRINGRESID", | |
| 91 PP_STRINGIZE(IDS_ELEVATION_MONIKER_DISPLAYNAME)) | |
| 92 REGMAP_MODULE2(L"MODULE", kOmahaOnDemandFileName) | |
| 93 END_REGISTRY_MAP() | |
| 94 | |
| 95 private: | |
| 96 | |
| 97 DISALLOW_EVIL_CONSTRUCTORS(GoogleUpdateCore); | |
| 98 }; | |
| 99 | |
| 100 typedef GoogleUpdateCore<false> GoogleUpdateCoreMachine; | |
| 101 typedef GoogleUpdateCore<true> GoogleUpdateCoreService; | |
| 102 | |
| 103 #pragma warning(pop) | |
| 104 | |
| 105 } // namespace omaha | |
| 106 | |
| 107 #endif // OMAHA_CORE_GOOGLE_UPDATE_CORE_H_ | |
| OLD | NEW |