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

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

Issue 2950153002: Improve process launch handle sharing API. (Closed)
Patch Set: Fix Created 3 years, 5 months 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
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 #include "remoting/host/win/launch_process_with_token.h" 5 #include "remoting/host/win/launch_process_with_token.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 return false; 110 return false;
111 } 111 }
112 112
113 // Revert to the default token. 113 // Revert to the default token.
114 CHECK(RevertToSelf()); 114 CHECK(RevertToSelf());
115 115
116 *token_out = std::move(session_token); 116 *token_out = std::move(session_token);
117 return true; 117 return true;
118 } 118 }
119 119
120 bool LaunchProcessWithToken( 120 bool LaunchProcessWithToken(const base::FilePath& binary,
121 const base::FilePath& binary, 121 const base::CommandLine::StringType& command_line,
122 const base::CommandLine::StringType& command_line, 122 HANDLE user_token,
123 HANDLE user_token, 123 SECURITY_ATTRIBUTES* process_attributes,
124 SECURITY_ATTRIBUTES* process_attributes, 124 SECURITY_ATTRIBUTES* thread_attributes,
125 SECURITY_ATTRIBUTES* thread_attributes, 125 const std::vector<HANDLE>& handles_to_inherit,
126 const base::HandlesToInheritVector& handles_to_inherit, 126 DWORD creation_flags,
127 DWORD creation_flags, 127 const base::char16* desktop_name,
128 const base::char16* desktop_name, 128 ScopedHandle* process_out,
129 ScopedHandle* process_out, 129 ScopedHandle* thread_out) {
130 ScopedHandle* thread_out) {
131 base::FilePath::StringType application_name = binary.value(); 130 base::FilePath::StringType application_name = binary.value();
132 131
133 base::win::StartupInformation startup_info_wrapper; 132 base::win::StartupInformation startup_info_wrapper;
134 STARTUPINFO* startup_info = startup_info_wrapper.startup_info(); 133 STARTUPINFO* startup_info = startup_info_wrapper.startup_info();
135 if (desktop_name) 134 if (desktop_name)
136 startup_info->lpDesktop = const_cast<base::char16*>(desktop_name); 135 startup_info->lpDesktop = const_cast<base::char16*>(desktop_name);
137 136
138 bool inherit_handles = false; 137 bool inherit_handles = false;
139 if (!handles_to_inherit.empty()) { 138 if (!handles_to_inherit.empty()) {
140 if (handles_to_inherit.size() > 139 if (handles_to_inherit.size() >
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 180
182 base::win::ScopedProcessInformation process_info(temp_process_info); 181 base::win::ScopedProcessInformation process_info(temp_process_info);
183 182
184 CHECK(process_info.IsValid()); 183 CHECK(process_info.IsValid());
185 process_out->Set(process_info.TakeProcessHandle()); 184 process_out->Set(process_info.TakeProcessHandle());
186 thread_out->Set(process_info.TakeThreadHandle()); 185 thread_out->Set(process_info.TakeThreadHandle());
187 return true; 186 return true;
188 } 187 }
189 188
190 } // namespace remoting 189 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698