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 #ifndef REMOTING_HOST_WIN_LAUNCH_PROCESS_WITH_TOKEN_H_ | 5 #ifndef REMOTING_HOST_WIN_LAUNCH_PROCESS_WITH_TOKEN_H_ |
6 #define REMOTING_HOST_WIN_LAUNCH_PROCESS_WITH_TOKEN_H_ | 6 #define REMOTING_HOST_WIN_LAUNCH_PROCESS_WITH_TOKEN_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <stdint.h> |
9 #include <string> | 10 #include <string> |
10 | 11 |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
13 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
16 #include "base/win/scoped_handle.h" | 17 #include "base/win/scoped_handle.h" |
17 | 18 |
18 namespace remoting { | 19 namespace remoting { |
19 | 20 |
20 // This lock should be taken when creating handles that will be inherited by | 21 // This lock should be taken when creating handles that will be inherited by |
21 // a child process. Without it the child process can inherit handles created for | 22 // a child process. Without it the child process can inherit handles created for |
22 // a different child process started at the same time. | 23 // a different child process started at the same time. |
23 extern base::LazyInstance<base::Lock>::Leaky g_inherit_handles_lock; | 24 extern base::LazyInstance<base::Lock>::Leaky g_inherit_handles_lock; |
24 | 25 |
25 // Creates a copy of the current process token for the given |session_id| so | 26 // Creates a copy of the current process token for the given |session_id| so |
26 // it can be used to launch a process in that session. | 27 // it can be used to launch a process in that session. |
27 bool CreateSessionToken(uint32 session_id, base::win::ScopedHandle* token_out); | 28 bool CreateSessionToken(uint32_t session_id, |
| 29 base::win::ScopedHandle* token_out); |
28 | 30 |
29 // Launches |binary| in the security context of the user represented by | 31 // Launches |binary| in the security context of the user represented by |
30 // |user_token|. The session ID specified by the token is respected as well. | 32 // |user_token|. The session ID specified by the token is respected as well. |
31 // The other parameters are passed directly to CreateProcessAsUser(). | 33 // The other parameters are passed directly to CreateProcessAsUser(). |
32 // If |inherit_handles| is true |g_inherit_handles_lock| should be taken while | 34 // If |inherit_handles| is true |g_inherit_handles_lock| should be taken while |
33 // any inheritable handles are open. | 35 // any inheritable handles are open. |
34 bool LaunchProcessWithToken(const base::FilePath& binary, | 36 bool LaunchProcessWithToken(const base::FilePath& binary, |
35 const base::CommandLine::StringType& command_line, | 37 const base::CommandLine::StringType& command_line, |
36 HANDLE user_token, | 38 HANDLE user_token, |
37 SECURITY_ATTRIBUTES* process_attributes, | 39 SECURITY_ATTRIBUTES* process_attributes, |
38 SECURITY_ATTRIBUTES* thread_attributes, | 40 SECURITY_ATTRIBUTES* thread_attributes, |
39 bool inherit_handles, | 41 bool inherit_handles, |
40 DWORD creation_flags, | 42 DWORD creation_flags, |
41 const base::char16* desktop_name, | 43 const base::char16* desktop_name, |
42 base::win::ScopedHandle* process_out, | 44 base::win::ScopedHandle* process_out, |
43 base::win::ScopedHandle* thread_out); | 45 base::win::ScopedHandle* thread_out); |
44 | 46 |
45 } // namespace remoting | 47 } // namespace remoting |
46 | 48 |
47 #endif // REMOTING_HOST_WIN_LAUNCH_PROCESS_WITH_TOKEN_H_ | 49 #endif // REMOTING_HOST_WIN_LAUNCH_PROCESS_WITH_TOKEN_H_ |
OLD | NEW |