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

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

Issue 92173002: Merge 237541 "Revert of https://codereview.chromium.org/71013004/" (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1721/src/
Patch Set: 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
===================================================================
--- remoting/host/win/launch_process_with_token.cc (revision 237598)
+++ remoting/host/win/launch_process_with_token.cc (working copy)
@@ -122,26 +122,26 @@
// 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) {
- HANDLE temp_handle;
+ ScopedHandle process_token;
if (!OpenProcessToken(GetCurrentProcess(),
TOKEN_DUPLICATE | desired_access,
- &temp_handle)) {
+ process_token.Receive())) {
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,
- &temp_handle)) {
+ copied_token.Receive())) {
LOG_GETLASTERROR(ERROR) << "Failed to duplicate the process token";
return false;
}
- token_out->Set(temp_handle);
+ *token_out = copied_token.Pass();
return true;
}
@@ -467,7 +467,7 @@
if (desktop_name)
startup_info.lpDesktop = const_cast<char16*>(desktop_name);
- PROCESS_INFORMATION temp_process_info = {};
+ base::win::ScopedProcessInformation process_info;
BOOL result = CreateProcessAsUser(user_token,
application_name.c_str(),
const_cast<LPWSTR>(command_line.c_str()),
@@ -478,7 +478,7 @@
NULL,
NULL,
&startup_info,
- &temp_process_info);
+ process_info.Receive());
// 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 @@
command_line,
creation_flags,
desktop_name,
- &temp_process_info);
+ process_info.Receive());
} else {
// Restore the error status returned by CreateProcessAsUser().
result = FALSE;
@@ -516,8 +516,6 @@
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