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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 if (base::win::GetVersion() > base::win::VERSION_XP) { | 223 if (base::win::GetVersion() > base::win::VERSION_XP) { |
224 // Make sure that in Vista and Above we have the proper DACLs so | 224 // Make sure that in Vista and Above we have the proper DACLs so |
225 // the interactive user can launch it. | 225 // the interactive user can launch it. |
226 if (!FixDACLsForExecute(cmd_line->GetProgram())) | 226 if (!FixDACLsForExecute(cmd_line->GetProgram())) |
227 NOTREACHED(); | 227 NOTREACHED(); |
228 } | 228 } |
229 | 229 |
230 DWORD console_id = ::WTSGetActiveConsoleSessionId(); | 230 DWORD console_id = ::WTSGetActiveConsoleSessionId(); |
231 if (console_id == 0xFFFFFFFF) { | 231 if (console_id == 0xFFFFFFFF) { |
232 PLOG(ERROR) << __FUNCTION__ << " failed to get active session id"; | 232 PLOG(ERROR) << __func__ << " failed to get active session id"; |
233 return false; | 233 return false; |
234 } | 234 } |
235 HANDLE user_token; | 235 HANDLE user_token; |
236 if (!::WTSQueryUserToken(console_id, &user_token)) { | 236 if (!::WTSQueryUserToken(console_id, &user_token)) { |
237 PLOG(ERROR) << __FUNCTION__ << " failed to get user token for console_id " | 237 PLOG(ERROR) << __func__ << " failed to get user token for console_id " |
238 << console_id; | 238 << console_id; |
239 return false; | 239 return false; |
240 } | 240 } |
241 // Note: Handle inheritance must be true in order for the child process to be | 241 // Note: Handle inheritance must be true in order for the child process to be |
242 // able to use the duplicated handle above (Google Update results). | 242 // able to use the duplicated handle above (Google Update results). |
243 base::LaunchOptions options; | 243 base::LaunchOptions options; |
244 options.as_user = user_token; | 244 options.as_user = user_token; |
245 options.inherit_handles = true; | 245 options.inherit_handles = true; |
246 options.empty_desktop_name = true; | 246 options.empty_desktop_name = true; |
247 VLOG(1) << __FUNCTION__ << " launching " << cmd_line->GetCommandLineString(); | 247 VLOG(1) << __func__ << " launching " << cmd_line->GetCommandLineString(); |
248 base::Process process = base::LaunchProcess(*cmd_line, options); | 248 base::Process process = base::LaunchProcess(*cmd_line, options); |
249 ::CloseHandle(user_token); | 249 ::CloseHandle(user_token); |
250 VLOG(1) << __FUNCTION__ << " result: " << process.IsValid(); | 250 VLOG(1) << __func__ << " result: " << process.IsValid(); |
251 return process.IsValid(); | 251 return process.IsValid(); |
252 } | 252 } |
253 | 253 |
254 // A helper function that writes to HKLM if the handle was passed through the | 254 // A helper function that writes to HKLM if the handle was passed through the |
255 // command line, but HKCU otherwise. |experiment_group| is the value to write | 255 // command line, but HKCU otherwise. |experiment_group| is the value to write |
256 // and |last_write| is used when writing to HKLM to determine whether to close | 256 // and |last_write| is used when writing to HKLM to determine whether to close |
257 // the handle when done. | 257 // the handle when done. |
258 void SetClient(const base::string16& experiment_group, bool last_write) { | 258 void SetClient(const base::string16& experiment_group, bool last_write) { |
259 static int reg_key_handle = -1; | 259 static int reg_key_handle = -1; |
260 if (reg_key_handle == -1) { | 260 if (reg_key_handle == -1) { |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 // running. | 529 // running. |
530 bool system_level_toast = base::CommandLine::ForCurrentProcess()->HasSwitch( | 530 bool system_level_toast = base::CommandLine::ForCurrentProcess()->HasSwitch( |
531 switches::kSystemLevelToast); | 531 switches::kSystemLevelToast); |
532 | 532 |
533 base::CommandLine cmd(InstallUtil::GetChromeUninstallCmd( | 533 base::CommandLine cmd(InstallUtil::GetChromeUninstallCmd( |
534 system_level_toast, product.distribution()->GetType())); | 534 system_level_toast, product.distribution()->GetType())); |
535 base::LaunchProcess(cmd, base::LaunchOptions()); | 535 base::LaunchProcess(cmd, base::LaunchOptions()); |
536 } | 536 } |
537 | 537 |
538 } // namespace installer | 538 } // namespace installer |
OLD | NEW |