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

Unified Diff: remoting/host/win/launch_process_with_token.cc

Issue 71013004: Base: Remove Receive() from ScopedHandle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix delegate_execute for google_chrome_build Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/win/chromoting_module.cc ('k') | remoting/host/win/unprivileged_process_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/win/launch_process_with_token.cc
diff --git a/remoting/host/win/launch_process_with_token.cc b/remoting/host/win/launch_process_with_token.cc
index e579c09ff16cc69d55e944d20468b9863e28b36f..f45332cc85cbacce6de434379ccf53f8e2c5d48a 100644
--- a/remoting/host/win/launch_process_with_token.cc
+++ b/remoting/host/win/launch_process_with_token.cc
@@ -122,26 +122,26 @@ bool ConnectToExecutionServer(uint32 session_id,
// Copies the process token making it a primary impersonation token.
// The returned handle will have |desired_access| rights.
bool CopyProcessToken(DWORD desired_access, ScopedHandle* token_out) {
- ScopedHandle process_token;
+ HANDLE temp_handle;
if (!OpenProcessToken(GetCurrentProcess(),
TOKEN_DUPLICATE | desired_access,
- process_token.Receive())) {
+ &temp_handle)) {
LOG_GETLASTERROR(ERROR) << "Failed to open process token";
return false;
}
+ ScopedHandle process_token(temp_handle);
- ScopedHandle copied_token;
if (!DuplicateTokenEx(process_token,
desired_access,
NULL,
SecurityImpersonation,
TokenPrimary,
- copied_token.Receive())) {
+ &temp_handle)) {
LOG_GETLASTERROR(ERROR) << "Failed to duplicate the process token";
return false;
}
- *token_out = copied_token.Pass();
+ token_out->Set(temp_handle);
return true;
}
@@ -467,7 +467,7 @@ bool LaunchProcessWithToken(const base::FilePath& binary,
if (desktop_name)
startup_info.lpDesktop = const_cast<char16*>(desktop_name);
- base::win::ScopedProcessInformation process_info;
+ PROCESS_INFORMATION temp_process_info = {};
BOOL result = CreateProcessAsUser(user_token,
application_name.c_str(),
const_cast<LPWSTR>(command_line.c_str()),
@@ -478,7 +478,7 @@ bool LaunchProcessWithToken(const base::FilePath& binary,
NULL,
NULL,
&startup_info,
- process_info.Receive());
+ &temp_process_info);
// CreateProcessAsUser will fail on XP and W2K3 with ERROR_PIPE_NOT_CONNECTED
// if the user hasn't logged to the target session yet. In such a case
@@ -502,7 +502,7 @@ bool LaunchProcessWithToken(const base::FilePath& binary,
command_line,
creation_flags,
desktop_name,
- process_info.Receive());
+ &temp_process_info);
} else {
// Restore the error status returned by CreateProcessAsUser().
result = FALSE;
@@ -516,6 +516,8 @@ bool LaunchProcessWithToken(const base::FilePath& binary,
return false;
}
+ base::win::ScopedProcessInformation process_info(temp_process_info);
+
CHECK(process_info.IsValid());
process_out->Set(process_info.TakeProcessHandle());
thread_out->Set(process_info.TakeThreadHandle());
« no previous file with comments | « remoting/host/win/chromoting_module.cc ('k') | remoting/host/win/unprivileged_process_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698