MsixManifest.h (2114B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 #pragma once 4 #include "AppInstallerStrings.h" 5 #include "AppInstallerVersions.h" 6 7 #include <AppxPackaging.h> 8 #include <wrl/client.h> 9 10 namespace AppInstaller::Msix 11 { 12 using PackageVersion = Utility::UInt64Version; 13 using OSVersion = Utility::UInt64Version; 14 15 // Package identity for an MSIX manifest 16 struct MsixPackageManifestIdentity 17 { 18 MsixPackageManifestIdentity(Microsoft::WRL::ComPtr<IAppxManifestPackageId> packageId) 19 : m_packageId(packageId) {} 20 21 Utility::NormalizedString GetPackageFamilyName() const; 22 PackageVersion GetVersion() const; 23 private: 24 Microsoft::WRL::ComPtr<IAppxManifestPackageId> m_packageId; 25 }; 26 27 // Target device family for an MSIX manifest 28 struct MsixPackageManifestTargetDeviceFamily 29 { 30 // Target device family names 31 static constexpr std::string_view WindowsDesktopName = "Windows.Desktop"; 32 static constexpr std::string_view WindowsUniversalName = "Windows.Universal"; 33 34 enum Platform 35 { 36 WindowsDesktop, 37 WindowsUniversal, 38 Other, 39 }; 40 41 MsixPackageManifestTargetDeviceFamily(Microsoft::WRL::ComPtr<IAppxManifestTargetDeviceFamily> targetDeviceFamily) 42 : m_targetDeviceFamily(targetDeviceFamily) {} 43 44 std::string GetName() const; 45 OSVersion GetMinVersion() const; 46 Platform GetPlatform() const; 47 private: 48 Microsoft::WRL::ComPtr<IAppxManifestTargetDeviceFamily> m_targetDeviceFamily; 49 }; 50 51 // MSIX manifest 52 struct MsixPackageManifest 53 { 54 MsixPackageManifest(Microsoft::WRL::ComPtr<IAppxManifestReader> manifestReader) 55 : m_manifestReader(manifestReader) {} 56 57 std::vector<MsixPackageManifestTargetDeviceFamily> GetTargetDeviceFamilies() const; 58 MsixPackageManifestIdentity GetIdentity() const; 59 std::optional<OSVersion> GetMinimumOSVersionForSupportedPlatforms() const; 60 private: 61 Microsoft::WRL::ComPtr<IAppxManifestReader> m_manifestReader; 62 }; 63 }