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

Side by Side Diff: remoting/host/win/launch_process_with_token.cc

Issue 11411279: Correctly detect Windows XP Pro x64 and Windows 2003 as not supporting elevation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | remoting/host/win/wts_session_process_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/host/win/launch_process_with_token.h" 5 #include "remoting/host/win/launch_process_with_token.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <sddl.h> 8 #include <sddl.h>
9 #include <winternl.h> 9 #include <winternl.h>
10 10
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 // Requests the execution server to create a process in the specified session 373 // Requests the execution server to create a process in the specified session
374 // using the default (i.e. Winlogon) token. This routine relies on undocumented 374 // using the default (i.e. Winlogon) token. This routine relies on undocumented
375 // OS functionality and will likely not work on anything but XP or W2K3. 375 // OS functionality and will likely not work on anything but XP or W2K3.
376 bool CreateRemoteSessionProcess( 376 bool CreateRemoteSessionProcess(
377 uint32 session_id, 377 uint32 session_id,
378 const FilePath::StringType& application_name, 378 const FilePath::StringType& application_name,
379 const CommandLine::StringType& command_line, 379 const CommandLine::StringType& command_line,
380 DWORD creation_flags, 380 DWORD creation_flags,
381 PROCESS_INFORMATION* process_information_out) 381 PROCESS_INFORMATION* process_information_out)
382 { 382 {
383 DCHECK(base::win::GetVersion() == base::win::VERSION_XP); 383 DCHECK_LT(base::win::GetVersion(), base::win::VERSION_VISTA);
384 384
385 base::win::ScopedHandle pipe; 385 base::win::ScopedHandle pipe;
386 if (!ConnectToExecutionServer(session_id, &pipe)) 386 if (!ConnectToExecutionServer(session_id, &pipe))
387 return false; 387 return false;
388 388
389 if (!SendCreateProcessRequest(pipe, application_name, command_line, 389 if (!SendCreateProcessRequest(pipe, application_name, command_line,
390 creation_flags)) { 390 creation_flags)) {
391 return false; 391 return false;
392 } 392 }
393 393
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 process_info.Receive()); 585 process_info.Receive());
586 586
587 // CreateProcessAsUser will fail on XP and W2K3 with ERROR_PIPE_NOT_CONNECTED 587 // CreateProcessAsUser will fail on XP and W2K3 with ERROR_PIPE_NOT_CONNECTED
588 // if the user hasn't logged to the target session yet. In such a case 588 // if the user hasn't logged to the target session yet. In such a case
589 // we try to talk to the execution server directly emulating what 589 // we try to talk to the execution server directly emulating what
590 // the undocumented and not-exported advapi32!CreateRemoteSessionProcessW() 590 // the undocumented and not-exported advapi32!CreateRemoteSessionProcessW()
591 // function does. The created process will run under Winlogon'a token instead 591 // function does. The created process will run under Winlogon'a token instead
592 // of |user_token|. Since Winlogon runs as SYSTEM, this suits our needs. 592 // of |user_token|. Since Winlogon runs as SYSTEM, this suits our needs.
593 if (!result && 593 if (!result &&
594 GetLastError() == ERROR_PIPE_NOT_CONNECTED && 594 GetLastError() == ERROR_PIPE_NOT_CONNECTED &&
595 base::win::GetVersion() == base::win::VERSION_XP) { 595 base::win::GetVersion() < base::win::VERSION_VISTA) {
596 DWORD session_id; 596 DWORD session_id;
597 DWORD return_length; 597 DWORD return_length;
598 result = GetTokenInformation(user_token, 598 result = GetTokenInformation(user_token,
599 TokenSessionId, 599 TokenSessionId,
600 &session_id, 600 &session_id,
601 sizeof(session_id), 601 sizeof(session_id),
602 &return_length); 602 &return_length);
603 if (result && session_id != 0) { 603 if (result && session_id != 0) {
604 result = CreateRemoteSessionProcess(session_id, 604 result = CreateRemoteSessionProcess(session_id,
605 application_name, 605 application_name,
(...skipping 13 matching lines...) Expand all
619 return false; 619 return false;
620 } 620 }
621 621
622 CHECK(process_info.IsValid()); 622 CHECK(process_info.IsValid());
623 process_out->Set(process_info.TakeProcessHandle()); 623 process_out->Set(process_info.TakeProcessHandle());
624 thread_out->Set(process_info.TakeThreadHandle()); 624 thread_out->Set(process_info.TakeThreadHandle());
625 return true; 625 return true;
626 } 626 }
627 627
628 } // namespace remoting 628 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/host/win/wts_session_process_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698