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

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

Issue 90963002: Revert of Base: Remove Receive() from ScopedHandle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/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
diff --git a/remoting/host/win/unprivileged_process_delegate.cc b/remoting/host/win/unprivileged_process_delegate.cc
index 006b9e5bf4ec3a3a0a65fc30df2c0a96413e3c55..dcdad945692f69c56929b828413bfb4594daa44b 100644
--- a/remoting/host/win/unprivileged_process_delegate.cc
+++ b/remoting/host/win/unprivileged_process_delegate.cc
@@ -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)) {
- return false;
- }
- ScopedHandle token(temp_handle);
+ LOGON32_PROVIDER_DEFAULT, token.Receive())) {
+ return false;
+ }
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