| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <windows.h> | 5 #include <windows.h> |
| 6 #include <msi.h> | 6 #include <msi.h> |
| 7 #include <shellapi.h> | 7 #include <shellapi.h> |
| 8 #include <shlobj.h> | 8 #include <shlobj.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/at_exit.h" | 12 #include "base/at_exit.h" |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 16 #include "base/file_version_info.h" | 16 #include "base/file_version_info.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/process_util.h" | 18 #include "base/process_util.h" |
| 19 #include "base/scoped_handle_win.h" | |
| 20 #include "base/string_number_conversions.h" | 19 #include "base/string_number_conversions.h" |
| 21 #include "base/string_util.h" | 20 #include "base/string_util.h" |
| 22 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
| 23 #include "base/values.h" | 22 #include "base/values.h" |
| 23 #include "base/win/scoped_handle.h" |
| 24 #include "base/win/win_util.h" | 24 #include "base/win/win_util.h" |
| 25 #include "base/win/windows_version.h" | 25 #include "base/win/windows_version.h" |
| 26 #include "breakpad/src/client/windows/handler/exception_handler.h" | 26 #include "breakpad/src/client/windows/handler/exception_handler.h" |
| 27 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
| 28 #include "chrome/installer/setup/install.h" | 28 #include "chrome/installer/setup/install.h" |
| 29 #include "chrome/installer/setup/setup_constants.h" | 29 #include "chrome/installer/setup/setup_constants.h" |
| 30 #include "chrome/installer/setup/setup_util.h" | 30 #include "chrome/installer/setup/setup_util.h" |
| 31 #include "chrome/installer/setup/uninstall.h" | 31 #include "chrome/installer/setup/uninstall.h" |
| 32 #include "chrome/installer/util/browser_distribution.h" | 32 #include "chrome/installer/util/browser_distribution.h" |
| 33 #include "chrome/installer/util/delete_after_reboot_helper.h" | 33 #include "chrome/installer/util/delete_after_reboot_helper.h" |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 HANDLE token; | 687 HANDLE token; |
| 688 if (!OpenProcessToken(GetCurrentProcess(), | 688 if (!OpenProcessToken(GetCurrentProcess(), |
| 689 TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, | 689 TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, |
| 690 &token)) { | 690 &token)) { |
| 691 LOG(ERROR) << "Failed to open token."; | 691 LOG(ERROR) << "Failed to open token."; |
| 692 return false; | 692 return false; |
| 693 } | 693 } |
| 694 | 694 |
| 695 // Use a ScopedHandle to keep track of and eventually close our handle. | 695 // Use a ScopedHandle to keep track of and eventually close our handle. |
| 696 // TODO(robertshield): Add a Receive() method to base's ScopedHandle. | 696 // TODO(robertshield): Add a Receive() method to base's ScopedHandle. |
| 697 ScopedHandle scoped_handle(token); | 697 base::win::ScopedHandle scoped_handle(token); |
| 698 | 698 |
| 699 // Get the LUID for the shutdown privilege. | 699 // Get the LUID for the shutdown privilege. |
| 700 TOKEN_PRIVILEGES tkp = {0}; | 700 TOKEN_PRIVILEGES tkp = {0}; |
| 701 LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid); | 701 LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid); |
| 702 tkp.PrivilegeCount = 1; | 702 tkp.PrivilegeCount = 1; |
| 703 tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; | 703 tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; |
| 704 | 704 |
| 705 // Get the shutdown privilege for this process. | 705 // Get the shutdown privilege for this process. |
| 706 AdjustTokenPrivileges(token, FALSE, &tkp, 0, | 706 AdjustTokenPrivileges(token, FALSE, &tkp, 0, |
| 707 reinterpret_cast<PTOKEN_PRIVILEGES>(NULL), 0); | 707 reinterpret_cast<PTOKEN_PRIVILEGES>(NULL), 0); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 // to pass through, since this is only returned on uninstall which is | 1004 // to pass through, since this is only returned on uninstall which is |
| 1005 // never invoked directly by Google Update. | 1005 // never invoked directly by Google Update. |
| 1006 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1006 return_code = InstallUtil::GetInstallReturnCode(install_status); |
| 1007 } | 1007 } |
| 1008 } | 1008 } |
| 1009 | 1009 |
| 1010 VLOG(1) << "Installation complete, returning: " << return_code; | 1010 VLOG(1) << "Installation complete, returning: " << return_code; |
| 1011 | 1011 |
| 1012 return return_code; | 1012 return return_code; |
| 1013 } | 1013 } |
| OLD | NEW |