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

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

Issue 10828181: [Chromoting] Moving common logic responsible for launching child processes to WorkerProcessLauncher… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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 #include <winternl.h> 8 #include <winternl.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 336
337 // Revert to the default token. 337 // Revert to the default token.
338 CHECK(RevertToSelf()); 338 CHECK(RevertToSelf());
339 339
340 *token_out = session_token.Pass(); 340 *token_out = session_token.Pass();
341 return true; 341 return true;
342 } 342 }
343 343
344 bool LaunchProcessWithToken(const FilePath& binary, 344 bool LaunchProcessWithToken(const FilePath& binary,
345 const std::wstring& command_line, 345 const std::wstring& command_line,
346 HANDLE user_token, 346 const ScopedHandle& user_token,
347 base::Process* process_out) { 347 ScopedHandle* process_out) {
348 std::wstring application_name = binary.value(); 348 std::wstring application_name = binary.value();
349 349
350 base::win::ScopedProcessInformation process_info; 350 base::win::ScopedProcessInformation process_info;
351 STARTUPINFOW startup_info; 351 STARTUPINFOW startup_info;
352 352
353 memset(&startup_info, 0, sizeof(startup_info)); 353 memset(&startup_info, 0, sizeof(startup_info));
354 startup_info.cb = sizeof(startup_info); 354 startup_info.cb = sizeof(startup_info);
355 startup_info.lpDesktop = kDefaultDesktopName; 355 startup_info.lpDesktop = kDefaultDesktopName;
356 356
357 BOOL result = CreateProcessAsUser(user_token, 357 BOOL result = CreateProcessAsUser(user_token,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 } 394 }
395 } 395 }
396 396
397 if (!result) { 397 if (!result) {
398 LOG_GETLASTERROR(ERROR) << 398 LOG_GETLASTERROR(ERROR) <<
399 "Failed to launch a process with a user token"; 399 "Failed to launch a process with a user token";
400 return false; 400 return false;
401 } 401 }
402 402
403 CHECK(process_info.IsValid()); 403 CHECK(process_info.IsValid());
404 process_out->set_handle(process_info.TakeProcessHandle()); 404 process_out->Set(process_info.TakeProcessHandle());
405 return true; 405 return true;
406 } 406 }
407 407
408 } // namespace remoting 408 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698