OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/win/chromoting_module.h" | 5 #include "remoting/host/win/chromoting_module.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "base/win/scoped_handle.h" | 12 #include "base/win/scoped_handle.h" |
13 #include "remoting/base/auto_thread_task_runner.h" | 13 #include "remoting/base/auto_thread_task_runner.h" |
14 #include "remoting/base/typed_buffer.h" | 14 #include "remoting/base/typed_buffer.h" |
15 #include "remoting/host/host_exit_codes.h" | 15 #include "remoting/host/host_exit_codes.h" |
16 #include "remoting/host/win/rdp_desktop_session.h" | 16 #include "remoting/host/win/rdp_desktop_session.h" |
17 | 17 |
18 namespace remoting { | 18 namespace remoting { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 // Holds a reference to the task runner used by the module. | 22 // Holds a reference to the task runner used by the module. |
23 base::LazyInstance<scoped_refptr<AutoThreadTaskRunner> > g_module_task_runner = | 23 base::LazyInstance<scoped_refptr<AutoThreadTaskRunner>>::DestructorAtExit |
24 LAZY_INSTANCE_INITIALIZER; | 24 g_module_task_runner = LAZY_INSTANCE_INITIALIZER; |
25 | 25 |
26 // Lowers the process integrity level such that it does not exceed |max_level|. | 26 // Lowers the process integrity level such that it does not exceed |max_level|. |
27 // |max_level| is expected to be one of SECURITY_MANDATORY_XXX constants. | 27 // |max_level| is expected to be one of SECURITY_MANDATORY_XXX constants. |
28 bool LowerProcessIntegrityLevel(DWORD max_level) { | 28 bool LowerProcessIntegrityLevel(DWORD max_level) { |
29 HANDLE temp_handle; | 29 HANDLE temp_handle; |
30 if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY | TOKEN_WRITE, | 30 if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY | TOKEN_WRITE, |
31 &temp_handle)) { | 31 &temp_handle)) { |
32 PLOG(ERROR) << "OpenProcessToken() failed"; | 32 PLOG(ERROR) << "OpenProcessToken() failed"; |
33 return false; | 33 return false; |
34 } | 34 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 189 |
190 ATL::_ATL_OBJMAP_ENTRY rdp_client_entry[] = { | 190 ATL::_ATL_OBJMAP_ENTRY rdp_client_entry[] = { |
191 OBJECT_ENTRY(__uuidof(RdpDesktopSession), RdpDesktopSession) | 191 OBJECT_ENTRY(__uuidof(RdpDesktopSession), RdpDesktopSession) |
192 }; | 192 }; |
193 | 193 |
194 ChromotingModule module(rdp_client_entry, rdp_client_entry + 1); | 194 ChromotingModule module(rdp_client_entry, rdp_client_entry + 1); |
195 return module.Run() ? kSuccessExitCode : kInitializationFailed; | 195 return module.Run() ? kSuccessExitCode : kInitializationFailed; |
196 } | 196 } |
197 | 197 |
198 } // namespace remoting | 198 } // namespace remoting |
OLD | NEW |