summaryrefslogtreecommitdiffstats
path: root/sandbox/src/restricted_token_utils.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/src/restricted_token_utils.cc')
-rw-r--r--sandbox/src/restricted_token_utils.cc27
1 files changed, 13 insertions, 14 deletions
diff --git a/sandbox/src/restricted_token_utils.cc b/sandbox/src/restricted_token_utils.cc
index 8565f0a..ca3942e 100644
--- a/sandbox/src/restricted_token_utils.cc
+++ b/sandbox/src/restricted_token_utils.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,7 +10,6 @@
#include "base/logging.h"
#include "base/win/scoped_handle.h"
-#include "base/win/scoped_process_information.h"
#include "base/win/windows_version.h"
#include "sandbox/src/job.h"
#include "sandbox/src/restricted_token.h"
@@ -183,7 +182,7 @@ DWORD StartRestrictedProcessInJob(wchar_t *command_line,
// Start the process
STARTUPINFO startup_info = {0};
- base::win::ScopedProcessInformation process_info;
+ PROCESS_INFORMATION process_info = {0};
if (!::CreateProcessAsUser(primary_token.Get(),
NULL, // No application name.
@@ -195,30 +194,30 @@ DWORD StartRestrictedProcessInJob(wchar_t *command_line,
NULL, // Use the environment of the caller.
NULL, // Use current directory of the caller.
&startup_info,
- process_info.Receive())) {
+ &process_info)) {
return ::GetLastError();
}
+ base::win::ScopedHandle thread_handle(process_info.hThread);
+ base::win::ScopedHandle process_handle(process_info.hProcess);
+
// Change the token of the main thread of the new process for the
// impersonation token with more rights.
- {
- HANDLE temp_thread = process_info.thread_handle();
- if (!::SetThreadToken(&temp_thread, impersonation_token.Get())) {
- ::TerminateProcess(process_info.process_handle(),
- 0); // exit code
- return ::GetLastError();
- }
+ if (!::SetThreadToken(&process_info.hThread, impersonation_token.Get())) {
+ ::TerminateProcess(process_handle.Get(),
+ 0); // exit code
+ return ::GetLastError();
}
- err_code = job.AssignProcessToJob(process_info.process_handle());
+ err_code = job.AssignProcessToJob(process_handle.Get());
if (ERROR_SUCCESS != err_code) {
- ::TerminateProcess(process_info.process_handle(),
+ ::TerminateProcess(process_handle.Get(),
0); // exit code
return ::GetLastError();
}
// Start the application
- ::ResumeThread(process_info.thread_handle());
+ ::ResumeThread(thread_handle.Get());
(*job_handle_ret) = job.Detach();