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

Unified Diff: remoting/host/win/unprivileged_process_delegate.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
Index: remoting/host/win/unprivileged_process_delegate.cc
===================================================================
--- remoting/host/win/unprivileged_process_delegate.cc (revision 237598)
+++ remoting/host/win/unprivileged_process_delegate.cc (working copy)
@@ -74,12 +74,11 @@
// process.
bool CreateRestrictedToken(ScopedHandle* token_out) {
// Create a token representing LocalService account.
- HANDLE temp_handle;
+ ScopedHandle token;
if (!LogonUser(L"LocalService", L"NT AUTHORITY", NULL, LOGON32_LOGON_SERVICE,
- LOGON32_PROVIDER_DEFAULT, &temp_handle)) {
+ LOGON32_PROVIDER_DEFAULT, token.Receive())) {
return false;
}
- ScopedHandle token(temp_handle);
sandbox::RestrictedToken restricted_token;
if (restricted_token.Init(token) != ERROR_SUCCESS)
@@ -98,12 +97,8 @@
}
// Return the resulting token.
- if (restricted_token.GetRestrictedTokenHandle(&temp_handle) ==
- ERROR_SUCCESS) {
- token_out->Set(temp_handle);
- return true;
- }
- return false;
+ return restricted_token.GetRestrictedTokenHandle(token_out->Receive()) ==
+ ERROR_SUCCESS;
}
// Creates a window station with a given name and the default desktop giving
@@ -278,13 +273,12 @@
base::AutoLock lock(g_inherit_handles_lock.Get());
// Create a connected IPC channel.
- HANDLE temp_handle;
- if (!CreateConnectedIpcChannel(io_task_runner_, this, &temp_handle,
+ ScopedHandle client;
+ if (!CreateConnectedIpcChannel(io_task_runner_, this, client.Receive(),
&server)) {
ReportFatalError();
return;
}
- ScopedHandle client(temp_handle);
// Convert the handle value into a decimal integer. Handle values are 32bit
// even on 64bit platforms.
@@ -403,11 +397,11 @@
// query information about the process and duplicate handles.
DWORD desired_access =
SYNCHRONIZE | PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION;
- HANDLE temp_handle;
+ ScopedHandle limited_handle;
if (!DuplicateHandle(GetCurrentProcess(),
worker_process_,
GetCurrentProcess(),
- &temp_handle,
+ limited_handle.Receive(),
desired_access,
FALSE,
0)) {
@@ -415,7 +409,6 @@
ReportFatalError();
return;
}
- ScopedHandle limited_handle(temp_handle);
event_handler_->OnProcessLaunched(limited_handle.Pass());
}
« no previous file with comments | « remoting/host/win/launch_process_with_token.cc ('k') | remoting/host/win/worker_process_launcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698