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 <string> | 9 #include <string> |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" |
13 #include "base/win/scoped_handle.h" | 15 #include "base/win/scoped_handle.h" |
14 | 16 |
| 17 namespace base { |
| 18 class SingleThreadTaskRunner; |
| 19 } // namespace base |
| 20 |
| 21 namespace IPC { |
| 22 class ChannelProxy; |
| 23 class Listener; |
| 24 } // namespace IPC |
| 25 |
15 namespace remoting { | 26 namespace remoting { |
16 | 27 |
| 28 // Pipe name prefix used by Chrome IPC channels to convert a channel name into |
| 29 // a pipe name. |
| 30 extern const char kChromePipeNamePrefix[]; |
| 31 |
| 32 // Creates the server end of the IPC channel and applies the security |
| 33 // descriptor |pipe_security_descriptor| to it. The created channel proxy will |
| 34 // invoke methods of |delegate| on the calling thread while using |
| 35 // |io_task_runner| to send and receive messages in the background. |
| 36 bool CreateIpcChannel( |
| 37 const std::string& channel_name, |
| 38 const std::string& pipe_security_descriptor, |
| 39 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 40 IPC::Listener* delegate, |
| 41 scoped_ptr<IPC::ChannelProxy>* channel_out); |
| 42 |
17 // Creates a copy of the current process token for the given |session_id| so | 43 // Creates a copy of the current process token for the given |session_id| so |
18 // it can be used to launch a process in that session. | 44 // it can be used to launch a process in that session. |
19 bool CreateSessionToken(uint32 session_id, base::win::ScopedHandle* token_out); | 45 bool CreateSessionToken(uint32 session_id, base::win::ScopedHandle* token_out); |
20 | 46 |
| 47 // Generates a unique IPC channel name. |
| 48 std::string GenerateIpcChannelName(void* client); |
| 49 |
21 // Launches |binary| in the security context of the user represented by | 50 // Launches |binary| in the security context of the user represented by |
22 // |user_token|. The session ID specified by the token is respected as well. | 51 // |user_token|. The session ID specified by the token is respected as well. |
23 bool LaunchProcessWithToken(const FilePath& binary, | 52 bool LaunchProcessWithToken(const FilePath& binary, |
24 const CommandLine::StringType& command_line, | 53 const CommandLine::StringType& command_line, |
25 HANDLE user_token, | 54 HANDLE user_token, |
| 55 bool inherit_handles, |
26 DWORD creation_flags, | 56 DWORD creation_flags, |
27 base::win::ScopedHandle* process_out, | 57 base::win::ScopedHandle* process_out, |
28 base::win::ScopedHandle* thread_out); | 58 base::win::ScopedHandle* thread_out); |
29 | 59 |
30 } // namespace remoting | 60 } // namespace remoting |
31 | 61 |
32 #endif // REMOTING_HOST_WIN_LAUNCH_PROCESS_WITH_TOKEN_H_ | 62 #endif // REMOTING_HOST_WIN_LAUNCH_PROCESS_WITH_TOKEN_H_ |
OLD | NEW |