product_install_details.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2016 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. // Contains functions for determining the product's InstallDetails at runtime.
  5. #ifndef CHROME_INSTALL_STATIC_PRODUCT_INSTALL_DETAILS_H_
  6. #define CHROME_INSTALL_STATIC_PRODUCT_INSTALL_DETAILS_H_
  7. #include <memory>
  8. #include <string>
  9. namespace install_static {
  10. class PrimaryInstallDetails;
  11. // Creates product details for the current process and sets them as the global
  12. // InstallDetails for the process. This is intended to be called early in
  13. // process startup. A process's "primary" module may be the executable itself or
  14. // may be another DLL that is loaded and initialized prior to executing the
  15. // executable's entrypoint (i.e., chrome_elf.dll).
  16. void InitializeProductDetailsForPrimaryModule();
  17. // Returns true if |parent| is a parent of |path|. Path separators at the end of
  18. // |parent| are ignored. Returns false if |parent| is empty.
  19. bool IsPathParentOf(const wchar_t* parent,
  20. size_t parent_len,
  21. const std::wstring& path);
  22. // Returns true if |path| is within C:\Program Files{, (x86)}.
  23. bool PathIsInProgramFiles(const std::wstring& path);
  24. // Returns the install suffix embedded in |exe_path| or an empty string if none
  25. // is found. |exe_path| is expected be something similar to
  26. // "...\[kProductName][suffix]\Application".
  27. std::wstring GetInstallSuffix(const std::wstring& exe_path);
  28. // Creates product details for the process at |exe_path|.
  29. std::unique_ptr<PrimaryInstallDetails> MakeProductDetails(
  30. const std::wstring& exe_path);
  31. } // namespace install_static
  32. #endif // CHROME_INSTALL_STATIC_PRODUCT_INSTALL_DETAILS_H_