| 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 implements the Windows service controlling Me2Me host processes | 5 // This file implements the Windows service controlling Me2Me host processes |
| 6 // running within user sessions. | 6 // running within user sessions. |
| 7 | 7 |
| 8 #include "remoting/host/win/host_service.h" | 8 #include "remoting/host/win/host_service.h" |
| 9 | 9 |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 #if defined(REMOTING_MULTI_PROCESS) | 33 #if defined(REMOTING_MULTI_PROCESS) |
| 34 #include "remoting/host/daemon_process.h" | 34 #include "remoting/host/daemon_process.h" |
| 35 #endif // defined(REMOTING_MULTI_PROCESS) | 35 #endif // defined(REMOTING_MULTI_PROCESS) |
| 36 | 36 |
| 37 #include "remoting/host/usage_stats_consent.h" | 37 #include "remoting/host/usage_stats_consent.h" |
| 38 #include "remoting/host/win/host_service_resource.h" | 38 #include "remoting/host/win/host_service_resource.h" |
| 39 #include "remoting/host/win/wts_console_observer.h" | 39 #include "remoting/host/win/wts_console_observer.h" |
| 40 | 40 |
| 41 #if !defined(REMOTING_MULTI_PROCESS) | 41 #if !defined(REMOTING_MULTI_PROCESS) |
| 42 #include "remoting/host/win/wts_session_process_launcher.h" | 42 #include "remoting/host/win/wts_console_session_process_driver.h" |
| 43 #endif // !defined(REMOTING_MULTI_PROCESS) | 43 #endif // !defined(REMOTING_MULTI_PROCESS) |
| 44 | 44 |
| 45 using base::StringPrintf; | 45 using base::StringPrintf; |
| 46 | 46 |
| 47 namespace { | 47 namespace { |
| 48 | 48 |
| 49 // Session id that does not represent any session. | 49 // Session id that does not represent any session. |
| 50 const uint32 kInvalidSessionId = 0xffffffffu; | 50 const uint32 kInvalidSessionId = 0xffffffffu; |
| 51 | 51 |
| 52 const char kIoThreadName[] = "I/O thread"; | 52 const char kIoThreadName[] = "I/O thread"; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 #if defined(REMOTING_MULTI_PROCESS) | 206 #if defined(REMOTING_MULTI_PROCESS) |
| 207 | 207 |
| 208 child_ = DaemonProcess::Create( | 208 child_ = DaemonProcess::Create( |
| 209 main_task_runner_, | 209 main_task_runner_, |
| 210 io_task_runner, | 210 io_task_runner, |
| 211 base::Bind(&HostService::OnChildStopped, | 211 base::Bind(&HostService::OnChildStopped, |
| 212 base::Unretained(this))).PassAs<Stoppable>(); | 212 base::Unretained(this))).PassAs<Stoppable>(); |
| 213 | 213 |
| 214 #else // !defined(REMOTING_MULTI_PROCESS) | 214 #else // !defined(REMOTING_MULTI_PROCESS) |
| 215 | 215 |
| 216 // Create the session process launcher. | 216 // Create the console session process driver. |
| 217 child_.reset(new WtsSessionProcessLauncher( | 217 child_.reset(new WtsConsoleSessionProcessDriver( |
| 218 base::Bind(&HostService::OnChildStopped, base::Unretained(this)), | 218 base::Bind(&HostService::OnChildStopped, base::Unretained(this)), |
| 219 this, | 219 this, |
| 220 main_task_runner_, | 220 main_task_runner_, |
| 221 io_task_runner)); | 221 io_task_runner)); |
| 222 | 222 |
| 223 #endif // !defined(REMOTING_MULTI_PROCESS) | 223 #endif // !defined(REMOTING_MULTI_PROCESS) |
| 224 } | 224 } |
| 225 | 225 |
| 226 void HostService::RunMessageLoop(MessageLoop* message_loop) { | 226 void HostService::RunMessageLoop(MessageLoop* message_loop) { |
| 227 // Launch the I/O thread. | 227 // Launch the I/O thread. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 242 int HostService::Elevate() { | 242 int HostService::Elevate() { |
| 243 // Get the name of the binary to launch. | 243 // Get the name of the binary to launch. |
| 244 FilePath binary = | 244 FilePath binary = |
| 245 CommandLine::ForCurrentProcess()->GetSwitchValuePath(kElevateSwitchName); | 245 CommandLine::ForCurrentProcess()->GetSwitchValuePath(kElevateSwitchName); |
| 246 | 246 |
| 247 // Create the child process command line by copying known switches from our | 247 // Create the child process command line by copying known switches from our |
| 248 // command line. | 248 // command line. |
| 249 CommandLine command_line(CommandLine::NO_PROGRAM); | 249 CommandLine command_line(CommandLine::NO_PROGRAM); |
| 250 command_line.CopySwitchesFrom(*CommandLine::ForCurrentProcess(), | 250 command_line.CopySwitchesFrom(*CommandLine::ForCurrentProcess(), |
| 251 kCopiedSwitchNames, | 251 kCopiedSwitchNames, |
| 252 _countof(kCopiedSwitchNames)); | 252 arraysize(kCopiedSwitchNames)); |
| 253 CommandLine::StringType parameters = command_line.GetCommandLineString(); | 253 CommandLine::StringType parameters = command_line.GetCommandLineString(); |
| 254 | 254 |
| 255 // Launch the child process requesting elevation. | 255 // Launch the child process requesting elevation. |
| 256 SHELLEXECUTEINFO info; | 256 SHELLEXECUTEINFO info; |
| 257 memset(&info, 0, sizeof(info)); | 257 memset(&info, 0, sizeof(info)); |
| 258 info.cbSize = sizeof(info); | 258 info.cbSize = sizeof(info); |
| 259 info.lpVerb = L"runas"; | 259 info.lpVerb = L"runas"; |
| 260 info.lpFile = binary.value().c_str(); | 260 info.lpFile = binary.value().c_str(); |
| 261 info.lpParameters = parameters.c_str(); | 261 info.lpParameters = parameters.c_str(); |
| 262 info.nShow = SW_SHOWNORMAL; | 262 info.nShow = SW_SHOWNORMAL; |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 } | 499 } |
| 500 | 500 |
| 501 remoting::HostService* service = remoting::HostService::GetInstance(); | 501 remoting::HostService* service = remoting::HostService::GetInstance(); |
| 502 if (!service->InitWithCommandLine(command_line)) { | 502 if (!service->InitWithCommandLine(command_line)) { |
| 503 usage(command_line->GetProgram()); | 503 usage(command_line->GetProgram()); |
| 504 return kUsageExitCode; | 504 return kUsageExitCode; |
| 505 } | 505 } |
| 506 | 506 |
| 507 return service->Run(); | 507 return service->Run(); |
| 508 } | 508 } |
| OLD | NEW |