elevated_recovery_impl.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef CHROME_ELEVATION_SERVICE_ELEVATED_RECOVERY_IMPL_H_
  5. #define CHROME_ELEVATION_SERVICE_ELEVATED_RECOVERY_IMPL_H_
  6. #include <stdint.h>
  7. #include <string>
  8. #include <vector>
  9. #include "base/win/scoped_handle.h"
  10. #include "components/crx_file/crx_verifier.h"
  11. namespace base {
  12. class CommandLine;
  13. class FilePath;
  14. } // namespace base
  15. namespace elevation_service {
  16. // Delete stale files within the Chrome Recovery directory left over from any
  17. // previous calls to RunChromeRecoveryCRX.
  18. HRESULT CleanupChromeRecoveryDirectory();
  19. // Verifies the CRX and then runs ChromeRecovery.exe embedded within the
  20. // provided |crx_path|. The returned |proc_handle| is a process handle that is
  21. // valid for the |caller_proc_id| process, or the current process if
  22. // |caller_proc_id| is 0. Please read the doc comment in
  23. // elevation_service_idl.idl for the other parameters.
  24. HRESULT RunChromeRecoveryCRX(const base::FilePath& crx_path,
  25. const std::wstring& browser_appid,
  26. const std::wstring& browser_version,
  27. const std::wstring& session_id,
  28. uint32_t caller_proc_id,
  29. base::win::ScopedHandle* proc_handle);
  30. // Verifies the CRX and then runs |exe_filename| embedded within the provided
  31. // |crx_path|. The returned |proc_handle| is a process handle that is valid for
  32. // the |caller_proc_id| process, or the current process if |caller_proc_id| is
  33. // 0. |unpacked_under_path| is expected to be eventually deleted by the caller.
  34. HRESULT RunCRX(const base::FilePath& crx_path,
  35. const base::CommandLine& args,
  36. const crx_file::VerifierFormat& crx_format,
  37. const std::vector<uint8_t>& crx_hash,
  38. const base::FilePath& unpack_under_path,
  39. const base::FilePath& exe_filename,
  40. uint32_t caller_proc_id,
  41. base::win::ScopedHandle* proc_handle);
  42. } // namespace elevation_service
  43. #endif // CHROME_ELEVATION_SERVICE_ELEVATED_RECOVERY_IMPL_H_