OLD | NEW |
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 // This file declares util functions for setup project. | 5 // This file declares util functions for setup project. |
6 | 6 |
7 #include "chrome/installer/setup/setup_util.h" | 7 #include "chrome/installer/setup/setup_util.h" |
8 | 8 |
9 #include <windows.h> | 9 #include <windows.h> |
| 10 #include <stddef.h> |
10 | 11 |
11 #include <algorithm> | 12 #include <algorithm> |
12 #include <iterator> | 13 #include <iterator> |
13 #include <set> | 14 #include <set> |
14 | 15 |
15 #include "base/command_line.h" | 16 #include "base/command_line.h" |
16 #include "base/cpu.h" | 17 #include "base/cpu.h" |
17 #include "base/files/file_enumerator.h" | 18 #include "base/files/file_enumerator.h" |
18 #include "base/files/file_path.h" | 19 #include "base/files/file_path.h" |
19 #include "base/files/file_util.h" | 20 #include "base/files/file_util.h" |
20 #include "base/logging.h" | 21 #include "base/logging.h" |
| 22 #include "base/macros.h" |
21 #include "base/numerics/safe_conversions.h" | 23 #include "base/numerics/safe_conversions.h" |
22 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
23 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
24 #include "base/version.h" | 26 #include "base/version.h" |
25 #include "base/win/registry.h" | 27 #include "base/win/registry.h" |
26 #include "base/win/windows_version.h" | 28 #include "base/win/windows_version.h" |
27 #include "chrome/installer/setup/setup_constants.h" | 29 #include "chrome/installer/setup/setup_constants.h" |
28 #include "chrome/installer/util/app_registration_data.h" | 30 #include "chrome/installer/util/app_registration_data.h" |
29 #include "chrome/installer/util/google_update_constants.h" | 31 #include "chrome/installer/util/google_update_constants.h" |
30 #include "chrome/installer/util/installation_state.h" | 32 #include "chrome/installer/util/installation_state.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 if (version) { | 149 if (version) { |
148 patch_source = installer_state.GetInstallerDirectory(*version) | 150 patch_source = installer_state.GetInstallerDirectory(*version) |
149 .Append(installer::kChromeArchive); | 151 .Append(installer::kChromeArchive); |
150 if (base::PathExists(patch_source)) | 152 if (base::PathExists(patch_source)) |
151 return patch_source; | 153 return patch_source; |
152 } | 154 } |
153 return base::FilePath(); | 155 return base::FilePath(); |
154 } | 156 } |
155 | 157 |
156 bool DeleteFileFromTempProcess(const base::FilePath& path, | 158 bool DeleteFileFromTempProcess(const base::FilePath& path, |
157 uint32 delay_before_delete_ms) { | 159 uint32_t delay_before_delete_ms) { |
158 static const wchar_t kRunDll32Path[] = | 160 static const wchar_t kRunDll32Path[] = |
159 L"%SystemRoot%\\System32\\rundll32.exe"; | 161 L"%SystemRoot%\\System32\\rundll32.exe"; |
160 wchar_t rundll32[MAX_PATH]; | 162 wchar_t rundll32[MAX_PATH]; |
161 DWORD size = | 163 DWORD size = |
162 ExpandEnvironmentStrings(kRunDll32Path, rundll32, arraysize(rundll32)); | 164 ExpandEnvironmentStrings(kRunDll32Path, rundll32, arraysize(rundll32)); |
163 if (!size || size >= MAX_PATH) | 165 if (!size || size >= MAX_PATH) |
164 return false; | 166 return false; |
165 | 167 |
166 STARTUPINFO startup = { sizeof(STARTUPINFO) }; | 168 STARTUPINFO startup = { sizeof(STARTUPINFO) }; |
167 PROCESS_INFORMATION pi = {0}; | 169 PROCESS_INFORMATION pi = {0}; |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 } | 575 } |
574 | 576 |
575 ScopedTokenPrivilege::~ScopedTokenPrivilege() { | 577 ScopedTokenPrivilege::~ScopedTokenPrivilege() { |
576 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { | 578 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { |
577 ::AdjustTokenPrivileges(token_.Get(), FALSE, &previous_privileges_, | 579 ::AdjustTokenPrivileges(token_.Get(), FALSE, &previous_privileges_, |
578 sizeof(TOKEN_PRIVILEGES), NULL, NULL); | 580 sizeof(TOKEN_PRIVILEGES), NULL, NULL); |
579 } | 581 } |
580 } | 582 } |
581 | 583 |
582 } // namespace installer | 584 } // namespace installer |
OLD | NEW |