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

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

Issue 1523163005: clang/win: Fix build after https://codereview.chromium.org/1496093002 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | 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 // mini_installer.exe is the first exe that is run when chrome is being 5 // mini_installer.exe is the first exe that is run when chrome is being
6 // installed or upgraded. It is designed to be extremely small (~5KB with no 6 // installed or upgraded. It is designed to be extremely small (~5KB with no
7 // extra resources linked) and it has two main jobs: 7 // extra resources linked) and it has two main jobs:
8 // 1) unpack the resources (possibly decompressing some) 8 // 1) unpack the resources (possibly decompressing some)
9 // 2) run the real installer (setup.exe) with appropriate flags. 9 // 2) run the real installer (setup.exe) with appropriate flags.
10 // 10 //
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 559
560 // Retrieves the SID of the default owner for objects created by this user 560 // Retrieves the SID of the default owner for objects created by this user
561 // token (accounting for different behavior under UAC elevation, etc.). 561 // token (accounting for different behavior under UAC elevation, etc.).
562 // NOTE: On success the |sid| parameter must be freed with LocalFree(). 562 // NOTE: On success the |sid| parameter must be freed with LocalFree().
563 bool GetCurrentOwnerSid(wchar_t** sid) { 563 bool GetCurrentOwnerSid(wchar_t** sid) {
564 HANDLE token; 564 HANDLE token;
565 if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token)) 565 if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token))
566 return false; 566 return false;
567 567
568 DWORD size = 0; 568 DWORD size = 0;
569 TOKEN_OWNER* owner = NULL;
570 bool result = false; 569 bool result = false;
571 // We get the TokenOwner rather than the TokenUser because e.g. under UAC 570 // We get the TokenOwner rather than the TokenUser because e.g. under UAC
572 // elevation we want the admin to own the directory rather than the user. 571 // elevation we want the admin to own the directory rather than the user.
573 ::GetTokenInformation(token, TokenOwner, &owner, 0, &size); 572 ::GetTokenInformation(token, TokenOwner, NULL, 0, &size);
574 if (size && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { 573 if (size && GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
575 if (owner = reinterpret_cast<TOKEN_OWNER*>(::LocalAlloc(LPTR, size))) { 574 if (TOKEN_OWNER* owner =
575 reinterpret_cast<TOKEN_OWNER*>(::LocalAlloc(LPTR, size))) {
576 if (::GetTokenInformation(token, TokenOwner, owner, size, &size)) 576 if (::GetTokenInformation(token, TokenOwner, owner, size, &size))
577 result = ::ConvertSidToStringSid(owner->Owner, sid); 577 result = ::ConvertSidToStringSid(owner->Owner, sid);
578 ::LocalFree(owner); 578 ::LocalFree(owner);
579 } 579 }
580 } 580 }
581 ::CloseHandle(token); 581 ::CloseHandle(token);
582 return result; 582 return result;
583 } 583 }
584 584
585 // Populates |sd| suitable for use when creating directories within |path| with 585 // Populates |sd| suitable for use when creating directories within |path| with
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 #pragma function(memset) 924 #pragma function(memset)
925 void* memset(void* dest, int c, size_t count) { 925 void* memset(void* dest, int c, size_t count) {
926 void* start = dest; 926 void* start = dest;
927 while (count--) { 927 while (count--) {
928 *reinterpret_cast<char*>(dest) = static_cast<char>(c); 928 *reinterpret_cast<char*>(dest) = static_cast<char>(c);
929 dest = reinterpret_cast<char*>(dest) + 1; 929 dest = reinterpret_cast<char*>(dest) + 1;
930 } 930 }
931 return start; 931 return start;
932 } 932 }
933 } // extern "C" 933 } // extern "C"
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698