OLD | NEW |
| (Empty) |
1 // Copyright 2007-2009 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 // This is the API for verifying and executing an executable under high | |
17 // integrity using an Msi Patch. This API assumes its needed Msi has already | |
18 // been installed and its needed Msp is in the same directory as this module. | |
19 // | |
20 // This class encapsulates the code for passing information between a process | |
21 // requesting that an executable be elevated and the custom action DLL | |
22 // in the patch which actually elevates the executable. | |
23 | |
24 #ifndef OMAHA_RECOVERY_REPAIR_EXE_MSPEXECUTABLEELEVATOR_H__ | |
25 #define OMAHA_RECOVERY_REPAIR_EXE_MSPEXECUTABLEELEVATOR_H__ | |
26 | |
27 #include <windows.h> | |
28 #include <tchar.h> | |
29 | |
30 namespace omaha { | |
31 | |
32 namespace msp_executable_elevator { | |
33 | |
34 // The following function should be called by the code requesting that | |
35 // an executable be elevated: | |
36 | |
37 // Use an MSI patch to verify and execute an executable. Returns a handle | |
38 // to the process executed. | |
39 HRESULT ExecuteGoogleSignedExe(const TCHAR* executable, | |
40 const TCHAR* arguments, | |
41 const TCHAR* kProductGuid, | |
42 const TCHAR* kPatchGuid, | |
43 const TCHAR* kPatchName, | |
44 HANDLE* process); | |
45 | |
46 // The following functions should be called by the code (i.e., the custom action | |
47 // DLL) that actually elevates the executable: | |
48 | |
49 // From the command line passed to the MSP, retrieve the parameters that will be | |
50 // passed to VerifyFileAndExecute. | |
51 // This function is destructive to the passed command line buffer. The pointers | |
52 // "executable" and "arguments" will point into the command line buffer. | |
53 bool ParseMSPCommandLine(TCHAR* command_line, | |
54 TCHAR** executable, | |
55 TCHAR** arguments, | |
56 DWORD* calling_process_id); | |
57 | |
58 // Records the result of the call to VerifyFileAndExecute. | |
59 bool SetResultOfExecute(HANDLE process, HRESULT result); | |
60 | |
61 } // namespace msp_executable_elevator | |
62 | |
63 } // namespace omaha | |
64 | |
65 #endif // OMAHA_RECOVERY_REPAIR_EXE_MSPEXECUTABLEELEVATOR_H__ | |
OLD | NEW |