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 // Contains ProcessLauncher class to launch a process using a COM interface. The | |
17 // COM object is typically created by the caller as a medium integrity object | |
18 // impersonating the identity of the active user. This is to allow for launching | |
19 // a medium-integrity process from a high-integrity process. | |
20 | |
21 #ifndef OMAHA_GOOPDATE_PROCESS_LAUNCHER_H__ | |
22 #define OMAHA_GOOPDATE_PROCESS_LAUNCHER_H__ | |
23 | |
24 #include <windows.h> | |
25 #include <atlbase.h> | |
26 #include <atlcom.h> | |
27 #include <atlstr.h> | |
28 #include "omaha/base/atlregmapex.h" | |
29 #include "omaha/common/const_cmd_line.h" | |
30 #include "omaha/common/const_goopdate.h" | |
31 #include "omaha/common/goopdate_utils.h" | |
32 #include "omaha/goopdate/com_proxy.h" | |
33 #include "omaha/goopdate/non_localized_resource.h" | |
34 | |
35 // Generated by MIDL in the "BUILD_MODE.OBJ_ROOT + SETTINGS.SUBDIR". | |
36 #include "goopdate/omaha3_idl.h" | |
37 | |
38 namespace omaha { | |
39 | |
40 const TCHAR* const kTlbVersion = _T("1.0"); | |
41 const TCHAR* const kProcessWorkerDescription = | |
42 _T("Google Update Process Launcher Class"); | |
43 | |
44 class ATL_NO_VTABLE ProcessLauncher | |
45 : public CComObjectRootEx<CComMultiThreadModel>, | |
46 public CComCoClass<ProcessLauncher, &__uuidof(ProcessLauncherClass)>, | |
47 public IProcessLauncher, | |
48 public StdMarshalInfo { | |
49 public: | |
50 ProcessLauncher(); | |
51 virtual ~ProcessLauncher(); | |
52 | |
53 DECLARE_NOT_AGGREGATABLE(ProcessLauncher) | |
54 DECLARE_PROTECT_FINAL_CONSTRUCT() | |
55 | |
56 DECLARE_REGISTRY_RESOURCEID_EX(IDR_LOCAL_SERVER_RGS) | |
57 | |
58 #pragma warning(push) | |
59 // C4640: construction of local static object is not thread-safe | |
60 #pragma warning(disable : 4640) | |
61 BEGIN_REGISTRY_MAP() | |
62 REGMAP_ENTRY(_T("HKROOT"), goopdate_utils::GetHKRoot()) | |
63 REGMAP_MODULE2(_T("MODULE"), kOmahaOnDemandFileName) | |
64 REGMAP_ENTRY(_T("VERSION"), kTlbVersion) | |
65 REGMAP_ENTRY(_T("PROGID"), kProgIDProcessLauncher) | |
66 REGMAP_ENTRY(_T("DESCRIPTION"), kProcessWorkerDescription) | |
67 REGMAP_UUID(_T("CLSID"), __uuidof(ProcessLauncherClass)) | |
68 END_REGISTRY_MAP() | |
69 #pragma warning(pop) | |
70 | |
71 // C4505: unreferenced IUnknown local functions have been removed | |
72 #pragma warning(disable : 4505) | |
73 BEGIN_COM_MAP(ProcessLauncher) | |
74 COM_INTERFACE_ENTRY(IProcessLauncher) | |
75 COM_INTERFACE_ENTRY(IStdMarshalInfo) | |
76 END_COM_MAP() | |
77 | |
78 // Launches a command line at medium integrity. | |
79 STDMETHOD(LaunchCmdLine)(const TCHAR* cmd_line); | |
80 | |
81 // Launches the appropriate browser. | |
82 STDMETHOD(LaunchBrowser)(DWORD type, const TCHAR* url); | |
83 | |
84 // Launches a command line elevated. | |
85 STDMETHOD(LaunchCmdElevated)(const WCHAR* app_guid, | |
86 const WCHAR* cmd_id, | |
87 DWORD caller_proc_id, | |
88 ULONG_PTR* proc_handle); | |
89 | |
90 private: | |
91 DISALLOW_EVIL_CONSTRUCTORS(ProcessLauncher); | |
92 }; | |
93 | |
94 } // namespace omaha | |
95 | |
96 #endif // OMAHA_GOOPDATE_PROCESS_LAUNCHER_H__ | |
OLD | NEW |