OLD | NEW |
---|---|
1 | 1 |
2 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 // | 5 // |
6 // This file implements the Windows service controlling Me2Me host processes | 6 // This file implements the Windows service controlling Me2Me host processes |
7 // running within user sessions. | 7 // running within user sessions. |
8 | 8 |
9 #include "remoting/host/win/unprivileged_process_delegate.h" | 9 #include "remoting/host/win/unprivileged_process_delegate.h" |
10 | 10 |
11 #include <sddl.h> | 11 #include <sddl.h> |
12 | 12 |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/files/file.h" | |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/rand_util.h" | 16 #include "base/rand_util.h" |
16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
17 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
18 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
19 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
20 #include "base/synchronization/lock.h" | 21 #include "base/synchronization/lock.h" |
21 #include "base/win/scoped_handle.h" | 22 #include "base/win/scoped_handle.h" |
22 #include "base/win/windows_version.h" | 23 #include "base/win/windows_version.h" |
23 #include "ipc/ipc_channel.h" | 24 #include "ipc/ipc_channel.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 thread_attributes.lpSecurityDescriptor = thread_sd.get(); | 271 thread_attributes.lpSecurityDescriptor = thread_sd.get(); |
271 thread_attributes.bInheritHandle = FALSE; | 272 thread_attributes.bInheritHandle = FALSE; |
272 | 273 |
273 ScopedHandle worker_process; | 274 ScopedHandle worker_process; |
274 { | 275 { |
275 // Take a lock why any inheritable handles are open to make sure that only | 276 // Take a lock why any inheritable handles are open to make sure that only |
276 // one process inherits them. | 277 // one process inherits them. |
277 base::AutoLock lock(g_inherit_handles_lock.Get()); | 278 base::AutoLock lock(g_inherit_handles_lock.Get()); |
278 | 279 |
279 // Create a connected IPC channel. | 280 // Create a connected IPC channel. |
280 HANDLE temp_handle; | 281 base::File client; |
281 if (!CreateConnectedIpcChannel(io_task_runner_, this, &temp_handle, | 282 if (!CreateConnectedIpcChannel(io_task_runner_, this, &client, &server)) { |
282 &server)) { | |
283 ReportFatalError(); | 283 ReportFatalError(); |
284 return; | 284 return; |
285 } | 285 } |
286 ScopedHandle client(temp_handle); | |
287 | 286 |
288 // Convert the handle value into a decimal integer. Handle values are 32bit | 287 // Convert the handle value into a decimal integer. Handle values are 32bit |
289 // even on 64bit platforms. | 288 // even on 64bit platforms. |
290 std::string pipe_handle = base::StringPrintf( | 289 std::string pipe_handle = base::StringPrintf( |
291 "%d", reinterpret_cast<ULONG_PTR>(client.Get())); | 290 "%d", reinterpret_cast<ULONG_PTR>(client.Get())); |
dcaiafa
2014/06/03 22:48:02
s/Get/GetPlatformFile/
I'm actually surprised (an
rvargas (doing something else)
2014/06/03 22:59:32
Yup, looks like there's no default bot compiling t
| |
292 | 291 |
293 // Pass the IPC channel via the command line. | 292 // Pass the IPC channel via the command line. |
294 base::CommandLine command_line(target_command_->argv()); | 293 base::CommandLine command_line(target_command_->argv()); |
295 command_line.AppendSwitchASCII(kDaemonPipeSwitchName, pipe_handle); | 294 command_line.AppendSwitchASCII(kDaemonPipeSwitchName, pipe_handle); |
296 | 295 |
297 // Create our own window station and desktop accessible by |logon_sid|. | 296 // Create our own window station and desktop accessible by |logon_sid|. |
298 WindowStationAndDesktop handles; | 297 WindowStationAndDesktop handles; |
299 if (!CreateWindowStationAndDesktop(logon_sid.Pass(), &handles)) { | 298 if (!CreateWindowStationAndDesktop(logon_sid.Pass(), &handles)) { |
300 PLOG(ERROR) << "Failed to create a window station and desktop"; | 299 PLOG(ERROR) << "Failed to create a window station and desktop"; |
301 ReportFatalError(); | 300 ReportFatalError(); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
412 PLOG(ERROR) << "Failed to duplicate a handle"; | 411 PLOG(ERROR) << "Failed to duplicate a handle"; |
413 ReportFatalError(); | 412 ReportFatalError(); |
414 return; | 413 return; |
415 } | 414 } |
416 ScopedHandle limited_handle(temp_handle); | 415 ScopedHandle limited_handle(temp_handle); |
417 | 416 |
418 event_handler_->OnProcessLaunched(limited_handle.Pass()); | 417 event_handler_->OnProcessLaunched(limited_handle.Pass()); |
419 } | 418 } |
420 | 419 |
421 } // namespace remoting | 420 } // namespace remoting |
OLD | NEW |