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 HANDLE temp_handle; | 516 ScopedHandle limited_handle; |
517 if (!DuplicateHandle(GetCurrentProcess(), | 517 if (!DuplicateHandle(GetCurrentProcess(), |
518 worker_process_, | 518 worker_process_, |
519 GetCurrentProcess(), | 519 GetCurrentProcess(), |
520 &temp_handle, | 520 limited_handle.Receive(), |
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); | |
529 | 528 |
530 event_handler_->OnProcessLaunched(limited_handle.Pass()); | 529 event_handler_->OnProcessLaunched(limited_handle.Pass()); |
531 } | 530 } |
532 | 531 |
533 WtsSessionProcessDelegate::WtsSessionProcessDelegate( | 532 WtsSessionProcessDelegate::WtsSessionProcessDelegate( |
534 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 533 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
535 scoped_ptr<CommandLine> target_command, | 534 scoped_ptr<CommandLine> target_command, |
536 bool launch_elevated, | 535 bool launch_elevated, |
537 const std::string& channel_security) { | 536 const std::string& channel_security) { |
538 core_ = new Core(io_task_runner, | 537 core_ = new Core(io_task_runner, |
(...skipping 21 matching lines...) Expand all Loading... |
560 | 559 |
561 void WtsSessionProcessDelegate::CloseChannel() { | 560 void WtsSessionProcessDelegate::CloseChannel() { |
562 core_->CloseChannel(); | 561 core_->CloseChannel(); |
563 } | 562 } |
564 | 563 |
565 void WtsSessionProcessDelegate::KillProcess() { | 564 void WtsSessionProcessDelegate::KillProcess() { |
566 core_->KillProcess(); | 565 core_->KillProcess(); |
567 } | 566 } |
568 | 567 |
569 } // namespace remoting | 568 } // namespace remoting |
OLD | NEW |