| 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 #include "remoting/host/daemon_process.h" | 5 #include "remoting/host/daemon_process.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "remoting/host/win/launch_process_with_token.h" | 38 #include "remoting/host/win/launch_process_with_token.h" |
| 39 #include "remoting/host/win/security_descriptor.h" | 39 #include "remoting/host/win/security_descriptor.h" |
| 40 #include "remoting/host/win/unprivileged_process_delegate.h" | 40 #include "remoting/host/win/unprivileged_process_delegate.h" |
| 41 #include "remoting/host/win/worker_process_launcher.h" | 41 #include "remoting/host/win/worker_process_launcher.h" |
| 42 | 42 |
| 43 using base::win::ScopedHandle; | 43 using base::win::ScopedHandle; |
| 44 using base::TimeDelta; | 44 using base::TimeDelta; |
| 45 | 45 |
| 46 namespace { | 46 namespace { |
| 47 | 47 |
| 48 // Duplicates |key| into |target_process| and returns the value that can be sent | 48 // Duplicates |key| and returns the value that can be sent over IPC. |
| 49 // over IPC. | |
| 50 IPC::PlatformFileForTransit GetRegistryKeyForTransit( | 49 IPC::PlatformFileForTransit GetRegistryKeyForTransit( |
| 51 base::ProcessHandle target_process, | |
| 52 const base::win::RegKey& key) { | 50 const base::win::RegKey& key) { |
| 53 base::PlatformFile handle = | 51 base::PlatformFile handle = |
| 54 reinterpret_cast<base::PlatformFile>(key.Handle()); | 52 reinterpret_cast<base::PlatformFile>(key.Handle()); |
| 55 return IPC::GetFileHandleForProcess(handle, target_process, false); | 53 return IPC::GetPlatformFileForTransit(handle, false); |
| 56 } | 54 } |
| 57 | 55 |
| 58 } // namespace | 56 } // namespace |
| 59 | 57 |
| 60 namespace remoting { | 58 namespace remoting { |
| 61 | 59 |
| 62 class WtsTerminalMonitor; | 60 class WtsTerminalMonitor; |
| 63 | 61 |
| 64 // The command line parameters that should be copied from the service's command | 62 // The command line parameters that should be copied from the service's command |
| 65 // line to the host process. | 63 // line to the host process. |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 } | 281 } |
| 284 | 282 |
| 285 bool DaemonProcessWin::InitializePairingRegistry() { | 283 bool DaemonProcessWin::InitializePairingRegistry() { |
| 286 if (!pairing_registry_privileged_key_.Valid()) { | 284 if (!pairing_registry_privileged_key_.Valid()) { |
| 287 if (!OpenPairingRegistry()) | 285 if (!OpenPairingRegistry()) |
| 288 return false; | 286 return false; |
| 289 } | 287 } |
| 290 | 288 |
| 291 // Duplicate handles to the network process. | 289 // Duplicate handles to the network process. |
| 292 IPC::PlatformFileForTransit privileged_key = GetRegistryKeyForTransit( | 290 IPC::PlatformFileForTransit privileged_key = GetRegistryKeyForTransit( |
| 293 network_process_.Get(), pairing_registry_privileged_key_); | 291 pairing_registry_privileged_key_); |
| 294 IPC::PlatformFileForTransit unprivileged_key = GetRegistryKeyForTransit( | 292 IPC::PlatformFileForTransit unprivileged_key = GetRegistryKeyForTransit( |
| 295 network_process_.Get(), pairing_registry_unprivileged_key_); | 293 pairing_registry_unprivileged_key_); |
| 296 if (!(privileged_key.IsValid() && unprivileged_key.IsValid())) | 294 if (!(privileged_key.IsValid() && unprivileged_key.IsValid())) |
| 297 return false; | 295 return false; |
| 298 | 296 |
| 299 // Initialize the pairing registry in the network process. This has to be done | 297 // Initialize the pairing registry in the network process. This has to be done |
| 300 // before the host configuration is sent, otherwise the host will not use | 298 // before the host configuration is sent, otherwise the host will not use |
| 301 // the passed handles. | 299 // the passed handles. |
| 302 SendToNetwork(new ChromotingDaemonNetworkMsg_InitializePairingRegistry( | 300 SendToNetwork(new ChromotingDaemonNetworkMsg_InitializePairingRegistry( |
| 303 privileged_key, unprivileged_key)); | 301 privileged_key, unprivileged_key)); |
| 304 | 302 |
| 305 return true; | 303 return true; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 << "\\" << kPairingRegistrySecretsKeyName; | 380 << "\\" << kPairingRegistrySecretsKeyName; |
| 383 return false; | 381 return false; |
| 384 } | 382 } |
| 385 | 383 |
| 386 pairing_registry_privileged_key_.Set(privileged.Take()); | 384 pairing_registry_privileged_key_.Set(privileged.Take()); |
| 387 pairing_registry_unprivileged_key_.Set(unprivileged.Take()); | 385 pairing_registry_unprivileged_key_.Set(unprivileged.Take()); |
| 388 return true; | 386 return true; |
| 389 } | 387 } |
| 390 | 388 |
| 391 } // namespace remoting | 389 } // namespace remoting |
| OLD | NEW |