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 <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
18 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
20 #include "base/threading/thread_task_runner_handle.h" | 20 #include "base/threading/thread_task_runner_handle.h" |
21 #include "base/win/scoped_handle.h" | 21 #include "base/win/scoped_handle.h" |
22 #include "base/win/windows_version.h" | |
23 #include "ipc/attachment_broker.h" | 22 #include "ipc/attachment_broker.h" |
24 #include "ipc/ipc_channel.h" | 23 #include "ipc/ipc_channel.h" |
25 #include "ipc/ipc_channel_proxy.h" | 24 #include "ipc/ipc_channel_proxy.h" |
26 #include "ipc/ipc_listener.h" | 25 #include "ipc/ipc_listener.h" |
27 #include "ipc/ipc_message.h" | 26 #include "ipc/ipc_message.h" |
28 #include "remoting/host/host_main.h" | 27 #include "remoting/host/host_main.h" |
29 #include "remoting/host/ipc_constants.h" | 28 #include "remoting/host/ipc_constants.h" |
30 #include "remoting/host/ipc_util.h" | 29 #include "remoting/host/ipc_util.h" |
31 #include "remoting/host/switches.h" | 30 #include "remoting/host/switches.h" |
32 #include "remoting/host/win/launch_process_with_token.h" | 31 #include "remoting/host/win/launch_process_with_token.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 channel_security_(channel_security), | 155 channel_security_(channel_security), |
157 event_handler_(nullptr), | 156 event_handler_(nullptr), |
158 get_named_pipe_client_pid_(nullptr), | 157 get_named_pipe_client_pid_(nullptr), |
159 launch_elevated_(launch_elevated), | 158 launch_elevated_(launch_elevated), |
160 launch_pending_(false), | 159 launch_pending_(false), |
161 target_command_(std::move(target_command)) {} | 160 target_command_(std::move(target_command)) {} |
162 | 161 |
163 bool WtsSessionProcessDelegate::Core::Initialize(uint32_t session_id) { | 162 bool WtsSessionProcessDelegate::Core::Initialize(uint32_t session_id) { |
164 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 163 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
165 | 164 |
166 // Windows XP does not support elevation. | |
167 if (base::win::GetVersion() < base::win::VERSION_VISTA) | |
168 launch_elevated_ = false; | |
169 | |
170 if (launch_elevated_) { | 165 if (launch_elevated_) { |
171 // GetNamedPipeClientProcessId() is available starting from Vista. | 166 // GetNamedPipeClientProcessId() is available starting from Vista. |
172 HMODULE kernel32 = ::GetModuleHandle(L"kernel32.dll"); | 167 HMODULE kernel32 = ::GetModuleHandle(L"kernel32.dll"); |
173 CHECK(kernel32 != nullptr); | 168 CHECK(kernel32 != nullptr); |
174 | 169 |
175 get_named_pipe_client_pid_ = | 170 get_named_pipe_client_pid_ = |
176 reinterpret_cast<GetNamedPipeClientProcessIdFn>( | 171 reinterpret_cast<GetNamedPipeClientProcessIdFn>( |
177 GetProcAddress(kernel32, "GetNamedPipeClientProcessId")); | 172 GetProcAddress(kernel32, "GetNamedPipeClientProcessId")); |
178 CHECK(get_named_pipe_client_pid_ != nullptr); | 173 CHECK(get_named_pipe_client_pid_ != nullptr); |
179 | 174 |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 | 548 |
554 void WtsSessionProcessDelegate::CloseChannel() { | 549 void WtsSessionProcessDelegate::CloseChannel() { |
555 core_->CloseChannel(); | 550 core_->CloseChannel(); |
556 } | 551 } |
557 | 552 |
558 void WtsSessionProcessDelegate::KillProcess() { | 553 void WtsSessionProcessDelegate::KillProcess() { |
559 core_->KillProcess(); | 554 core_->KillProcess(); |
560 } | 555 } |
561 | 556 |
562 } // namespace remoting | 557 } // namespace remoting |
OLD | NEW |