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

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

Issue 1388943004: Add GCAPI to the GN build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/installer/gcapi/BUILD.gn ('k') | chrome/installer/mini_installer/BUILD.gn » ('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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 &size_returned)) { 309 &size_returned)) {
310 ::CloseHandle(process_token); 310 ::CloseHandle(process_token);
311 return false; 311 return false;
312 } 312 }
313 313
314 ::CloseHandle(process_token); 314 ::CloseHandle(process_token);
315 return (elevation_type == TokenElevationTypeFull); 315 return (elevation_type == TokenElevationTypeFull);
316 } 316 }
317 317
318 bool GetUserIdForProcess(size_t pid, wchar_t** user_sid) { 318 bool GetUserIdForProcess(size_t pid, wchar_t** user_sid) {
319 HANDLE process_handle = ::OpenProcess(PROCESS_QUERY_INFORMATION, TRUE, pid); 319 HANDLE process_handle =
320 ::OpenProcess(PROCESS_QUERY_INFORMATION, TRUE, static_cast<DWORD>(pid));
320 if (process_handle == NULL) 321 if (process_handle == NULL)
321 return false; 322 return false;
322 323
323 HANDLE process_token; 324 HANDLE process_token;
324 bool result = false; 325 bool result = false;
325 if (::OpenProcessToken(process_handle, TOKEN_QUERY, &process_token)) { 326 if (::OpenProcessToken(process_handle, TOKEN_QUERY, &process_token)) {
326 DWORD size = 0; 327 DWORD size = 0;
327 ::GetTokenInformation(process_token, TokenUser, NULL, 0, &size); 328 ::GetTokenInformation(process_token, TokenUser, NULL, 0, &size);
328 if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER || 329 if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER ||
329 ::GetLastError() == ERROR_SUCCESS) { 330 ::GetLastError() == ERROR_SUCCESS) {
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 key.WriteValue(kRelaunchAllowedAfterValue, 786 key.WriteValue(kRelaunchAllowedAfterValue,
786 FormatDateOffsetByMonths(6)) != ERROR_SUCCESS || 787 FormatDateOffsetByMonths(6)) != ERROR_SUCCESS ||
787 !SetRelaunchExperimentLabels(relaunch_brandcode, shell_mode)) { 788 !SetRelaunchExperimentLabels(relaunch_brandcode, shell_mode)) {
788 if (error_code) 789 if (error_code)
789 *error_code = RELAUNCH_ERROR_RELAUNCH_FAILED; 790 *error_code = RELAUNCH_ERROR_RELAUNCH_FAILED;
790 return FALSE; 791 return FALSE;
791 } 792 }
792 793
793 return TRUE; 794 return TRUE;
794 } 795 }
OLDNEW
« no previous file with comments | « chrome/installer/gcapi/BUILD.gn ('k') | chrome/installer/mini_installer/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698