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 dcdad945692f69c56929b828413bfb4594daa44b..006b9e5bf4ec3a3a0a65fc30df2c0a96413e3c55 100644 |
--- a/remoting/host/win/unprivileged_process_delegate.cc |
+++ b/remoting/host/win/unprivileged_process_delegate.cc |
@@ -74,11 +74,12 @@ const char kWorkerThreadSd[] = "O:SYG:SYD:(A;;GA;;;SY)(A;;0x120801;;;BA)"; |
// process. |
bool CreateRestrictedToken(ScopedHandle* token_out) { |
// Create a token representing LocalService account. |
- ScopedHandle token; |
+ HANDLE temp_handle; |
if (!LogonUser(L"LocalService", L"NT AUTHORITY", NULL, LOGON32_LOGON_SERVICE, |
- LOGON32_PROVIDER_DEFAULT, token.Receive())) { |
+ LOGON32_PROVIDER_DEFAULT, &temp_handle)) { |
return false; |
} |
+ ScopedHandle token(temp_handle); |
sandbox::RestrictedToken restricted_token; |
if (restricted_token.Init(token) != ERROR_SUCCESS) |
@@ -97,8 +98,12 @@ bool CreateRestrictedToken(ScopedHandle* token_out) { |
} |
// Return the resulting token. |
- return restricted_token.GetRestrictedTokenHandle(token_out->Receive()) == |
- ERROR_SUCCESS; |
+ if (restricted_token.GetRestrictedTokenHandle(&temp_handle) == |
+ ERROR_SUCCESS) { |
+ token_out->Set(temp_handle); |
+ return true; |
+ } |
+ return false; |
} |
// Creates a window station with a given name and the default desktop giving |
@@ -273,12 +278,13 @@ void UnprivilegedProcessDelegate::LaunchProcess( |
base::AutoLock lock(g_inherit_handles_lock.Get()); |
// Create a connected IPC channel. |
- ScopedHandle client; |
- if (!CreateConnectedIpcChannel(io_task_runner_, this, client.Receive(), |
+ HANDLE temp_handle; |
+ if (!CreateConnectedIpcChannel(io_task_runner_, this, &temp_handle, |
&server)) { |
ReportFatalError(); |
return; |
} |
+ ScopedHandle client(temp_handle); |
// Convert the handle value into a decimal integer. Handle values are 32bit |
// even on 64bit platforms. |
@@ -397,11 +403,11 @@ void UnprivilegedProcessDelegate::ReportProcessLaunched( |
// query information about the process and duplicate handles. |
DWORD desired_access = |
SYNCHRONIZE | PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION; |
- ScopedHandle limited_handle; |
+ HANDLE temp_handle; |
if (!DuplicateHandle(GetCurrentProcess(), |
worker_process_, |
GetCurrentProcess(), |
- limited_handle.Receive(), |
+ &temp_handle, |
desired_access, |
FALSE, |
0)) { |
@@ -409,6 +415,7 @@ void UnprivilegedProcessDelegate::ReportProcessLaunched( |
ReportFatalError(); |
return; |
} |
+ ScopedHandle limited_handle(temp_handle); |
event_handler_->OnProcessLaunched(limited_handle.Pass()); |
} |