Conversation
…o fix compile error. Cleaned up (optimized) several test projects.
…e it (Windows/GetCurrentPackageInfo doesn't return that distinction)
| <PublisherDisplayName>Microsoft Corporation</PublisherDisplayName> | ||
| <Logo>logo.png</Logo> | ||
| <uap15:DependencyTarget>true</uap15:DependencyTarget> | ||
| <uap10:AllowExternalContent>true</uap10:AllowExternalContent> |
| else | ||
| { | ||
| return GetPackageFilePathOptions_SearchInstallPath | | ||
| nonLocationOptions; |
| inline void initialize() | ||
| { | ||
| wil::unique_hmodule dll; | ||
| if (::ExportLoader::Load(L"api-ms-win-appmodel-runtime-l1-1-3.dll", wil::out_param(dll))) |
| { | ||
|
|
||
| __pragma(detect_mismatch("ODR_violation_WINDOWSAPPRUNTIME_MICROSOFT_WINDOWS_APPLICATIONMODEL_FEATURE_PACKAGERUNTIME_ENABLED_mismatch", "AlwaysEnabled")) | ||
| struct Feature_PackageRuntime |
| PCWSTR filename, | ||
| PackagePathType packageType) | ||
| { | ||
| const auto path{ ::AppModel::Package::GetPath<std::wstring>(packageFullName, packageType) }; |
| namespace TD = ::Test::Diagnostics; | ||
| namespace TB = ::Test::Bootstrap; | ||
| namespace TP = ::Test::Packages; | ||
| namespace TD = ::Test::Diagnostics; |
There was a problem hiding this comment.
This is already defined on line 10
| namespace TD = ::Test::Diagnostics; | ||
| namespace TB = ::Test::Bootstrap; | ||
| namespace TP = ::Test::Packages; | ||
| namespace TD = ::Test::Diagnostics; |
There was a problem hiding this comment.
This is already defined on line 8
| <ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.DynamicDependency.PackageDependencyRank" ThreadingModel="both" /> | ||
|
|
||
| <!-- Package --> | ||
| <ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.Package" ThreadingModel="both" /> |
| std::call_once(g_onceFlag, initialize); | ||
| RETURN_HR_IF_NULL(E_NOTIMPL, g_getPackagePathByFullName2); | ||
|
|
||
| RETURN_IF_FAILED(g_getPackagePathByFullName2(packageFullName, packagePathType, pathLength, path)); |
| // Only Install location is supported by the current system | ||
| // Effective is thus equivalent to Install | ||
| // Either way, rock it old school... | ||
| RETURN_IF_FAILED(::GetPackagePathByFullName(packageFullName, pathLength, path)); |
| { | ||
| return options | maskPackageTypes; | ||
| } | ||
| return options; |
There was a problem hiding this comment.
The IDL says
/// @note If SearchInstallPath, SearchMutablePath, SearchMachineExternalPath and SearchUserExternalPath
/// are omitted then all locations are searched (i.e. specify all or none yields the same result).
But this path doesn't add all those options if none of them is specified (i.e. when only SearchPackages is specified, but none of SearchPath is specified).
| PCWSTR packageFullName, | ||
| _In_ PCWSTR filename, | ||
| _In_ GetPackageFilePathOptions options, | ||
| _Outptr_result_maybenull_ PWSTR* packageFile) noexcept try |
| [flags] | ||
| enum GetFilePathOptions | ||
| { | ||
| /// Default behavior |
There was a problem hiding this comment.
Describe what "default behavior" is (e.g. "Searches all paths and package types")
|
|
||
| // It's bigger than a breadbox. Allocate memory | ||
| std::unique_ptr<WCHAR[]> pathBuffer{ std::make_unique<WCHAR[]>(pathLength) }; | ||
| THROW_IF_WIN32_ERROR_MSG(details::GetPackagePathByFullName2IfSupported(packageFullName, packagePathType, &pathLength, pathBuffer.get()), |
| const auto& packageInfo{ packageInfos[index] }; | ||
|
|
||
| // Does the package's properties match our search criteria? | ||
| const auto packageInfoFlags{ appmodel::package_properties_to_options(packageInfo.flags) }; |
|
|
||
| inline bool is_match_for_package_properties( | ||
| _In_ GetPackageFilePathOptions options, | ||
| std::uint32_t packageInfoFlags) |
| // * PackagePathType_Install is available since Win8 | ||
| // * PackagePathType_Mutable is available since 19H1 | ||
| // * PackagePathType_Effective is available since 19H1 | ||
| // * PackagePathType_MachineExternalLocation is available since 20H1 |
| // * PackagePathType_MachineExternalLocation is available since 20H1 | ||
| // * PackagePathType_UserExternalLocation is available since 20H1 | ||
| // * PackagePathType_EffectiveExternalLocation is available since 20H1 | ||
| // GetPackagePathByFullName() is available since Win8 |
There was a problem hiding this comment.
The value is called "PackagePathType_MachineExternal" (without "Location"). Similarly for PackagePathType_UserExternal and PackagePathType_EffectiveExternal below.
This pseudocode doesn't match the implementation. Refers to: specs/package/Package.md:150 in 50e998b. [](commit_id = 50e998b, deletion_comment = False) |
| /// @note If a package has a UserExternal location then MachineExternal location is not checked (even if the package has one). | ||
| /// @see https://learn.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-getpackagepathbyfullname2 | ||
| /// @see PackageGraph.GetFilePath | ||
| /// @see PackageGraph.GetFilePathOptions |
| /// @note If a package has a UserExternal location then MachineExternal location is not checked (even if the package has one). | ||
| /// @see https://learn.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-getpackagepathbyfullname2 | ||
| /// @see Package.GetFilePath | ||
| /// @see GetPackageFilePathOptions |
| @@ -377,9 +377,7 @@ string GetXamlWinMD() | |||
| GetPackageFilePathOptions.SearchUserExternalPath | | |||
| GetPackageFilePathOptions.SearchMainPackages | | |||
| GetPackageFilePathOptions.SearchFrameworkPath | | |||
|
|
||
| Locate `Microsoft.UI.Xaml.winmd` in the current process' package graph but ignore Mutable locations, | ||
| Resource packages and HostRuntime dependencies. | ||
| Resource and Resource packages and HostRuntime dependencies. |
Implementation of MSIX FindPackageFile*() API Spec#5885
https://task.ms/59424502
NOTE: SearchStatic/DynamicDependencies options are dropped from spec because Windows doesn't expose this information.
Get[Current]PackageInfo*()accepts an input to optionally filter package graph entries but output doesn't indicate if a package was statically or dynamically added to the package graph.