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_delegate.h" | 8 #include "remoting/host/win/wts_session_process_delegate.h" |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 base::win::ScopedHandle worker_process) { | 506 base::win::ScopedHandle worker_process) { |
507 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 507 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
508 DCHECK(!worker_process_.IsValid()); | 508 DCHECK(!worker_process_.IsValid()); |
509 | 509 |
510 worker_process_ = worker_process.Pass(); | 510 worker_process_ = worker_process.Pass(); |
511 | 511 |
512 // Report a handle that can be used to wait for the worker process completion, | 512 // Report a handle that can be used to wait for the worker process completion, |
513 // query information about the process and duplicate handles. | 513 // query information about the process and duplicate handles. |
514 DWORD desired_access = | 514 DWORD desired_access = |
515 SYNCHRONIZE | PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION; | 515 SYNCHRONIZE | PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION; |
516 ScopedHandle limited_handle; | 516 HANDLE temp_handle; |
517 if (!DuplicateHandle(GetCurrentProcess(), | 517 if (!DuplicateHandle(GetCurrentProcess(), |
518 worker_process_, | 518 worker_process_, |
519 GetCurrentProcess(), | 519 GetCurrentProcess(), |
520 limited_handle.Receive(), | 520 &temp_handle, |
521 desired_access, | 521 desired_access, |
522 FALSE, | 522 FALSE, |
523 0)) { | 523 0)) { |
524 LOG_GETLASTERROR(ERROR) << "Failed to duplicate a handle"; | 524 LOG_GETLASTERROR(ERROR) << "Failed to duplicate a handle"; |
525 ReportFatalError(); | 525 ReportFatalError(); |
526 return; | 526 return; |
527 } | 527 } |
| 528 ScopedHandle limited_handle(temp_handle); |
528 | 529 |
529 event_handler_->OnProcessLaunched(limited_handle.Pass()); | 530 event_handler_->OnProcessLaunched(limited_handle.Pass()); |
530 } | 531 } |
531 | 532 |
532 WtsSessionProcessDelegate::WtsSessionProcessDelegate( | 533 WtsSessionProcessDelegate::WtsSessionProcessDelegate( |
533 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 534 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
534 scoped_ptr<CommandLine> target_command, | 535 scoped_ptr<CommandLine> target_command, |
535 bool launch_elevated, | 536 bool launch_elevated, |
536 const std::string& channel_security) { | 537 const std::string& channel_security) { |
537 core_ = new Core(io_task_runner, | 538 core_ = new Core(io_task_runner, |
(...skipping 21 matching lines...) Expand all Loading... |
559 | 560 |
560 void WtsSessionProcessDelegate::CloseChannel() { | 561 void WtsSessionProcessDelegate::CloseChannel() { |
561 core_->CloseChannel(); | 562 core_->CloseChannel(); |
562 } | 563 } |
563 | 564 |
564 void WtsSessionProcessDelegate::KillProcess() { | 565 void WtsSessionProcessDelegate::KillProcess() { |
565 core_->KillProcess(); | 566 core_->KillProcess(); |
566 } | 567 } |
567 | 568 |
568 } // namespace remoting | 569 } // namespace remoting |
OLD | NEW |