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

Side by Side Diff: chrome/installer/gcapi/gcapi.cc

Issue 606473002: Remove implicit HANDLE conversions from chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove spurious file and fix indent (+rebase) Created 6 years, 2 months 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
« no previous file with comments | « chrome/common/service_process_util_win.cc ('k') | chrome/installer/setup/setup_util.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 // NOTE: This code is a legacy utility API for partners to check whether 5 // NOTE: This code is a legacy utility API for partners to check whether
6 // Chrome can be installed and launched. Recent updates are being made 6 // Chrome can be installed and launched. Recent updates are being made
7 // to add new functionality. These updates use code from Chromium, the old 7 // to add new functionality. These updates use code from Chromium, the old
8 // coded against the win32 api directly. If you have an itch to shave a 8 // coded against the win32 api directly. If you have an itch to shave a
9 // yak, feel free to re-write the old code too. 9 // yak, feel free to re-write the old code too.
10 10
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 wchar_t* exp_proc_sid; 471 wchar_t* exp_proc_sid;
472 if (GetUserIdForProcess(pid, &exp_proc_sid)) { 472 if (GetUserIdForProcess(pid, &exp_proc_sid)) {
473 if (_wcsicmp(curr_proc_sid, exp_proc_sid) == 0) { 473 if (_wcsicmp(curr_proc_sid, exp_proc_sid) == 0) {
474 ScopedHandle process_handle( 474 ScopedHandle process_handle(
475 ::OpenProcess(PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION, 475 ::OpenProcess(PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION,
476 TRUE, 476 TRUE,
477 pid)); 477 pid));
478 if (process_handle.IsValid()) { 478 if (process_handle.IsValid()) {
479 HANDLE process_token = NULL; 479 HANDLE process_token = NULL;
480 HANDLE user_token = NULL; 480 HANDLE user_token = NULL;
481 if (::OpenProcessToken(process_handle, TOKEN_DUPLICATE | TOKEN_QUERY, 481 if (::OpenProcessToken(process_handle.Get(),
482 TOKEN_DUPLICATE | TOKEN_QUERY,
482 &process_token) && 483 &process_token) &&
483 ::DuplicateTokenEx(process_token, 484 ::DuplicateTokenEx(process_token,
484 TOKEN_IMPERSONATE | TOKEN_QUERY | 485 TOKEN_IMPERSONATE | TOKEN_QUERY |
485 TOKEN_ASSIGN_PRIMARY | TOKEN_DUPLICATE, 486 TOKEN_ASSIGN_PRIMARY | TOKEN_DUPLICATE,
486 NULL, SecurityImpersonation, 487 NULL, SecurityImpersonation,
487 TokenPrimary, &user_token) && 488 TokenPrimary, &user_token) &&
488 (::ImpersonateLoggedOnUser(user_token) != 0)) { 489 (::ImpersonateLoggedOnUser(user_token) != 0)) {
489 impersonation_success = true; 490 impersonation_success = true;
490 } 491 }
491 if (user_token) 492 if (user_token)
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 key.WriteValue(kRelaunchAllowedAfterValue, 790 key.WriteValue(kRelaunchAllowedAfterValue,
790 FormatDateOffsetByMonths(6)) != ERROR_SUCCESS || 791 FormatDateOffsetByMonths(6)) != ERROR_SUCCESS ||
791 !SetRelaunchExperimentLabels(relaunch_brandcode, shell_mode)) { 792 !SetRelaunchExperimentLabels(relaunch_brandcode, shell_mode)) {
792 if (error_code) 793 if (error_code)
793 *error_code = RELAUNCH_ERROR_RELAUNCH_FAILED; 794 *error_code = RELAUNCH_ERROR_RELAUNCH_FAILED;
794 return FALSE; 795 return FALSE;
795 } 796 }
796 797
797 return TRUE; 798 return TRUE;
798 } 799 }
OLDNEW
« no previous file with comments | « chrome/common/service_process_util_win.cc ('k') | chrome/installer/setup/setup_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698