Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: remoting/host/win/launch_process_with_token.h

Issue 2424353002: Use ChannelMojo between the remoting daemon and network processes. (Closed)
Patch Set: sans test changes Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/host/win/BUILD.gn ('k') | remoting/host/win/launch_process_with_token.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 13
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/lazy_instance.h" 16 #include "base/lazy_instance.h"
17 #include "base/process/launch.h"
17 #include "base/synchronization/lock.h" 18 #include "base/synchronization/lock.h"
18 #include "base/win/scoped_handle.h" 19 #include "base/win/scoped_handle.h"
19 20
20 namespace remoting { 21 namespace remoting {
21 22
22 // This lock should be taken when creating handles that will be inherited by
23 // a child process. Without it the child process can inherit handles created for
24 // a different child process started at the same time.
25 extern base::LazyInstance<base::Lock>::Leaky g_inherit_handles_lock;
26
27 // Creates a copy of the current process token for the given |session_id| so 23 // Creates a copy of the current process token for the given |session_id| so
28 // it can be used to launch a process in that session. 24 // it can be used to launch a process in that session.
29 bool CreateSessionToken(uint32_t session_id, 25 bool CreateSessionToken(uint32_t session_id,
30 base::win::ScopedHandle* token_out); 26 base::win::ScopedHandle* token_out);
31 27
32 // Launches |binary| in the security context of the user represented by 28 // Launches |binary| in the security context of the user represented by
33 // |user_token|. The session ID specified by the token is respected as well. 29 // |user_token|. The session ID specified by the token is respected as well.
34 // The other parameters are passed directly to CreateProcessAsUser(). 30 // If |handles_to_inherit| is non-empty, these handles will be inherited by the
35 // If |inherit_handles| is true |g_inherit_handles_lock| should be taken while 31 // new process. The other parameters are passed directly to
36 // any inheritable handles are open. 32 // CreateProcessAsUser().
37 bool LaunchProcessWithToken(const base::FilePath& binary, 33 bool LaunchProcessWithToken(
38 const base::CommandLine::StringType& command_line, 34 const base::FilePath& binary,
39 HANDLE user_token, 35 const base::CommandLine::StringType& command_line,
40 SECURITY_ATTRIBUTES* process_attributes, 36 HANDLE user_token,
41 SECURITY_ATTRIBUTES* thread_attributes, 37 SECURITY_ATTRIBUTES* process_attributes,
42 bool inherit_handles, 38 SECURITY_ATTRIBUTES* thread_attributes,
43 DWORD creation_flags, 39 const base::HandlesToInheritVector& handles_to_inherit,
44 const base::char16* desktop_name, 40 DWORD creation_flags,
45 base::win::ScopedHandle* process_out, 41 const base::char16* desktop_name,
46 base::win::ScopedHandle* thread_out); 42 base::win::ScopedHandle* process_out,
43 base::win::ScopedHandle* thread_out);
47 44
48 } // namespace remoting 45 } // namespace remoting
49 46
50 #endif // REMOTING_HOST_WIN_LAUNCH_PROCESS_WITH_TOKEN_H_ 47 #endif // REMOTING_HOST_WIN_LAUNCH_PROCESS_WITH_TOKEN_H_
OLDNEW
« no previous file with comments | « remoting/host/win/BUILD.gn ('k') | remoting/host/win/launch_process_with_token.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698