OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/installer/util/user_experiment.h" | 5 #include "chrome/installer/util/user_experiment.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <sddl.h> | 8 #include <sddl.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // does not perform the actual toasting, it launches another Setup (as user) | 129 // does not perform the actual toasting, it launches another Setup (as user) |
130 // to do so. That is the process that needs the key. | 130 // to do so. That is the process that needs the key. |
131 std::string key(switches::kToastResultsKey); | 131 std::string key(switches::kToastResultsKey); |
132 std::string toast_key = current_cmd_line.GetSwitchValueASCII(key); | 132 std::string toast_key = current_cmd_line.GetSwitchValueASCII(key); |
133 if (!toast_key.empty()) { | 133 if (!toast_key.empty()) { |
134 cmd_line->AppendSwitchASCII(key, toast_key); | 134 cmd_line->AppendSwitchASCII(key, toast_key); |
135 | 135 |
136 // Use handle inheritance to make sure the duplicated toast results key | 136 // Use handle inheritance to make sure the duplicated toast results key |
137 // gets inherited by the child process. | 137 // gets inherited by the child process. |
138 base::LaunchOptions options; | 138 base::LaunchOptions options; |
139 options.inherit_handles = true; | 139 options.inherit_mode = base::LaunchOptions::Inherit::kAll; |
140 base::Process process = base::LaunchProcess(*cmd_line, options); | 140 base::Process process = base::LaunchProcess(*cmd_line, options); |
141 return process.IsValid(); | 141 return process.IsValid(); |
142 } | 142 } |
143 } | 143 } |
144 | 144 |
145 base::Process process = base::LaunchProcess(*cmd_line, base::LaunchOptions()); | 145 base::Process process = base::LaunchProcess(*cmd_line, base::LaunchOptions()); |
146 return process.IsValid(); | 146 return process.IsValid(); |
147 } | 147 } |
148 | 148 |
149 // For System level installs, setup.exe lives in the system temp, which | 149 // For System level installs, setup.exe lives in the system temp, which |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 HANDLE user_token; | 232 HANDLE user_token; |
233 if (!::WTSQueryUserToken(console_id, &user_token)) { | 233 if (!::WTSQueryUserToken(console_id, &user_token)) { |
234 PLOG(ERROR) << __func__ << " failed to get user token for console_id " | 234 PLOG(ERROR) << __func__ << " failed to get user token for console_id " |
235 << console_id; | 235 << console_id; |
236 return false; | 236 return false; |
237 } | 237 } |
238 // Note: Handle inheritance must be true in order for the child process to be | 238 // Note: Handle inheritance must be true in order for the child process to be |
239 // able to use the duplicated handle above (Google Update results). | 239 // able to use the duplicated handle above (Google Update results). |
240 base::LaunchOptions options; | 240 base::LaunchOptions options; |
241 options.as_user = user_token; | 241 options.as_user = user_token; |
242 options.inherit_handles = true; | 242 options.inherit_mode = base::LaunchOptions::Inherit::kAll; |
243 options.empty_desktop_name = true; | 243 options.empty_desktop_name = true; |
244 VLOG(1) << __func__ << " launching " << cmd_line->GetCommandLineString(); | 244 VLOG(1) << __func__ << " launching " << cmd_line->GetCommandLineString(); |
245 base::Process process = base::LaunchProcess(*cmd_line, options); | 245 base::Process process = base::LaunchProcess(*cmd_line, options); |
246 ::CloseHandle(user_token); | 246 ::CloseHandle(user_token); |
247 VLOG(1) << __func__ << " result: " << process.IsValid(); | 247 VLOG(1) << __func__ << " result: " << process.IsValid(); |
248 return process.IsValid(); | 248 return process.IsValid(); |
249 } | 249 } |
250 | 250 |
251 // A helper function that writes to HKLM if the handle was passed through the | 251 // A helper function that writes to HKLM if the handle was passed through the |
252 // command line, but HKCU otherwise. |experiment_group| is the value to write | 252 // command line, but HKCU otherwise. |experiment_group| is the value to write |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 // we waited for chrome to exit so the uninstall would not detect chrome | 525 // we waited for chrome to exit so the uninstall would not detect chrome |
526 // running. | 526 // running. |
527 bool system_level_toast = base::CommandLine::ForCurrentProcess()->HasSwitch( | 527 bool system_level_toast = base::CommandLine::ForCurrentProcess()->HasSwitch( |
528 switches::kSystemLevelToast); | 528 switches::kSystemLevelToast); |
529 | 529 |
530 base::CommandLine cmd(InstallUtil::GetChromeUninstallCmd(system_level_toast)); | 530 base::CommandLine cmd(InstallUtil::GetChromeUninstallCmd(system_level_toast)); |
531 base::LaunchProcess(cmd, base::LaunchOptions()); | 531 base::LaunchProcess(cmd, base::LaunchOptions()); |
532 } | 532 } |
533 | 533 |
534 } // namespace installer | 534 } // namespace installer |
OLD | NEW |