| 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 "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "ipc/ipc_message.h" | 21 #include "ipc/ipc_message.h" |
| 22 #include "ipc/ipc_message_macros.h" | 22 #include "ipc/ipc_message_macros.h" |
| 23 #include "remoting/base/auto_thread_task_runner.h" | 23 #include "remoting/base/auto_thread_task_runner.h" |
| 24 #include "remoting/base/scoped_sc_handle_win.h" | 24 #include "remoting/base/scoped_sc_handle_win.h" |
| 25 #include "remoting/host/branding.h" | 25 #include "remoting/host/branding.h" |
| 26 #include "remoting/host/chromoting_messages.h" | 26 #include "remoting/host/chromoting_messages.h" |
| 27 #include "remoting/host/desktop_session_win.h" | 27 #include "remoting/host/desktop_session_win.h" |
| 28 #include "remoting/host/host_exit_codes.h" | 28 #include "remoting/host/host_exit_codes.h" |
| 29 #include "remoting/host/host_main.h" | 29 #include "remoting/host/host_main.h" |
| 30 #include "remoting/host/ipc_constants.h" | 30 #include "remoting/host/ipc_constants.h" |
| 31 #include "remoting/host/pairing_registry_delegate_win.h" |
| 31 #include "remoting/host/screen_resolution.h" | 32 #include "remoting/host/screen_resolution.h" |
| 32 #include "remoting/host/win/launch_process_with_token.h" | 33 #include "remoting/host/win/launch_process_with_token.h" |
| 33 #include "remoting/host/win/unprivileged_process_delegate.h" | 34 #include "remoting/host/win/unprivileged_process_delegate.h" |
| 34 #include "remoting/host/win/worker_process_launcher.h" | 35 #include "remoting/host/win/worker_process_launcher.h" |
| 35 | 36 |
| 36 using base::win::ScopedHandle; | 37 using base::win::ScopedHandle; |
| 37 using base::TimeDelta; | 38 using base::TimeDelta; |
| 38 | 39 |
| 39 namespace { | 40 namespace { |
| 40 | 41 |
| 41 #if defined(OFFICIAL_BUILD) | |
| 42 const wchar_t kPairingRegistryKeyName[] = | |
| 43 L"SOFTWARE\\Google\\Chrome Remote Desktop\\paired-clients"; | |
| 44 #else | |
| 45 const wchar_t kPairingRegistryKeyName[] = | |
| 46 L"SOFTWARE\\Chromoting\\paired-clients"; | |
| 47 #endif | |
| 48 | |
| 49 const wchar_t kPrivilegedKeyName[] = L"secrets"; | |
| 50 const wchar_t kUnprivilegedKeyName[] = L"clients"; | |
| 51 | |
| 52 // Duplicates |key| into |target_process| and returns the value that can be sent | 42 // Duplicates |key| into |target_process| and returns the value that can be sent |
| 53 // over IPC. | 43 // over IPC. |
| 54 IPC::PlatformFileForTransit GetRegistryKeyForTransit( | 44 IPC::PlatformFileForTransit GetRegistryKeyForTransit( |
| 55 base::ProcessHandle target_process, | 45 base::ProcessHandle target_process, |
| 56 const base::win::RegKey& key) { | 46 const base::win::RegKey& key) { |
| 57 base::PlatformFile handle = | 47 base::PlatformFile handle = |
| 58 reinterpret_cast<base::PlatformFile>(key.Handle()); | 48 reinterpret_cast<base::PlatformFile>(key.Handle()); |
| 59 return IPC::GetFileHandleForProcess(handle, target_process, false); | 49 return IPC::GetFileHandleForProcess(handle, target_process, false); |
| 60 } | 50 } |
| 61 | 51 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 base::win::RegKey root; | 301 base::win::RegKey root; |
| 312 LONG result = root.Open(HKEY_LOCAL_MACHINE, kPairingRegistryKeyName, | 302 LONG result = root.Open(HKEY_LOCAL_MACHINE, kPairingRegistryKeyName, |
| 313 KEY_READ); | 303 KEY_READ); |
| 314 if (result != ERROR_SUCCESS) { | 304 if (result != ERROR_SUCCESS) { |
| 315 SetLastError(result); | 305 SetLastError(result); |
| 316 PLOG(ERROR) << "Failed to open HKLM\\" << kPairingRegistryKeyName; | 306 PLOG(ERROR) << "Failed to open HKLM\\" << kPairingRegistryKeyName; |
| 317 return false; | 307 return false; |
| 318 } | 308 } |
| 319 | 309 |
| 320 base::win::RegKey privileged; | 310 base::win::RegKey privileged; |
| 321 result = privileged.Open(root.Handle(), kPrivilegedKeyName, | 311 result = privileged.Open(root.Handle(), kPairingRegistryClientsKeyName, |
| 322 KEY_READ | KEY_WRITE); | 312 KEY_READ | KEY_WRITE); |
| 323 if (result != ERROR_SUCCESS) { | 313 if (result != ERROR_SUCCESS) { |
| 324 SetLastError(result); | 314 SetLastError(result); |
| 325 PLOG(ERROR) << "Failed to open HKLM\\" << kPairingRegistryKeyName << "\\" | 315 PLOG(ERROR) << "Failed to open HKLM\\" << kPairingRegistryKeyName << "\\" |
| 326 << kPrivilegedKeyName; | 316 << kPairingRegistryClientsKeyName; |
| 327 return false; | 317 return false; |
| 328 } | 318 } |
| 329 | 319 |
| 330 base::win::RegKey unprivileged; | 320 base::win::RegKey unprivileged; |
| 331 result = unprivileged.Open(root.Handle(), kUnprivilegedKeyName, | 321 result = unprivileged.Open(root.Handle(), kPairingRegistrySecretsKeyName, |
| 332 KEY_READ | KEY_WRITE); | 322 KEY_READ | KEY_WRITE); |
| 333 if (result != ERROR_SUCCESS) { | 323 if (result != ERROR_SUCCESS) { |
| 334 SetLastError(result); | 324 SetLastError(result); |
| 335 PLOG(ERROR) << "Failed to open HKLM\\" << kUnprivilegedKeyName << "\\" | 325 PLOG(ERROR) << "Failed to open HKLM\\" << kPairingRegistrySecretsKeyName |
| 336 << kUnprivilegedKeyName; | 326 << "\\" << kPairingRegistrySecretsKeyName; |
| 337 return false; | 327 return false; |
| 338 } | 328 } |
| 339 | 329 |
| 340 pairing_registry_privileged_key_.Set(privileged.Take()); | 330 pairing_registry_privileged_key_.Set(privileged.Take()); |
| 341 pairing_registry_unprivileged_key_.Set(unprivileged.Take()); | 331 pairing_registry_unprivileged_key_.Set(unprivileged.Take()); |
| 342 return true; | 332 return true; |
| 343 } | 333 } |
| 344 | 334 |
| 345 } // namespace remoting | 335 } // namespace remoting |
| OLD | NEW |