Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: recovery/repair_exe/custom_action/testelevateusingmsp.cc

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 // Command line utility that elevates an executable using an MSI Patch.
17 // The MSI patch is assumed to be in the same directory as this executable.
18
19 #include <windows.h>
20 #include <atlstr.h>
21 #include "omaha/base/constants.h"
22 #include "omaha/recovery/repair_exe/mspexecutableelevator.h"
23
24 int main(int argc, char** argv) {
25 DWORD process_id = 0;
26 if (2 <= argc) {
27 CString arguments;
28 if (3 <= argc) {
29 arguments = argv[2];
30 }
31 HANDLE process = NULL;
32 HRESULT hr = omaha::msp_executable_elevator::ExecuteGoogleSignedExe(
33 CString(argv[1]),
34 arguments,
35 omaha::kHelperInstallerProductGuid,
36 omaha::kHelperPatchGuid,
37 omaha::kHelperPatchName,
38 &process);
39 if (process) {
40 process_id = ::GetProcessId(process);
41 ::CloseHandle(process);
42 }
43 wprintf(_T("%s (process handle:%x process id: %u hresult:%x)"),
44 (SUCCEEDED(hr) ? _T("Success") : _T("Failure")),
45 process,
46 process_id,
47 static_cast<int>(hr));
48 } else {
49 static TCHAR explain_test[] =
50 _T("testelevateusingmsp\n\n")
51 _T("To use this test, pass the full path to an executable containing ")
52 _T("the Google Update Repair resource and is signed with a Google ")
53 _T("code-signing certificate that has a certain subject and ")
54 _T("organization unit name.")
55 _T("\n\nAn optional parameter to that executable may be passed as well.");
56 wprintf(explain_test);
57 }
58 return process_id;
59 }
OLDNEW
« no previous file with comments | « recovery/repair_exe/custom_action/executecustomaction.def ('k') | recovery/repair_exe/msp/build.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698