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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 } | 198 } |
199 | 199 |
200 void WtsSessionProcessLauncher::DoKillProcess(DWORD exit_code) { | 200 void WtsSessionProcessLauncher::DoKillProcess(DWORD exit_code) { |
201 DCHECK(main_message_loop_->BelongsToCurrentThread()); | 201 DCHECK(main_message_loop_->BelongsToCurrentThread()); |
202 | 202 |
203 if (worker_process_.IsValid()) { | 203 if (worker_process_.IsValid()) { |
204 TerminateProcess(worker_process_, exit_code); | 204 TerminateProcess(worker_process_, exit_code); |
205 } | 205 } |
206 } | 206 } |
207 | 207 |
208 void WtsSessionProcessLauncher::OnChannelConnected(DWORD peer_pid) { | 208 void WtsSessionProcessLauncher::OnChannelConnected() { |
209 DCHECK(main_message_loop_->BelongsToCurrentThread()); | 209 DCHECK(main_message_loop_->BelongsToCurrentThread()); |
210 | |
211 DWORD expected_pid = GetProcessId(worker_process_); | |
212 if (peer_pid != expected_pid) { | |
213 LOG(ERROR) | |
214 << "Unexpected client connected: expected=" << expected_pid | |
215 << ", actual=" << peer_pid; | |
216 Stop(); | |
217 } | |
218 } | 210 } |
219 | 211 |
220 bool WtsSessionProcessLauncher::OnMessageReceived(const IPC::Message& message) { | 212 bool WtsSessionProcessLauncher::OnMessageReceived(const IPC::Message& message) { |
221 DCHECK(main_message_loop_->BelongsToCurrentThread()); | 213 DCHECK(main_message_loop_->BelongsToCurrentThread()); |
222 | 214 |
223 bool handled = true; | 215 bool handled = true; |
224 IPC_BEGIN_MESSAGE_MAP(WtsSessionProcessLauncher, message) | 216 IPC_BEGIN_MESSAGE_MAP(WtsSessionProcessLauncher, message) |
225 IPC_MESSAGE_HANDLER(ChromotingHostMsg_SendSasToConsole, | 217 IPC_MESSAGE_HANDLER(ChromotingHostMsg_SendSasToConsole, |
226 OnSendSasToConsole) | 218 OnSendSasToConsole) |
227 IPC_MESSAGE_UNHANDLED(handled = false) | 219 IPC_MESSAGE_UNHANDLED(handled = false) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 if (attached_) { | 275 if (attached_) { |
284 OnSessionDetached(); | 276 OnSessionDetached(); |
285 } | 277 } |
286 | 278 |
287 if (launcher_.get() == NULL) { | 279 if (launcher_.get() == NULL) { |
288 CompleteStopping(); | 280 CompleteStopping(); |
289 } | 281 } |
290 } | 282 } |
291 | 283 |
292 } // namespace remoting | 284 } // namespace remoting |
OLD | NEW |