| 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());
|
|
|