| 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/wts_session_process_launcher.h" | 8 #include "remoting/host/win/wts_session_process_launcher.h" |
| 9 | 9 |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "base/process_util.h" | 23 #include "base/process_util.h" |
| 24 #include "base/rand_util.h" | 24 #include "base/rand_util.h" |
| 25 #include "base/stringprintf.h" | 25 #include "base/stringprintf.h" |
| 26 #include "base/utf_string_conversions.h" | 26 #include "base/utf_string_conversions.h" |
| 27 #include "base/win/scoped_handle.h" | 27 #include "base/win/scoped_handle.h" |
| 28 #include "ipc/ipc_channel_proxy.h" | 28 #include "ipc/ipc_channel_proxy.h" |
| 29 #include "ipc/ipc_message.h" | 29 #include "ipc/ipc_message.h" |
| 30 #include "ipc/ipc_message_macros.h" | 30 #include "ipc/ipc_message_macros.h" |
| 31 #include "remoting/host/constants.h" | 31 #include "remoting/host/constants.h" |
| 32 #include "remoting/host/chromoting_messages.h" | 32 #include "remoting/host/chromoting_messages.h" |
| 33 #include "remoting/host/sas_injector.h" | |
| 34 #include "remoting/host/win/launch_process_with_token.h" | 33 #include "remoting/host/win/launch_process_with_token.h" |
| 35 #include "remoting/host/win/wts_console_monitor.h" | 34 #include "remoting/host/win/wts_console_monitor.h" |
| 36 | 35 |
| 37 using base::win::ScopedHandle; | 36 using base::win::ScopedHandle; |
| 38 using base::TimeDelta; | 37 using base::TimeDelta; |
| 39 | 38 |
| 40 namespace { | 39 namespace { |
| 41 | 40 |
| 42 // The minimum and maximum delays between attempts to inject host process into | 41 // The minimum and maximum delays between attempts to inject host process into |
| 43 // a session. | 42 // a session. |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 272 |
| 274 // Get a handle to the peer process so we could query its exit code later. | 273 // Get a handle to the peer process so we could query its exit code later. |
| 275 // Ignore the error. If the processes cannot be open the error code is generic | 274 // Ignore the error. If the processes cannot be open the error code is generic |
| 276 // |CONTROL_C_EXIT|. | 275 // |CONTROL_C_EXIT|. |
| 277 worker_process_.Set(OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, peer_pid)); | 276 worker_process_.Set(OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, peer_pid)); |
| 278 } | 277 } |
| 279 | 278 |
| 280 bool WtsSessionProcessLauncher::OnMessageReceived(const IPC::Message& message) { | 279 bool WtsSessionProcessLauncher::OnMessageReceived(const IPC::Message& message) { |
| 281 DCHECK(main_message_loop_->BelongsToCurrentThread()); | 280 DCHECK(main_message_loop_->BelongsToCurrentThread()); |
| 282 | 281 |
| 283 bool handled = true; | 282 return false; |
| 284 IPC_BEGIN_MESSAGE_MAP(WtsSessionProcessLauncher, message) | |
| 285 IPC_MESSAGE_HANDLER(ChromotingHostMsg_SendSasToConsole, | |
| 286 OnSendSasToConsole) | |
| 287 IPC_MESSAGE_UNHANDLED(handled = false) | |
| 288 IPC_END_MESSAGE_MAP() | |
| 289 return handled; | |
| 290 } | |
| 291 | |
| 292 void WtsSessionProcessLauncher::OnSendSasToConsole() { | |
| 293 DCHECK(main_message_loop_->BelongsToCurrentThread()); | |
| 294 | |
| 295 if (attached_) { | |
| 296 if (sas_injector_.get() == NULL) { | |
| 297 sas_injector_ = SasInjector::Create(); | |
| 298 } | |
| 299 | |
| 300 if (sas_injector_.get() != NULL) { | |
| 301 sas_injector_->InjectSas(); | |
| 302 } | |
| 303 } | |
| 304 } | 283 } |
| 305 | 284 |
| 306 void WtsSessionProcessLauncher::OnSessionAttached(uint32 session_id) { | 285 void WtsSessionProcessLauncher::OnSessionAttached(uint32 session_id) { |
| 307 DCHECK(main_message_loop_->BelongsToCurrentThread()); | 286 DCHECK(main_message_loop_->BelongsToCurrentThread()); |
| 308 | 287 |
| 309 if (stoppable_state() != Stoppable::kRunning) { | 288 if (stoppable_state() != Stoppable::kRunning) { |
| 310 return; | 289 return; |
| 311 } | 290 } |
| 312 | 291 |
| 313 DCHECK(!attached_); | 292 DCHECK(!attached_); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 DCHECK(!job_.IsValid()); | 418 DCHECK(!job_.IsValid()); |
| 440 DCHECK_EQ(job_state_, kJobUninitialized); | 419 DCHECK_EQ(job_state_, kJobUninitialized); |
| 441 | 420 |
| 442 if (stoppable_state() == Stoppable::kRunning) { | 421 if (stoppable_state() == Stoppable::kRunning) { |
| 443 job_ = job->Pass(); | 422 job_ = job->Pass(); |
| 444 job_state_ = kJobRunning; | 423 job_state_ = kJobRunning; |
| 445 } | 424 } |
| 446 } | 425 } |
| 447 | 426 |
| 448 } // namespace remoting | 427 } // namespace remoting |
| OLD | NEW |