OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // This file declares util functions for setup project. | 5 // This file declares util functions for setup project. |
6 | 6 |
7 #include "chrome/installer/setup/setup_util.h" | 7 #include "chrome/installer/setup/setup_util.h" |
8 | 8 |
9 #include <windows.h> | 9 #include <windows.h> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // Copy over all arguments. | 63 // Copy over all arguments. |
64 CommandLine::StringVector args(command_line.GetArgs()); | 64 CommandLine::StringVector args(command_line.GetArgs()); |
65 for (CommandLine::StringVector::const_iterator i = args.begin(); | 65 for (CommandLine::StringVector::const_iterator i = args.begin(); |
66 i != args.end(); ++i) { | 66 i != args.end(); ++i) { |
67 new_cl.AppendArgNative(*i); | 67 new_cl.AppendArgNative(*i); |
68 } | 68 } |
69 | 69 |
70 // Launch the process and wait for it to exit. | 70 // Launch the process and wait for it to exit. |
71 VLOG(1) << "Launching existing installer with command: " | 71 VLOG(1) << "Launching existing installer with command: " |
72 << new_cl.GetCommandLineString(); | 72 << new_cl.GetCommandLineString(); |
73 base::ProcessHandle handle = INVALID_HANDLE_VALUE; | 73 base::Process process = base::LaunchProcess(new_cl, base::LaunchOptions()); |
74 if (!base::LaunchProcess(new_cl, base::LaunchOptions(), &handle)) { | 74 if (!process.IsValid()) { |
75 PLOG(ERROR) << "Failed to launch existing installer with command: " | 75 PLOG(ERROR) << "Failed to launch existing installer with command: " |
76 << new_cl.GetCommandLineString(); | 76 << new_cl.GetCommandLineString(); |
77 return false; | 77 return false; |
78 } | 78 } |
79 if (!base::WaitForExitCode(handle, exit_code)) { | 79 if (!process.WaitForExit(exit_code)) { |
80 PLOG(DFATAL) << "Failed to get exit code from existing installer"; | 80 PLOG(DFATAL) << "Failed to get exit code from existing installer"; |
81 *exit_code = WAIT_FOR_EXISTING_FAILED; | 81 *exit_code = WAIT_FOR_EXISTING_FAILED; |
82 } else { | 82 } else { |
83 VLOG(1) << "Existing installer returned exit code " << *exit_code; | 83 VLOG(1) << "Existing installer returned exit code " << *exit_code; |
84 } | 84 } |
85 return true; | 85 return true; |
86 } | 86 } |
87 | 87 |
88 // Returns true if product |type| cam be meaningfully installed without the | 88 // Returns true if product |type| cam be meaningfully installed without the |
89 // --multi-install flag. | 89 // --multi-install flag. |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 } | 490 } |
491 | 491 |
492 ScopedTokenPrivilege::~ScopedTokenPrivilege() { | 492 ScopedTokenPrivilege::~ScopedTokenPrivilege() { |
493 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { | 493 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { |
494 ::AdjustTokenPrivileges(token_.Get(), FALSE, &previous_privileges_, | 494 ::AdjustTokenPrivileges(token_.Get(), FALSE, &previous_privileges_, |
495 sizeof(TOKEN_PRIVILEGES), NULL, NULL); | 495 sizeof(TOKEN_PRIVILEGES), NULL, NULL); |
496 } | 496 } |
497 } | 497 } |
498 | 498 |
499 } // namespace installer | 499 } // namespace installer |
OLD | NEW |