DynamicDependencies: Use Win11 APIs if available (#3704)
DynamicDependencies: Use Win11 APIs if available Leverage the Win11 Dynamic Dependency API if available, otherwise use WinAppSDK's implementation (aka polyfill). The WinAppSDK DynDep C API handles this, thus benefiting all callers of WinAppSDK's C and WinRT DynDep API (e.g. C# via projections). This happens on Win11 >= 22H2 (aka SV2). NOTE: This makes the DDLM irrelevant on Win11 22H2+ (>SV2). A future (separate) PR will change the intaller to not install the DDLM packages on these systems. *NOTE:* Persisted definitions aren't imported into the OS after OSupgrade to Win11 22H2+. If you create a persisted definition (LifetimeKind=FilePath|RegistryKey) on older you'll need to re-create them after the OS upgrades. *NOTE:* MddGetResolvedPackageFullNameForPackageDependency()'s behavior differed from GetResolvedPackageFullNameForPackageDependency(). Both return null vs package full name when the PackageDependencyId is not resolved vs resolved but the HRESULT return value differed |PackageDependencyId|WinAppSDK |OS API| |-------------------|----------------------------------|------| |unknown |HRESULT_FROM_WIN32(ERROR_NO_MATCH)|S_OK | |not resolved |S_OK |S_OK | |resolved |S_OK |S_OK | MddGetResolvedPackageFullNameForPackageDependency() has been changed to match the OS API. A new OS API will be needed to distinguish between a known valid PackageDependencyId that's not been resolved yet vs an invalid/unknown PackageDependencyId. NOTE: This change is compatible with the documented behavior. It'll be noted in the release notes. NOTE: As a byproduct of return MddGetResolvedPackageFullNameForPackageDependency() error handling the WinRT APIs `PackageDependency.GetFromId()` and `PackageDependency.GetFromIdForSystem()` no longer fail for an unknown/invalid id e.g. `PackageDependency.GetFromId("not a valid id")`. Inappropriate later use will fail e.g. ``` var pd = PackageDependency.GetFromId("not a valid id"); var context = pd.Add(); // Add() fails and throws an exception ``` NOTE: A new OS API is needed to determine if a `PackageDependencyId` is a valid (known) value. WinAppSDK will be updated to use that when available. https://task.ms/47326537 NOTE: Did the work to support Win11 21H2 but the OS may not fully support it. Left IsSupported() unchanged (Win11 >=22H2) for now while I investigate further P.S. Increase test timeout to 120m
This commit is contained in:
Родитель
202c9ef35b
Коммит
f0d6f3b247
|
@ -261,8 +261,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.Process.Environme
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChangeTracker", "dev\EnvironmentManager\ChangeTracker\ChangeTracker.vcxitems", "{E15C3465-9D45-495D-92CE-B91EF45E8623}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WindowsAppRuntime_MSIXInstallFromPath", "dev\WindowsAppRuntime_MSIXInstallFromPath\WindowsAppRuntime_MSIXInstallFromPath.vcxproj", "{D45D4170-E055-4926-8B03-04DAA5F02C6C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Framework.Widgets", "test\DynamicDependency\data\Framework.Widgets\Framework.Widgets.vcxproj", "{09DDAE21-397F-4263-8561-7F2FF28127CF}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DynamicDependencyLifetimeManagerShadow", "dev\DynamicDependency\DynamicDependencyLifetimeManagerShadow\DynamicDependencyLifetimeManagerShadow.vcxproj", "{6539E9E1-BF36-40E5-86BC-070E99DB7B7B}"
|
||||
|
@ -1315,20 +1313,6 @@ Global
|
|||
{0B01DB78-F115-4C90-B28F-7819071303C6}.Release|x64.Build.0 = Release|x64
|
||||
{0B01DB78-F115-4C90-B28F-7819071303C6}.Release|x86.ActiveCfg = Release|Win32
|
||||
{0B01DB78-F115-4C90-B28F-7819071303C6}.Release|x86.Build.0 = Release|Win32
|
||||
{D45D4170-E055-4926-8B03-04DAA5F02C6C}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{D45D4170-E055-4926-8B03-04DAA5F02C6C}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{D45D4170-E055-4926-8B03-04DAA5F02C6C}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{D45D4170-E055-4926-8B03-04DAA5F02C6C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{D45D4170-E055-4926-8B03-04DAA5F02C6C}.Debug|x64.Build.0 = Debug|x64
|
||||
{D45D4170-E055-4926-8B03-04DAA5F02C6C}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{D45D4170-E055-4926-8B03-04DAA5F02C6C}.Debug|x86.Build.0 = Debug|Win32
|
||||
{D45D4170-E055-4926-8B03-04DAA5F02C6C}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{D45D4170-E055-4926-8B03-04DAA5F02C6C}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{D45D4170-E055-4926-8B03-04DAA5F02C6C}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{D45D4170-E055-4926-8B03-04DAA5F02C6C}.Release|x64.ActiveCfg = Release|x64
|
||||
{D45D4170-E055-4926-8B03-04DAA5F02C6C}.Release|x64.Build.0 = Release|x64
|
||||
{D45D4170-E055-4926-8B03-04DAA5F02C6C}.Release|x86.ActiveCfg = Release|Win32
|
||||
{D45D4170-E055-4926-8B03-04DAA5F02C6C}.Release|x86.Build.0 = Release|Win32
|
||||
{09DDAE21-397F-4263-8561-7F2FF28127CF}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{09DDAE21-397F-4263-8561-7F2FF28127CF}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{09DDAE21-397F-4263-8561-7F2FF28127CF}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
|
@ -2470,7 +2454,6 @@ Global
|
|||
{6967798A-AC07-4994-8FE9-DC9442F88E97} = {B4196B13-AB24-492E-9147-03CC7F2CAE59}
|
||||
{2F3FAD1B-D3DF-4866-A3A3-C2C777D55638} = {8ABB3637-75DB-4DC3-BFB1-0933FFA4269B}
|
||||
{E15C3465-9D45-495D-92CE-B91EF45E8623} = {6967798A-AC07-4994-8FE9-DC9442F88E97}
|
||||
{D45D4170-E055-4926-8B03-04DAA5F02C6C} = {448ED2E5-0B37-4D97-9E6B-8C10A507976A}
|
||||
{09DDAE21-397F-4263-8561-7F2FF28127CF} = {0C534F12-B076-47E5-A05B-2A711233AC6F}
|
||||
{6539E9E1-BF36-40E5-86BC-070E99DB7B7B} = {6CD01EF6-D4A4-4801-ADCF-344CF87FF942}
|
||||
{4B30C685-8490-440F-9879-A75D45DAA361} = {AC5FFC80-92FE-4933-BED2-EC5519AC4440}
|
||||
|
@ -2634,7 +2617,6 @@ Global
|
|||
dev\DynamicDependency\API\DynamicDependency.vcxitems*{bf055a59-0919-4e34-9b76-dd055495cc5a}*SharedItemsImports = 9
|
||||
test\inc\inc.vcxitems*{c62688a1-16a0-4729-b6ed-842f4faa29f3}*SharedItemsImports = 4
|
||||
dev\AccessControl\AccessControl.vcxitems*{c91bcb93-9ed1-4acd-85f3-26f9f6ac52e3}*SharedItemsImports = 9
|
||||
dev\Common\Common.vcxitems*{d45d4170-e055-4926-8b03-04daa5f02c6c}*SharedItemsImports = 4
|
||||
test\inc\inc.vcxitems*{d5667df6-a151-4081-abc7-b93e8e5604ce}*SharedItemsImports = 4
|
||||
dev\Deployment\Deployment.vcxitems*{db38fb4d-d04f-4c1d-93e0-f8ae259c5fd6}*SharedItemsImports = 9
|
||||
dev\EnvironmentManager\ChangeTracker\ChangeTracker.vcxitems*{e15c3465-9d45-495d-92ce-b91ef45e8623}*SharedItemsImports = 9
|
||||
|
|
|
@ -170,10 +170,6 @@ PublishFile $FullBuildOutput\WindowsAppRuntime_BootstrapDLL\Microsoft.WindowsApp
|
|||
PublishFile $FullBuildOutput\WindowsAppRuntime_BootstrapDLL\Microsoft.WindowsAppRuntime.Bootstrap.dll $NugetDir\runtimes\win-$Platform\native
|
||||
PublishFile $FullBuildOutput\WindowsAppRuntime_BootstrapDLL\Microsoft.WindowsAppRuntime.Bootstrap.pdb $NugetDir\runtimes\win10-$Platform\native
|
||||
#
|
||||
# Tools
|
||||
PublishFile $FullBuildOutput\WindowsAppRuntime_MSIXInstallFromPath\WindowsAppRuntime_MSIXInstallFromPath.exe $NugetDir\tools\$Platform
|
||||
PublishFile $FullBuildOutput\WindowsAppRuntime_MSIXInstallFromPath\WindowsAppRuntime_MSIXInstallFromPath.pdb $NugetDir\tools\$Platform
|
||||
#
|
||||
# WinMD for UWP apps
|
||||
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.ApplicationModel.DynamicDependency.winmd $NugetDir\lib\uap10.0
|
||||
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.ApplicationModel.WindowsAppRuntime.winmd $NugetDir\lib\uap10.0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -7,6 +7,8 @@
|
|||
|
||||
#include "WindowsAppRuntime.VersionInfo.h"
|
||||
|
||||
#include "MddWin11.h"
|
||||
|
||||
// Function prototype of the function exported by the resource DLL
|
||||
// (defined later in the build pipeline so we can't #include a header from there)
|
||||
STDAPI_(const void*) WindowsAppRuntime_GetVersionInfo();
|
||||
|
@ -115,11 +117,20 @@ STDAPI WindowsAppRuntime_VersionInfo_TestInitialize(
|
|||
PCWSTR frameworkPackageFamilyName,
|
||||
PCWSTR mainPackageFamilyName) noexcept try
|
||||
{
|
||||
// Both or neither must be valued
|
||||
// Verify parameters
|
||||
const bool frameworkPackageFamilyNameIsEmpty{ !frameworkPackageFamilyName || (*frameworkPackageFamilyName == L'0') };
|
||||
const bool mainPackageFamilyNameIsEmpty{ !mainPackageFamilyName || (*mainPackageFamilyName == L'0') };
|
||||
FAIL_FAST_HR_IF(E_UNEXPECTED, frameworkPackageFamilyNameIsEmpty && !mainPackageFamilyNameIsEmpty);
|
||||
FAIL_FAST_HR_IF(E_UNEXPECTED, !frameworkPackageFamilyNameIsEmpty && mainPackageFamilyNameIsEmpty);
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
// Framework is optional but Main is never specified
|
||||
FAIL_FAST_HR_IF(E_UNEXPECTED, !mainPackageFamilyNameIsEmpty);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Both or neither must be valued
|
||||
FAIL_FAST_HR_IF(E_UNEXPECTED, frameworkPackageFamilyNameIsEmpty && !mainPackageFamilyNameIsEmpty);
|
||||
FAIL_FAST_HR_IF(E_UNEXPECTED, !frameworkPackageFamilyNameIsEmpty && mainPackageFamilyNameIsEmpty);
|
||||
}
|
||||
|
||||
// Update our state
|
||||
if (frameworkPackageFamilyNameIsEmpty)
|
||||
|
@ -132,7 +143,7 @@ STDAPI WindowsAppRuntime_VersionInfo_TestInitialize(
|
|||
{
|
||||
// Initialize test support
|
||||
g_test_frameworkPackageFamilyName = frameworkPackageFamilyName;
|
||||
g_test_mainPackageFamilyName = mainPackageFamilyName;
|
||||
g_test_mainPackageFamilyName = (!mainPackageFamilyName ? L"" : mainPackageFamilyName);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#ifndef __MICROSFT_WINDOWSAPPRUNTIME_VERSIONINFO_H
|
||||
|
@ -68,6 +68,18 @@ inline void TestInitialize(
|
|||
THROW_IF_FAILED(WindowsAppRuntime_VersionInfo_TestInitialize(frameworkPackageFamilyName, mainPackageFamilyName));
|
||||
}
|
||||
|
||||
/// Initialize VersionInfo's test support. This will constrain package enumeration
|
||||
/// and matching for test purposes.
|
||||
///
|
||||
/// @param frameworkPackageFamilyName only match framework packages with this family name
|
||||
///
|
||||
/// @note Not for product use. This is for test purposes only to verify the implementation.
|
||||
inline void TestInitialize(
|
||||
_In_ PCWSTR frameworkPackageFamilyName)
|
||||
{
|
||||
THROW_IF_FAILED(WindowsAppRuntime_VersionInfo_TestInitialize(frameworkPackageFamilyName, nullptr));
|
||||
}
|
||||
|
||||
/// Shutdown VersionInfo's test support.
|
||||
///
|
||||
/// @note Not for product use. This is for test purposes only to verify the implementation.
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)M.AM.DD.PackageDependencyRank.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)MddDetourPackageGraph.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)MddLifetimeManagement.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)MddWin11.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)MddWinRT.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)MsixDynamicDependency.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)PackageDependency.cpp" />
|
||||
|
|
|
@ -50,9 +50,6 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)DataStore.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)MddWin11.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)MddWinRT.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include <M.AM.Converters.h>
|
||||
|
||||
#include "MddWin11.h"
|
||||
|
||||
namespace winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::implementation
|
||||
{
|
||||
PackageDependency::PackageDependency(hstring const& id) :
|
||||
|
@ -25,21 +27,37 @@ namespace winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::implem
|
|||
|
||||
winrt::PackageDependency PackageDependency::GetFromId(hstring const& id)
|
||||
{
|
||||
auto tokenUser{ wil::get_token_information<TOKEN_USER>(GetCurrentThreadEffectiveToken()) };
|
||||
auto exists{ MddCore::PackageDependencyManager::ExistsPackageDependency(tokenUser->User.Sid, id.c_str()) };
|
||||
if (!exists)
|
||||
// Use the Win11 APIs if available (instead of Detour'ing to our own implementation)
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
return nullptr;
|
||||
//TODO:47775758 GetResolved2 GetPackageDependencyInfo2(userSid, id.c_str(), &packageDependencyInfo)
|
||||
}
|
||||
else
|
||||
{
|
||||
auto tokenUser{ wil::get_token_information<TOKEN_USER>(GetCurrentThreadEffectiveToken()) };
|
||||
auto exists{ MddCore::PackageDependencyManager::ExistsPackageDependency(tokenUser->User.Sid, id.c_str()) };
|
||||
if (!exists)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return winrt::make<implementation::PackageDependency>(id);
|
||||
}
|
||||
|
||||
winrt::PackageDependency PackageDependency::GetFromIdForSystem(hstring const& id)
|
||||
{
|
||||
auto exists{ MddCore::PackageDependencyManager::ExistsPackageDependency(nullptr, id.c_str()) };
|
||||
if (!exists)
|
||||
// Use the Win11 APIs if available (instead of Detour'ing to our own implementation)
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
return nullptr;
|
||||
//TODO:47775758 GetResolved2 GetPackageDependencyInfo2(userSid, id.c_str(), &packageDependencyInfo)
|
||||
}
|
||||
else
|
||||
{
|
||||
auto exists{ MddCore::PackageDependencyManager::ExistsPackageDependency(nullptr, id.c_str()) };
|
||||
if (!exists)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return winrt::make<implementation::PackageDependency>(id);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "PackageGraphManager.h"
|
||||
|
||||
#include "MddWin11.h"
|
||||
|
||||
#include <../Detours/detours.h>
|
||||
|
||||
// Windows provides HRESULT_FROM_WIN32() but not the reverse. We need that for compat reasons.
|
||||
|
@ -110,6 +112,13 @@ typedef UINT32 (WINAPI* GetPackageGraphRevisionIdFunction)();
|
|||
|
||||
HRESULT WINAPI MddDetourPackageGraphInitialize() noexcept
|
||||
{
|
||||
// Use the Win11 APIs if available (instead of Detour'ing to our own implementation)
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
RETURN_IF_FAILED(MddWin11Initialize());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Detour package graph APIs to our implementation
|
||||
FAIL_FAST_IF_WIN32_ERROR(DetourUpdateThread(GetCurrentThread()));
|
||||
FAIL_FAST_IF_WIN32_ERROR(DetourAttach(&(PVOID&)TrueGetCurrentPackageInfo, DynamicGetCurrentPackageInfo));
|
||||
|
@ -160,6 +169,13 @@ HRESULT WINAPI MddDetourPackageGraphInitialize() noexcept
|
|||
|
||||
HRESULT _MddDetourPackageGraphShutdown() noexcept
|
||||
{
|
||||
// Use the Win11 APIs if available (instead of Detour'ing to our own implementation)
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
MddWin11Shutdown();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Stop Detour'ing package graph APIs to our implementation (undo in reverse order we started Detour'ing APIs)
|
||||
if (TrueGetPackageGraphRevisionId)
|
||||
{
|
||||
|
|
|
@ -1,256 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#include <IsWindowsVersion.h>
|
||||
|
||||
#include "MddWin11.h"
|
||||
|
||||
namespace MddCore::Win11
|
||||
{
|
||||
static HMODULE g_dllApisetAppmodelRuntime_1_6{};
|
||||
static decltype(&::TryCreatePackageDependency) g_win11TryCreatePackageDependency{};
|
||||
static decltype(&::DeletePackageDependency) g_win11DeletePackageDependency{};
|
||||
static decltype(&::AddPackageDependency) g_win11AddPackageDependency{};
|
||||
static decltype(&::RemovePackageDependency) g_win11RemovePackageDependency{};
|
||||
static decltype(&::GetResolvedPackageFullNameForPackageDependency) g_win11GetResolvedPackageFullNameForPackageDependency{};
|
||||
static decltype(&::GetIdForPackageDependencyContext) g_win11GetIdForPackageDependencyContext{};
|
||||
static decltype(&::GetPackageGraphRevisionId) g_win11GetPackageGraphRevisionId{};
|
||||
|
||||
constexpr PackageDependencyLifetimeKind ToLifetimeKind(MddPackageDependencyLifetimeKind lifetimeKind)
|
||||
{
|
||||
switch (lifetimeKind)
|
||||
{
|
||||
case MddPackageDependencyLifetimeKind::Process: return PackageDependencyLifetimeKind_Process;
|
||||
case MddPackageDependencyLifetimeKind::FilePath: return PackageDependencyLifetimeKind_FilePath;
|
||||
case MddPackageDependencyLifetimeKind::RegistryKey: return PackageDependencyLifetimeKind_RegistryKey;
|
||||
default: THROW_HR_MSG(E_UNEXPECTED, "Unknown MddPackageDependencyLifetimeKind (%d)", lifetimeKind);
|
||||
};
|
||||
}
|
||||
|
||||
constexpr PackageDependencyLifetimeKind ToLifetimeKind(winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyLifetimeArtifactKind lifetimeKind)
|
||||
{
|
||||
switch (lifetimeKind)
|
||||
{
|
||||
case winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyLifetimeArtifactKind::Process: return PackageDependencyLifetimeKind_Process;
|
||||
case winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyLifetimeArtifactKind::FilePath: return PackageDependencyLifetimeKind_FilePath;
|
||||
case winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyLifetimeArtifactKind::RegistryKey: return PackageDependencyLifetimeKind_RegistryKey;
|
||||
default: THROW_HR_MSG(E_UNEXPECTED, "Unknown winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyLifetimeKind (%d)", lifetimeKind);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT WINAPI MddWin11Initialize() noexcept
|
||||
{
|
||||
if (!MddCore::Win11::IsSupported())
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HMODULE dllApisetAppmodelRuntime_1_6{ LoadLibraryExW(L"api-ms-win-appmodel-runtime-l1-1-6.dll", nullptr, 0) };
|
||||
FAIL_FAST_HR_IF_NULL(HRESULT_FROM_WIN32(GetLastError()), dllApisetAppmodelRuntime_1_6);
|
||||
|
||||
auto win11TryCreatePackageDependency{ GetProcAddressByFunctionDeclaration(dllApisetAppmodelRuntime_1_6, TryCreatePackageDependency) };
|
||||
RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(GetLastError()), win11TryCreatePackageDependency);
|
||||
auto win11DeletePackageDependency{ GetProcAddressByFunctionDeclaration(dllApisetAppmodelRuntime_1_6, DeletePackageDependency) };
|
||||
RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(GetLastError()), win11DeletePackageDependency);
|
||||
auto win11AddPackageDependency{ GetProcAddressByFunctionDeclaration(dllApisetAppmodelRuntime_1_6, AddPackageDependency) };
|
||||
RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(GetLastError()), win11AddPackageDependency);
|
||||
auto win11RemovePackageDependency{ GetProcAddressByFunctionDeclaration(dllApisetAppmodelRuntime_1_6, RemovePackageDependency) };
|
||||
RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(GetLastError()), win11RemovePackageDependency);
|
||||
auto win11GetResolvedPackageFullNameForPackageDependency{ GetProcAddressByFunctionDeclaration(dllApisetAppmodelRuntime_1_6, GetResolvedPackageFullNameForPackageDependency) };
|
||||
RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(GetLastError()), win11GetResolvedPackageFullNameForPackageDependency);
|
||||
auto win11GetIdForPackageDependencyContext{ GetProcAddressByFunctionDeclaration(dllApisetAppmodelRuntime_1_6, GetIdForPackageDependencyContext) };
|
||||
RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(GetLastError()), win11GetIdForPackageDependencyContext);
|
||||
auto win11GetPackageGraphRevisionId{ GetProcAddressByFunctionDeclaration(dllApisetAppmodelRuntime_1_6, GetPackageGraphRevisionId) };
|
||||
RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(GetLastError()), win11GetPackageGraphRevisionId);
|
||||
|
||||
MddCore::Win11::g_dllApisetAppmodelRuntime_1_6 = dllApisetAppmodelRuntime_1_6;
|
||||
MddCore::Win11::g_win11TryCreatePackageDependency = win11TryCreatePackageDependency;
|
||||
MddCore::Win11::g_win11DeletePackageDependency = win11DeletePackageDependency;
|
||||
MddCore::Win11::g_win11AddPackageDependency = win11AddPackageDependency;
|
||||
MddCore::Win11::g_win11RemovePackageDependency = win11RemovePackageDependency;
|
||||
MddCore::Win11::g_win11GetResolvedPackageFullNameForPackageDependency = win11GetResolvedPackageFullNameForPackageDependency;
|
||||
MddCore::Win11::g_win11GetIdForPackageDependencyContext = win11GetIdForPackageDependencyContext;
|
||||
MddCore::Win11::g_win11GetPackageGraphRevisionId = win11GetPackageGraphRevisionId;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI MddWin11Shutdown() noexcept
|
||||
{
|
||||
if (MddCore::Win11::g_dllApisetAppmodelRuntime_1_6)
|
||||
{
|
||||
MddCore::Win11::g_win11TryCreatePackageDependency = nullptr;
|
||||
MddCore::Win11::g_win11DeletePackageDependency = nullptr;
|
||||
MddCore::Win11::g_win11AddPackageDependency = nullptr;
|
||||
MddCore::Win11::g_win11RemovePackageDependency = nullptr;
|
||||
MddCore::Win11::g_win11GetResolvedPackageFullNameForPackageDependency = nullptr;
|
||||
MddCore::Win11::g_win11GetIdForPackageDependencyContext = nullptr;
|
||||
MddCore::Win11::g_win11GetPackageGraphRevisionId = nullptr;
|
||||
FreeLibrary(MddCore::Win11::g_dllApisetAppmodelRuntime_1_6);
|
||||
MddCore::Win11::g_dllApisetAppmodelRuntime_1_6 = nullptr;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
bool MddCore::Win11::IsSupported()
|
||||
{
|
||||
static bool s_isSupported{ WindowsVersion::IsWindows11_22H2OrGreater() };
|
||||
return s_isSupported;
|
||||
}
|
||||
|
||||
HRESULT MddCore::Win11::TryCreatePackageDependency(
|
||||
PSID user,
|
||||
const winrt::hstring& packageFamilyName,
|
||||
const winrt::Windows::ApplicationModel::PackageVersion& minVersion,
|
||||
winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyProcessorArchitectures packageDependencyProcessorArchitectures,
|
||||
winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::CreatePackageDependencyOptions const& options,
|
||||
_Outptr_result_maybenull_ PWSTR* packageDependencyId)
|
||||
{
|
||||
PCWSTR win11PackageFamilyName{ packageFamilyName.c_str() };
|
||||
|
||||
const ::AppModel::Identity::PackageVersion minPackageVersion{ minVersion };
|
||||
const PACKAGE_VERSION win11MinVersion{ minPackageVersion };
|
||||
|
||||
auto win11PackageDependencyProcessorArchitectures{ PackageDependencyProcessorArchitectures_None };
|
||||
WI_SetFlagIf(win11PackageDependencyProcessorArchitectures, PackageDependencyProcessorArchitectures_Neutral, WI_IsFlagSet(packageDependencyProcessorArchitectures, winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyProcessorArchitectures::Neutral));
|
||||
WI_SetFlagIf(win11PackageDependencyProcessorArchitectures, PackageDependencyProcessorArchitectures_X86, WI_IsFlagSet(packageDependencyProcessorArchitectures, winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyProcessorArchitectures::X86));
|
||||
WI_SetFlagIf(win11PackageDependencyProcessorArchitectures, PackageDependencyProcessorArchitectures_X64, WI_IsFlagSet(packageDependencyProcessorArchitectures, winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyProcessorArchitectures::X64));
|
||||
WI_SetFlagIf(win11PackageDependencyProcessorArchitectures, PackageDependencyProcessorArchitectures_Arm, WI_IsFlagSet(packageDependencyProcessorArchitectures, winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyProcessorArchitectures::Arm));
|
||||
WI_SetFlagIf(win11PackageDependencyProcessorArchitectures, PackageDependencyProcessorArchitectures_Arm64, WI_IsFlagSet(packageDependencyProcessorArchitectures, winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyProcessorArchitectures::Arm64));
|
||||
WI_SetFlagIf(win11PackageDependencyProcessorArchitectures, PackageDependencyProcessorArchitectures_X86A64, WI_IsFlagSet(packageDependencyProcessorArchitectures, winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyProcessorArchitectures::X86OnArm64));
|
||||
|
||||
const auto win11LifetimeKind{ ToLifetimeKind(options.LifetimeArtifactKind()) };
|
||||
|
||||
PCWSTR win11LifetimeArtifact{ options.LifetimeArtifact().c_str() };
|
||||
|
||||
auto win11Options{ CreatePackageDependencyOptions_None };
|
||||
WI_SetFlagIf(win11Options, CreatePackageDependencyOptions_DoNotVerifyDependencyResolution, !options.VerifyDependencyResolution());
|
||||
//TODO CreatePackageDependencyOptions_ScopeIsSystem
|
||||
|
||||
RETURN_IF_FAILED(g_win11TryCreatePackageDependency(user, win11PackageFamilyName, win11MinVersion,
|
||||
win11PackageDependencyProcessorArchitectures, win11LifetimeKind, win11LifetimeArtifact,
|
||||
win11Options, packageDependencyId));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT MddCore::Win11::TryCreatePackageDependency(
|
||||
PSID user,
|
||||
_In_ PCWSTR packageFamilyName,
|
||||
PACKAGE_VERSION minVersion,
|
||||
MddPackageDependencyProcessorArchitectures packageDependencyProcessorArchitectures,
|
||||
MddPackageDependencyLifetimeKind lifetimeKind,
|
||||
PCWSTR lifetimeArtifact,
|
||||
MddCreatePackageDependencyOptions options,
|
||||
_Outptr_result_maybenull_ PWSTR* packageDependencyId)
|
||||
{
|
||||
const ::AppModel::Identity::PackageVersion win11MinVersion{ minVersion };
|
||||
|
||||
auto win11PackageDependencyProcessorArchitectures{ PackageDependencyProcessorArchitectures_None };
|
||||
WI_SetFlagIf(win11PackageDependencyProcessorArchitectures, PackageDependencyProcessorArchitectures_Neutral, WI_IsFlagSet(packageDependencyProcessorArchitectures, MddPackageDependencyProcessorArchitectures::Neutral));
|
||||
WI_SetFlagIf(win11PackageDependencyProcessorArchitectures, PackageDependencyProcessorArchitectures_X86, WI_IsFlagSet(packageDependencyProcessorArchitectures, MddPackageDependencyProcessorArchitectures::X86));
|
||||
WI_SetFlagIf(win11PackageDependencyProcessorArchitectures, PackageDependencyProcessorArchitectures_X64, WI_IsFlagSet(packageDependencyProcessorArchitectures, MddPackageDependencyProcessorArchitectures::X64));
|
||||
WI_SetFlagIf(win11PackageDependencyProcessorArchitectures, PackageDependencyProcessorArchitectures_Arm, WI_IsFlagSet(packageDependencyProcessorArchitectures, MddPackageDependencyProcessorArchitectures::Arm));
|
||||
WI_SetFlagIf(win11PackageDependencyProcessorArchitectures, PackageDependencyProcessorArchitectures_Arm64, WI_IsFlagSet(packageDependencyProcessorArchitectures, MddPackageDependencyProcessorArchitectures::Arm64));
|
||||
WI_SetFlagIf(win11PackageDependencyProcessorArchitectures, PackageDependencyProcessorArchitectures_X86A64, WI_IsFlagSet(packageDependencyProcessorArchitectures, MddPackageDependencyProcessorArchitectures::X86OnArm64));
|
||||
|
||||
const auto win11LifetimeKind{ ToLifetimeKind(lifetimeKind) };
|
||||
|
||||
auto win11Options{ CreatePackageDependencyOptions_None };
|
||||
WI_SetFlagIf(win11Options, CreatePackageDependencyOptions_DoNotVerifyDependencyResolution, WI_IsFlagSet(options, MddCreatePackageDependencyOptions::DoNotVerifyDependencyResolution));
|
||||
WI_SetFlagIf(win11Options, CreatePackageDependencyOptions_ScopeIsSystem, WI_IsFlagSet(options, MddCreatePackageDependencyOptions::ScopeIsSystem));
|
||||
|
||||
RETURN_IF_FAILED(g_win11TryCreatePackageDependency(user, packageFamilyName, win11MinVersion,
|
||||
win11PackageDependencyProcessorArchitectures, win11LifetimeKind, lifetimeArtifact,
|
||||
win11Options, packageDependencyId));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void MddCore::Win11::DeletePackageDependency(
|
||||
const winrt::hstring& packageDependencyId)
|
||||
{
|
||||
DeletePackageDependency(packageDependencyId.c_str());
|
||||
}
|
||||
|
||||
void MddCore::Win11::DeletePackageDependency(
|
||||
_In_ PCWSTR packageDependencyId)
|
||||
{
|
||||
(void)LOG_IF_FAILED(g_win11DeletePackageDependency(packageDependencyId));
|
||||
}
|
||||
|
||||
HRESULT MddCore::Win11::AddPackageDependency(
|
||||
const winrt::hstring& packageDependencyId,
|
||||
winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::AddPackageDependencyOptions const& options,
|
||||
_Out_ MDD_PACKAGEDEPENDENCY_CONTEXT* packageDependencyContext,
|
||||
_Outptr_opt_result_maybenull_ PWSTR* packageFullName)
|
||||
{
|
||||
PCWSTR win11PackageDependencyId{ packageDependencyId.c_str() };
|
||||
|
||||
const auto win11Rank{ options.Rank() };
|
||||
|
||||
auto win11Options{ AddPackageDependencyOptions_None };
|
||||
WI_SetFlagIf(win11Options, AddPackageDependencyOptions_PrependIfRankCollision, options.PrependIfRankCollision());
|
||||
|
||||
static_assert(sizeof(MDD_PACKAGEDEPENDENCY_CONTEXT) == sizeof(PACKAGEDEPENDENCY_CONTEXT));
|
||||
auto win11PackageDependencyContext{ reinterpret_cast<PACKAGEDEPENDENCY_CONTEXT*>(packageDependencyContext) };
|
||||
|
||||
RETURN_IF_FAILED(g_win11AddPackageDependency(win11PackageDependencyId, win11Rank, win11Options, win11PackageDependencyContext, packageFullName));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT MddCore::Win11::AddPackageDependency(
|
||||
_In_ PCWSTR packageDependencyId,
|
||||
INT32 rank,
|
||||
MddAddPackageDependencyOptions options,
|
||||
_Out_ MDD_PACKAGEDEPENDENCY_CONTEXT* packageDependencyContext,
|
||||
_Outptr_opt_result_maybenull_ PWSTR* packageFullName)
|
||||
{
|
||||
auto win11Options{ AddPackageDependencyOptions_None };
|
||||
WI_SetFlagIf(win11Options, AddPackageDependencyOptions_PrependIfRankCollision, WI_IsFlagSet(options, MddAddPackageDependencyOptions::PrependIfRankCollision));
|
||||
|
||||
static_assert(sizeof(MDD_PACKAGEDEPENDENCY_CONTEXT) == sizeof(PACKAGEDEPENDENCY_CONTEXT));
|
||||
auto win11PackageDependencyContext{ reinterpret_cast<PACKAGEDEPENDENCY_CONTEXT*>(packageDependencyContext) };
|
||||
|
||||
RETURN_IF_FAILED(g_win11AddPackageDependency(packageDependencyId, rank, win11Options, win11PackageDependencyContext, packageFullName));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void MddCore::Win11::RemovePackageDependency(
|
||||
winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyContextId packageDependencyContextId)
|
||||
{
|
||||
return RemovePackageDependency(ToContext(packageDependencyContextId));
|
||||
}
|
||||
|
||||
void MddCore::Win11::RemovePackageDependency(
|
||||
_In_ MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext)
|
||||
{
|
||||
static_assert(sizeof(MDD_PACKAGEDEPENDENCY_CONTEXT) == sizeof(PACKAGEDEPENDENCY_CONTEXT));
|
||||
auto win11PackageDependencyContext{ reinterpret_cast<PACKAGEDEPENDENCY_CONTEXT>(packageDependencyContext) };
|
||||
|
||||
g_win11RemovePackageDependency(win11PackageDependencyContext);
|
||||
}
|
||||
|
||||
HRESULT MddCore::Win11::GetResolvedPackageFullNameForPackageDependency(
|
||||
_In_ PCWSTR packageDependencyId,
|
||||
_Outptr_result_maybenull_ PWSTR* packageFullName)
|
||||
{
|
||||
RETURN_IF_FAILED(g_win11GetResolvedPackageFullNameForPackageDependency(packageDependencyId, packageFullName));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT MddCore::Win11::GetIdForPackageDependencyContext(
|
||||
_In_ MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext,
|
||||
_Outptr_result_maybenull_ PWSTR* packageDependencyId)
|
||||
{
|
||||
static_assert(sizeof(MDD_PACKAGEDEPENDENCY_CONTEXT) == sizeof(PACKAGEDEPENDENCY_CONTEXT));
|
||||
auto win11PackageDependencyContext{ reinterpret_cast<PACKAGEDEPENDENCY_CONTEXT>(packageDependencyContext) };
|
||||
|
||||
RETURN_IF_FAILED(g_win11GetIdForPackageDependencyContext(win11PackageDependencyContext, packageDependencyId));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
UINT32 MddCore::Win11::GetPackageGraphRevisionId()
|
||||
{
|
||||
return g_win11GetPackageGraphRevisionId();
|
||||
}
|
|
@ -5,78 +5,409 @@
|
|||
#define MDDWIN11DYNAMICDEPENDENCY_H
|
||||
|
||||
#include <MsixDynamicDependency.h>
|
||||
#include <winrt/Microsoft.Windows.ApplicationModel.DynamicDependency.h>
|
||||
|
||||
HRESULT WINAPI MddWin11Initialize() noexcept;
|
||||
|
||||
HRESULT WINAPI MddWin11Shutdown() noexcept;
|
||||
#include <IsWindowsVersion.h>
|
||||
|
||||
namespace MddCore::Win11
|
||||
{
|
||||
bool IsSupported();
|
||||
namespace details
|
||||
{
|
||||
// GetCurrentPackageInfo3 is documented but not in appmodel.h
|
||||
// See https://learn.microsoft.com/windows/win32/appxpkg/appmodel/nf-appmodel-getcurrentpackageinfo3
|
||||
enum PackageInfo3Type
|
||||
{
|
||||
PackageInfo3Type_PackageInfoGeneration = 16,
|
||||
};
|
||||
//
|
||||
WINBASEAPI HRESULT WINAPI GetCurrentPackageInfo3(
|
||||
_In_ UINT32 flags,
|
||||
_In_ MddCore::Win11::details::PackageInfo3Type packageInfoType,
|
||||
_Inout_ UINT32* bufferLength,
|
||||
_Out_writes_bytes_opt_(*bufferLength) void* buffer,
|
||||
_Out_opt_ UINT32* count);
|
||||
|
||||
HRESULT TryCreatePackageDependency(
|
||||
PSID user,
|
||||
const winrt::hstring& packageFamilyName,
|
||||
const winrt::Windows::ApplicationModel::PackageVersion& minVersion,
|
||||
winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyProcessorArchitectures packageDependencyProcessorArchitectures,
|
||||
winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::CreatePackageDependencyOptions const& options,
|
||||
_Outptr_result_maybenull_ PWSTR* packageDependencyId);
|
||||
__declspec(selectany) HMODULE g_dllApisetAppmodelRuntime_1_5{};
|
||||
__declspec(selectany) decltype(&::TryCreatePackageDependency) g_win11TryCreatePackageDependency{};
|
||||
__declspec(selectany) decltype(&::DeletePackageDependency) g_win11DeletePackageDependency{};
|
||||
__declspec(selectany) decltype(&::AddPackageDependency) g_win11AddPackageDependency{};
|
||||
__declspec(selectany) decltype(&::RemovePackageDependency) g_win11RemovePackageDependency{};
|
||||
__declspec(selectany) decltype(&::GetResolvedPackageFullNameForPackageDependency) g_win11GetResolvedPackageFullNameForPackageDependency{};
|
||||
__declspec(selectany) decltype(&::GetIdForPackageDependencyContext) g_win11GetIdForPackageDependencyContext{};
|
||||
__declspec(selectany) decltype(&MddCore::Win11::details::GetCurrentPackageInfo3) g_win11GetCurrentPackageInfo3{};
|
||||
|
||||
HRESULT TryCreatePackageDependency(
|
||||
PSID user,
|
||||
_In_ PCWSTR packageFamilyName,
|
||||
PACKAGE_VERSION minVersion,
|
||||
MddPackageDependencyProcessorArchitectures packageDependencyProcessorArchitectures,
|
||||
MddPackageDependencyLifetimeKind lifetimeKind,
|
||||
PCWSTR lifetimeArtifact,
|
||||
MddCreatePackageDependencyOptions options,
|
||||
_Outptr_result_maybenull_ PWSTR* packageDependencyId);
|
||||
__declspec(selectany) HMODULE g_dllApisetAppmodelRuntime_1_6{};
|
||||
__declspec(selectany) decltype(&::GetPackageGraphRevisionId) g_win11GetPackageGraphRevisionId{};
|
||||
|
||||
void DeletePackageDependency(
|
||||
const winrt::hstring& packageDependencyId);
|
||||
__declspec(selectany) HMODULE g_dllApisetAppmodelRuntime_1_7{};
|
||||
//TODO:47775758 GetResolved2 __declspec(selectany) decltype(&::GetResolvedPackageFullNameForPackageDependency2) g_win11GetResolvedPackageFullNameForPackageDependency2{};
|
||||
|
||||
void DeletePackageDependency(
|
||||
_In_ PCWSTR packageDependencyId);
|
||||
__declspec(selectany) bool g_isSupported{ WindowsVersion::IsWindows11_22H2OrGreater() };
|
||||
|
||||
HRESULT AddPackageDependency(
|
||||
const winrt::hstring& packageDependencyId,
|
||||
winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::AddPackageDependencyOptions const& options,
|
||||
_Out_ MDD_PACKAGEDEPENDENCY_CONTEXT* packageDependencyContext,
|
||||
_Outptr_opt_result_maybenull_ PWSTR* packageFullName);
|
||||
constexpr PackageDependencyLifetimeKind ToLifetimeKind(MddPackageDependencyLifetimeKind lifetimeKind)
|
||||
{
|
||||
switch (lifetimeKind)
|
||||
{
|
||||
case MddPackageDependencyLifetimeKind::Process: return PackageDependencyLifetimeKind_Process;
|
||||
case MddPackageDependencyLifetimeKind::FilePath: return PackageDependencyLifetimeKind_FilePath;
|
||||
case MddPackageDependencyLifetimeKind::RegistryKey: return PackageDependencyLifetimeKind_RegistryKey;
|
||||
default: THROW_HR_MSG(E_UNEXPECTED, "Unknown MddPackageDependencyLifetimeKind (%d)", lifetimeKind);
|
||||
};
|
||||
}
|
||||
|
||||
HRESULT AddPackageDependency(
|
||||
_In_ PCWSTR packageDependencyId,
|
||||
std::int32_t rank,
|
||||
MddAddPackageDependencyOptions options,
|
||||
_Out_ MDD_PACKAGEDEPENDENCY_CONTEXT* packageDependencyContext,
|
||||
_Outptr_opt_result_maybenull_ PWSTR* packageFullName);
|
||||
#if defined(WINRT_Microsoft_Windows_ApplicationModel_DynamicDependency_H)
|
||||
constexpr PackageDependencyLifetimeKind ToLifetimeKind(winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyLifetimeArtifactKind lifetimeKind)
|
||||
{
|
||||
switch (lifetimeKind)
|
||||
{
|
||||
case winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyLifetimeArtifactKind::Process: return PackageDependencyLifetimeKind_Process;
|
||||
case winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyLifetimeArtifactKind::FilePath: return PackageDependencyLifetimeKind_FilePath;
|
||||
case winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyLifetimeArtifactKind::RegistryKey: return PackageDependencyLifetimeKind_RegistryKey;
|
||||
default: THROW_HR_MSG(E_UNEXPECTED, "Unknown winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyLifetimeKind (%d)", lifetimeKind);
|
||||
};
|
||||
}
|
||||
#endif // defined(WINRT_Microsoft_Windows_ApplicationModel_DynamicDependency_H)
|
||||
|
||||
void RemovePackageDependency(
|
||||
winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyContextId packageDependencyContextId);
|
||||
inline HRESULT Load(PCWSTR moduleName, HMODULE& hmodule)
|
||||
{
|
||||
hmodule = LoadLibraryExW(moduleName, nullptr, 0);
|
||||
if (hmodule == nullptr)
|
||||
{
|
||||
const auto rc{ GetLastError() };
|
||||
RETURN_HR_IF_MSG(HRESULT_FROM_WIN32(rc), rc != ERROR_MOD_NOT_FOUND, "%ls", moduleName);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
void RemovePackageDependency(
|
||||
_In_ MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext);
|
||||
#if defined(WINRT_Microsoft_Windows_ApplicationModel_DynamicDependency_H)
|
||||
inline winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyContextId ToContextId(MDD_PACKAGEDEPENDENCY_CONTEXT context)
|
||||
{
|
||||
return winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyContextId{ static_cast<uint64_t>(reinterpret_cast<INT_PTR>(context)) };
|
||||
}
|
||||
#endif // defined(WINRT_Microsoft_Windows_ApplicationModel_DynamicDependency_H)
|
||||
|
||||
HRESULT GetResolvedPackageFullNameForPackageDependency(
|
||||
_In_ PCWSTR packageDependencyId,
|
||||
_Outptr_result_maybenull_ PWSTR* packageFullName);
|
||||
#if defined(WINRT_Microsoft_Windows_ApplicationModel_DynamicDependency_H)
|
||||
inline MDD_PACKAGEDEPENDENCY_CONTEXT ToContext(winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyContextId contextId)
|
||||
{
|
||||
return reinterpret_cast<MDD_PACKAGEDEPENDENCY_CONTEXT>(static_cast<INT_PTR>(contextId.Id));
|
||||
}
|
||||
#endif // defined(WINRT_Microsoft_Windows_ApplicationModel_DynamicDependency_H)
|
||||
|
||||
HRESULT GetIdForPackageDependencyContext(
|
||||
_In_ MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext,
|
||||
_Outptr_result_maybenull_ PWSTR* packageDependencyId);
|
||||
inline bool IsSupported()
|
||||
{
|
||||
return MddCore::Win11::details::g_isSupported;
|
||||
}
|
||||
|
||||
UINT32 GetPackageGraphRevisionId();
|
||||
inline bool IsGetResolvedPackageFullNameForPackageDependency2Supported()
|
||||
{
|
||||
return IsSupported() && MddCore::Win11::details::g_dllApisetAppmodelRuntime_1_7;
|
||||
}
|
||||
|
||||
inline winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyContextId ToContextId(MDD_PACKAGEDEPENDENCY_CONTEXT context)
|
||||
{
|
||||
return winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyContextId{ static_cast<uint64_t>(reinterpret_cast<INT_PTR>(context)) };
|
||||
inline HRESULT TryCreatePackageDependency(
|
||||
PSID user,
|
||||
_In_ PCWSTR packageFamilyName,
|
||||
PACKAGE_VERSION minVersion,
|
||||
MddPackageDependencyProcessorArchitectures packageDependencyProcessorArchitectures,
|
||||
MddPackageDependencyLifetimeKind lifetimeKind,
|
||||
PCWSTR lifetimeArtifact,
|
||||
MddCreatePackageDependencyOptions options,
|
||||
_Outptr_result_maybenull_ PWSTR* packageDependencyId)
|
||||
{
|
||||
const ::AppModel::Identity::PackageVersion win11MinVersion{ minVersion };
|
||||
|
||||
auto win11PackageDependencyProcessorArchitectures{ PackageDependencyProcessorArchitectures_None };
|
||||
WI_SetFlagIf(win11PackageDependencyProcessorArchitectures, PackageDependencyProcessorArchitectures_Neutral, WI_IsFlagSet(packageDependencyProcessorArchitectures, MddPackageDependencyProcessorArchitectures::Neutral));
|
||||
WI_SetFlagIf(win11PackageDependencyProcessorArchitectures, PackageDependencyProcessorArchitectures_X86, WI_IsFlagSet(packageDependencyProcessorArchitectures, MddPackageDependencyProcessorArchitectures::X86));
|
||||
WI_SetFlagIf(win11PackageDependencyProcessorArchitectures, PackageDependencyProcessorArchitectures_X64, WI_IsFlagSet(packageDependencyProcessorArchitectures, MddPackageDependencyProcessorArchitectures::X64));
|
||||
WI_SetFlagIf(win11PackageDependencyProcessorArchitectures, PackageDependencyProcessorArchitectures_Arm, WI_IsFlagSet(packageDependencyProcessorArchitectures, MddPackageDependencyProcessorArchitectures::Arm));
|
||||
WI_SetFlagIf(win11PackageDependencyProcessorArchitectures, PackageDependencyProcessorArchitectures_Arm64, WI_IsFlagSet(packageDependencyProcessorArchitectures, MddPackageDependencyProcessorArchitectures::Arm64));
|
||||
WI_SetFlagIf(win11PackageDependencyProcessorArchitectures, PackageDependencyProcessorArchitectures_X86A64, WI_IsFlagSet(packageDependencyProcessorArchitectures, MddPackageDependencyProcessorArchitectures::X86OnArm64));
|
||||
|
||||
const auto win11LifetimeKind{ MddCore::Win11::details::ToLifetimeKind(lifetimeKind) };
|
||||
|
||||
auto win11Options{ CreatePackageDependencyOptions_None };
|
||||
WI_SetFlagIf(win11Options, CreatePackageDependencyOptions_DoNotVerifyDependencyResolution, WI_IsFlagSet(options, MddCreatePackageDependencyOptions::DoNotVerifyDependencyResolution));
|
||||
WI_SetFlagIf(win11Options, CreatePackageDependencyOptions_ScopeIsSystem, WI_IsFlagSet(options, MddCreatePackageDependencyOptions::ScopeIsSystem));
|
||||
|
||||
RETURN_IF_FAILED(MddCore::Win11::details::g_win11TryCreatePackageDependency(user, packageFamilyName, win11MinVersion,
|
||||
win11PackageDependencyProcessorArchitectures, win11LifetimeKind, lifetimeArtifact,
|
||||
win11Options, packageDependencyId));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#if defined(WINRT_Microsoft_Windows_ApplicationModel_DynamicDependency_H)
|
||||
inline HRESULT _TryCreatePackageDependency(
|
||||
PSID user,
|
||||
const winrt::hstring& packageFamilyName,
|
||||
const winrt::Windows::ApplicationModel::PackageVersion& minVersion,
|
||||
winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyProcessorArchitectures packageDependencyProcessorArchitectures,
|
||||
winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::CreatePackageDependencyOptions const& options,
|
||||
const MddCreatePackageDependencyOptions initialOptions,
|
||||
_Outptr_result_maybenull_ PWSTR* packageDependencyId)
|
||||
{
|
||||
PCWSTR mddPackageFamilyName{ packageFamilyName.c_str() };
|
||||
|
||||
const ::AppModel::Identity::PackageVersion minPackageVersion{ minVersion };
|
||||
const PACKAGE_VERSION mddMinVersion{ minPackageVersion };
|
||||
|
||||
static_assert(static_cast<uint32_t>(PackageDependencyProcessorArchitectures_Neutral) == static_cast<uint32_t>(MddPackageDependencyProcessorArchitectures::Neutral));
|
||||
static_assert(static_cast<uint32_t>(PackageDependencyProcessorArchitectures_X86) == static_cast<uint32_t>(MddPackageDependencyProcessorArchitectures::X86));
|
||||
static_assert(static_cast<uint32_t>(PackageDependencyProcessorArchitectures_X64) == static_cast<uint32_t>(MddPackageDependencyProcessorArchitectures::X64));
|
||||
static_assert(static_cast<uint32_t>(PackageDependencyProcessorArchitectures_Arm) == static_cast<uint32_t>(MddPackageDependencyProcessorArchitectures::Arm));
|
||||
static_assert(static_cast<uint32_t>(PackageDependencyProcessorArchitectures_Arm64) == static_cast<uint32_t>(MddPackageDependencyProcessorArchitectures::Arm64));
|
||||
static_assert(static_cast<uint32_t>(PackageDependencyProcessorArchitectures_X86A64) == static_cast<uint32_t>(MddPackageDependencyProcessorArchitectures::X86OnArm64));
|
||||
const auto mddPackageDependencyProcessorArchitectures{ static_cast<MddPackageDependencyProcessorArchitectures>(packageDependencyProcessorArchitectures) };
|
||||
|
||||
static_assert(static_cast<uint32_t>(MddPackageDependencyLifetimeKind::Process) == static_cast<uint32_t>(winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyLifetimeArtifactKind::Process));
|
||||
static_assert(static_cast<uint32_t>(MddPackageDependencyLifetimeKind::FilePath) == static_cast<uint32_t>(winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyLifetimeArtifactKind::FilePath));
|
||||
static_assert(static_cast<uint32_t>(MddPackageDependencyLifetimeKind::RegistryKey) == static_cast<uint32_t>(winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyLifetimeArtifactKind::RegistryKey));
|
||||
const auto mddLifetimeKind{ static_cast<MddPackageDependencyLifetimeKind>(options.LifetimeArtifactKind()) };
|
||||
|
||||
PCWSTR mddLifetimeArtifact{ options.LifetimeArtifact().c_str() };
|
||||
|
||||
auto mddOptions{ initialOptions };
|
||||
WI_SetFlagIf(mddOptions, MddCreatePackageDependencyOptions::DoNotVerifyDependencyResolution, !options.VerifyDependencyResolution());
|
||||
// NOTE: ScopeIsSystem is handled by the caller via initialOptions
|
||||
|
||||
RETURN_IF_FAILED(TryCreatePackageDependency(user, mddPackageFamilyName, mddMinVersion,
|
||||
mddPackageDependencyProcessorArchitectures, mddLifetimeKind, mddLifetimeArtifact, mddOptions, packageDependencyId));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
inline HRESULT TryCreatePackageDependency(
|
||||
PSID user,
|
||||
const winrt::hstring& packageFamilyName,
|
||||
const winrt::Windows::ApplicationModel::PackageVersion& minVersion,
|
||||
winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyProcessorArchitectures packageDependencyProcessorArchitectures,
|
||||
winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::CreatePackageDependencyOptions const& options,
|
||||
_Outptr_result_maybenull_ PWSTR* packageDependencyId)
|
||||
{
|
||||
RETURN_IF_FAILED(_TryCreatePackageDependency(user, packageFamilyName, minVersion,
|
||||
packageDependencyProcessorArchitectures, options,
|
||||
MddCreatePackageDependencyOptions::None, packageDependencyId));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
inline HRESULT TryCreatePackageDependencyForSystem(
|
||||
PSID user,
|
||||
const winrt::hstring& packageFamilyName,
|
||||
const winrt::Windows::ApplicationModel::PackageVersion& minVersion,
|
||||
winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyProcessorArchitectures packageDependencyProcessorArchitectures,
|
||||
winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::CreatePackageDependencyOptions const& options,
|
||||
_Outptr_result_maybenull_ PWSTR* packageDependencyId)
|
||||
{
|
||||
RETURN_IF_FAILED(_TryCreatePackageDependency(user, packageFamilyName, minVersion,
|
||||
packageDependencyProcessorArchitectures, options,
|
||||
MddCreatePackageDependencyOptions::ScopeIsSystem, packageDependencyId));
|
||||
return S_OK;
|
||||
}
|
||||
#endif // defined(WINRT_Microsoft_Windows_ApplicationModel_DynamicDependency_H)
|
||||
|
||||
inline void DeletePackageDependency(
|
||||
_In_ PCWSTR packageDependencyId)
|
||||
{
|
||||
(void)LOG_IF_FAILED(MddCore::Win11::details::g_win11DeletePackageDependency(packageDependencyId));
|
||||
}
|
||||
|
||||
inline void DeletePackageDependency(
|
||||
const winrt::hstring& packageDependencyId)
|
||||
{
|
||||
DeletePackageDependency(packageDependencyId.c_str());
|
||||
}
|
||||
|
||||
inline HRESULT AddPackageDependency(
|
||||
_In_ PCWSTR packageDependencyId,
|
||||
std::int32_t rank,
|
||||
MddAddPackageDependencyOptions options,
|
||||
_Out_ MDD_PACKAGEDEPENDENCY_CONTEXT* packageDependencyContext,
|
||||
_Outptr_opt_result_maybenull_ PWSTR* packageFullName)
|
||||
{
|
||||
auto win11Options{ AddPackageDependencyOptions_None };
|
||||
WI_SetFlagIf(win11Options, AddPackageDependencyOptions_PrependIfRankCollision, WI_IsFlagSet(options, MddAddPackageDependencyOptions::PrependIfRankCollision));
|
||||
|
||||
static_assert(sizeof(MDD_PACKAGEDEPENDENCY_CONTEXT) == sizeof(PACKAGEDEPENDENCY_CONTEXT));
|
||||
auto win11PackageDependencyContext{ reinterpret_cast<PACKAGEDEPENDENCY_CONTEXT*>(packageDependencyContext) };
|
||||
|
||||
RETURN_IF_FAILED(MddCore::Win11::details::g_win11AddPackageDependency(packageDependencyId, rank, win11Options, win11PackageDependencyContext, packageFullName));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#if defined(WINRT_Microsoft_Windows_ApplicationModel_DynamicDependency_H)
|
||||
inline HRESULT AddPackageDependency(
|
||||
const winrt::hstring& packageDependencyId,
|
||||
winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::AddPackageDependencyOptions const& options,
|
||||
_Out_ MDD_PACKAGEDEPENDENCY_CONTEXT* packageDependencyContext,
|
||||
_Outptr_opt_result_maybenull_ PWSTR* packageFullName)
|
||||
{
|
||||
PCWSTR mddPackageDependencyId{ packageDependencyId.c_str() };
|
||||
|
||||
const auto mddRank{ options.Rank() };
|
||||
|
||||
auto mddOptions{ MddAddPackageDependencyOptions::None };
|
||||
WI_SetFlagIf(mddOptions, MddAddPackageDependencyOptions::PrependIfRankCollision, options.PrependIfRankCollision());
|
||||
|
||||
RETURN_IF_FAILED(AddPackageDependency(mddPackageDependencyId, mddRank, mddOptions, packageDependencyContext, packageFullName));
|
||||
return S_OK;
|
||||
}
|
||||
#endif // defined(WINRT_Microsoft_Windows_ApplicationModel_DynamicDependency_H)
|
||||
|
||||
inline void RemovePackageDependency(
|
||||
_In_ MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext)
|
||||
{
|
||||
static_assert(sizeof(MDD_PACKAGEDEPENDENCY_CONTEXT) == sizeof(PACKAGEDEPENDENCY_CONTEXT));
|
||||
auto win11PackageDependencyContext{ reinterpret_cast<PACKAGEDEPENDENCY_CONTEXT>(packageDependencyContext) };
|
||||
|
||||
MddCore::Win11::details::g_win11RemovePackageDependency(win11PackageDependencyContext);
|
||||
}
|
||||
|
||||
#if defined(WINRT_Microsoft_Windows_ApplicationModel_DynamicDependency_H)
|
||||
inline void RemovePackageDependency(
|
||||
winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyContextId packageDependencyContextId)
|
||||
{
|
||||
return RemovePackageDependency(MddCore::Win11::ToContext(packageDependencyContextId));
|
||||
}
|
||||
#endif // defined(WINRT_Microsoft_Windows_ApplicationModel_DynamicDependency_H)
|
||||
|
||||
inline HRESULT GetResolvedPackageFullNameForPackageDependency(
|
||||
_In_ PCWSTR packageDependencyId,
|
||||
_Outptr_result_maybenull_ PWSTR* packageFullName)
|
||||
{
|
||||
RETURN_IF_FAILED(MddCore::Win11::details::g_win11GetResolvedPackageFullNameForPackageDependency(packageDependencyId, packageFullName));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
inline HRESULT GetResolvedPackageFullNameForPackageDependency2(
|
||||
_In_ PCWSTR /*packageDependencyId*/,
|
||||
_Outptr_result_maybenull_ PWSTR* /*packageFullName*/)
|
||||
{
|
||||
//TODO:47775758 GetResolved2 RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), g_win11GetResolvedPackageFullNameForPackageDependency2);
|
||||
//TODO:47775758 GetResolved2 RETURN_IF_FAILED(MddCore::Win11::details::g_win11GetResolvedPackageFullNameForPackageDependency2(packageDependencyId, packageFullName));
|
||||
//TODO:47775758 GetResolved2 return S_OK;
|
||||
RETURN_WIN32(ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
inline HRESULT GetIdForPackageDependencyContext(
|
||||
_In_ MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext,
|
||||
_Outptr_result_maybenull_ PWSTR* packageDependencyId)
|
||||
{
|
||||
static_assert(sizeof(MDD_PACKAGEDEPENDENCY_CONTEXT) == sizeof(PACKAGEDEPENDENCY_CONTEXT));
|
||||
auto win11PackageDependencyContext{ reinterpret_cast<PACKAGEDEPENDENCY_CONTEXT>(packageDependencyContext) };
|
||||
|
||||
RETURN_IF_FAILED(MddCore::Win11::details::g_win11GetIdForPackageDependencyContext(win11PackageDependencyContext, packageDependencyId));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
inline UINT32 GetPackageGraphRevisionId()
|
||||
{
|
||||
if (MddCore::Win11::details::g_win11GetPackageGraphRevisionId())
|
||||
{
|
||||
return MddCore::Win11::details::g_win11GetPackageGraphRevisionId();
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT32 revisionId{};
|
||||
UINT32 bufferLength{ sizeof(revisionId) };
|
||||
const HRESULT hr{ MddCore::Win11::details::g_win11GetCurrentPackageInfo3(0, MddCore::Win11::details::PackageInfo3Type_PackageInfoGeneration, &bufferLength, &revisionId, nullptr) };
|
||||
if (hr == HRESULT_FROM_WIN32(APPMODEL_ERROR_NO_PACKAGE))
|
||||
{
|
||||
// No package graph
|
||||
return 0;
|
||||
}
|
||||
LOG_IF_FAILED_MSG(hr, "GetCurrentPackageInfo3 failed!");
|
||||
return revisionId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline MDD_PACKAGEDEPENDENCY_CONTEXT ToContext(winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependencyContextId contextId)
|
||||
inline HRESULT WINAPI MddWin11Initialize() noexcept
|
||||
{
|
||||
return reinterpret_cast<MDD_PACKAGEDEPENDENCY_CONTEXT>(static_cast<INT_PTR>(contextId.Id));
|
||||
if (!MddCore::Win11::IsSupported())
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//TODO:47775758 GetResolved2 auto win11GetResolvedPackageFullNameForPackageDependency2{ static_cast<decltype(&::GetResolvedPackageFullNameForPackageDependency2)>(nullptr) };
|
||||
HMODULE dllApisetAppmodelRuntime_1_7{};
|
||||
RETURN_IF_FAILED(MddCore::Win11::details::Load(L"api-ms-win-appmodel-runtime-l1-1-7.dll", dllApisetAppmodelRuntime_1_7));
|
||||
if (dllApisetAppmodelRuntime_1_7)
|
||||
{
|
||||
//TODO:47775758 GetResolved2 win11GetResolvedPackageFullNameForPackageDependency2 = GetProcAddressByFunctionDeclaration(dllApisetAppmodelRuntime_1_7, GetResolvedPackageFullNameForPackageDependency);
|
||||
//TODO:47775758 GetResolved2 RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(GetLastError()), win11GetResolvedPackageFullNameForPackageDependency2);
|
||||
}
|
||||
|
||||
auto win11GetPackageGraphRevisionId{ static_cast<decltype(&::GetPackageGraphRevisionId)>(nullptr) };
|
||||
HMODULE dllApisetAppmodelRuntime_1_6{};
|
||||
RETURN_IF_FAILED(MddCore::Win11::details::Load(L"api-ms-win-appmodel-runtime-l1-1-6.dll", dllApisetAppmodelRuntime_1_6));
|
||||
if (dllApisetAppmodelRuntime_1_6)
|
||||
{
|
||||
win11GetPackageGraphRevisionId = GetProcAddressByFunctionDeclaration(dllApisetAppmodelRuntime_1_6, GetPackageGraphRevisionId);
|
||||
RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(GetLastError()), win11GetPackageGraphRevisionId);
|
||||
}
|
||||
|
||||
HMODULE dllApisetAppmodelRuntime_1_5{ LoadLibraryExW(L"api-ms-win-appmodel-runtime-l1-1-5.dll", nullptr, 0) };
|
||||
RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(GetLastError()), dllApisetAppmodelRuntime_1_5);
|
||||
auto win11TryCreatePackageDependency{ GetProcAddressByFunctionDeclaration(dllApisetAppmodelRuntime_1_5, TryCreatePackageDependency) };
|
||||
RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(GetLastError()), win11TryCreatePackageDependency);
|
||||
auto win11DeletePackageDependency{ GetProcAddressByFunctionDeclaration(dllApisetAppmodelRuntime_1_5, DeletePackageDependency) };
|
||||
RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(GetLastError()), win11DeletePackageDependency);
|
||||
auto win11AddPackageDependency{ GetProcAddressByFunctionDeclaration(dllApisetAppmodelRuntime_1_5, AddPackageDependency) };
|
||||
RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(GetLastError()), win11AddPackageDependency);
|
||||
auto win11RemovePackageDependency{ GetProcAddressByFunctionDeclaration(dllApisetAppmodelRuntime_1_5, RemovePackageDependency) };
|
||||
RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(GetLastError()), win11RemovePackageDependency);
|
||||
auto win11GetResolvedPackageFullNameForPackageDependency{ GetProcAddressByFunctionDeclaration(dllApisetAppmodelRuntime_1_5, GetResolvedPackageFullNameForPackageDependency) };
|
||||
RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(GetLastError()), win11GetResolvedPackageFullNameForPackageDependency);
|
||||
auto win11GetIdForPackageDependencyContext{ GetProcAddressByFunctionDeclaration(dllApisetAppmodelRuntime_1_5, GetIdForPackageDependencyContext) };
|
||||
RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(GetLastError()), win11GetIdForPackageDependencyContext);
|
||||
auto win11GetCurrentPackageInfo3{ reinterpret_cast<decltype(MddCore::Win11::details::g_win11GetCurrentPackageInfo3)>(GetProcAddress(dllApisetAppmodelRuntime_1_5, "GetCurrentPackageInfo3")) };
|
||||
RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(GetLastError()), win11GetCurrentPackageInfo3);
|
||||
|
||||
// Success
|
||||
MddCore::Win11::details::g_dllApisetAppmodelRuntime_1_7 = dllApisetAppmodelRuntime_1_7;
|
||||
//TODO:47775758 GetResolved2 MddCore::Win11::details::g_win11GetResolvedPackageFullNameForPackageDependency2 = win11GetResolvedPackageFullNameForPackageDependency2;
|
||||
//
|
||||
MddCore::Win11::details::g_dllApisetAppmodelRuntime_1_6 = dllApisetAppmodelRuntime_1_6;
|
||||
MddCore::Win11::details::g_win11GetPackageGraphRevisionId = win11GetPackageGraphRevisionId;
|
||||
//
|
||||
MddCore::Win11::details::g_dllApisetAppmodelRuntime_1_5 = dllApisetAppmodelRuntime_1_5;
|
||||
MddCore::Win11::details::g_win11TryCreatePackageDependency = win11TryCreatePackageDependency;
|
||||
MddCore::Win11::details::g_win11DeletePackageDependency = win11DeletePackageDependency;
|
||||
MddCore::Win11::details::g_win11AddPackageDependency = win11AddPackageDependency;
|
||||
MddCore::Win11::details::g_win11RemovePackageDependency = win11RemovePackageDependency;
|
||||
MddCore::Win11::details::g_win11GetResolvedPackageFullNameForPackageDependency = win11GetResolvedPackageFullNameForPackageDependency;
|
||||
MddCore::Win11::details::g_win11GetIdForPackageDependencyContext = win11GetIdForPackageDependencyContext;
|
||||
MddCore::Win11::details::g_win11GetCurrentPackageInfo3 = win11GetCurrentPackageInfo3;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
inline HRESULT WINAPI MddWin11Shutdown() noexcept
|
||||
{
|
||||
if (MddCore::Win11::details::g_dllApisetAppmodelRuntime_1_7)
|
||||
{
|
||||
//TODO:47775758 GetResolved2 MddCore::Win11::details::g_win11GetResolvedPackageFullNameForPackageDependency2 = nullptr;
|
||||
FreeLibrary(MddCore::Win11::details::g_dllApisetAppmodelRuntime_1_7);
|
||||
MddCore::Win11::details::g_dllApisetAppmodelRuntime_1_7 = nullptr;
|
||||
}
|
||||
|
||||
if (MddCore::Win11::details::g_dllApisetAppmodelRuntime_1_6)
|
||||
{
|
||||
MddCore::Win11::details::g_win11GetPackageGraphRevisionId = nullptr;
|
||||
FreeLibrary(MddCore::Win11::details::g_dllApisetAppmodelRuntime_1_6);
|
||||
MddCore::Win11::details::g_dllApisetAppmodelRuntime_1_6 = nullptr;
|
||||
}
|
||||
|
||||
if (MddCore::Win11::details::g_dllApisetAppmodelRuntime_1_5)
|
||||
{
|
||||
MddCore::Win11::details::g_win11TryCreatePackageDependency = nullptr;
|
||||
MddCore::Win11::details::g_win11DeletePackageDependency = nullptr;
|
||||
MddCore::Win11::details::g_win11AddPackageDependency = nullptr;
|
||||
MddCore::Win11::details::g_win11RemovePackageDependency = nullptr;
|
||||
MddCore::Win11::details::g_win11GetResolvedPackageFullNameForPackageDependency = nullptr;
|
||||
MddCore::Win11::details::g_win11GetIdForPackageDependencyContext = nullptr;
|
||||
MddCore::Win11::details::g_win11GetCurrentPackageInfo3 = nullptr;
|
||||
FreeLibrary(MddCore::Win11::details::g_dllApisetAppmodelRuntime_1_5);
|
||||
MddCore::Win11::details::g_dllApisetAppmodelRuntime_1_5 = nullptr;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#endif // MDDWIN11DYNAMICDEPENDENCY_H
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "PackageDependencyManager.h"
|
||||
#include "PackageGraphManager.h"
|
||||
|
||||
#include "MddWin11.h"
|
||||
|
||||
STDAPI MddTryCreatePackageDependency(
|
||||
PSID user,
|
||||
_In_ PCWSTR packageFamilyName,
|
||||
|
@ -21,7 +23,16 @@ STDAPI MddTryCreatePackageDependency(
|
|||
{
|
||||
*packageDependencyId = nullptr;
|
||||
|
||||
// Dynamic Dependencies requires a non-packaged process
|
||||
// Use the Win11 APIs if available (instead of Detour'ing to our own implementation)
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
RETURN_IF_FAILED(MddCore::Win11::TryCreatePackageDependency(user, packageFamilyName,
|
||||
minVersion, packageDependencyProcessorArchitectures, lifetimeKind, lifetimeArtifact,
|
||||
options, packageDependencyId));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// WinAppSDK's Dynamic Dependencies requires a non-packaged process
|
||||
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), AppModel::Identity::IsPackagedProcess());
|
||||
|
||||
MddCore::PackageDependencyManager::CreatePackageDependency(user, packageFamilyName, minVersion, packageDependencyProcessorArchitectures, lifetimeKind, lifetimeArtifact, options, packageDependencyId);
|
||||
|
@ -32,7 +43,14 @@ CATCH_RETURN();
|
|||
STDAPI_(void) MddDeletePackageDependency(
|
||||
_In_ PCWSTR packageDependencyId) noexcept try
|
||||
{
|
||||
// Dynamic Dependencies requires a non-packaged process
|
||||
// Use the Win11 APIs if available (instead of Detour'ing to our own implementation)
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
MddCore::Win11::DeletePackageDependency(packageDependencyId);
|
||||
return;
|
||||
}
|
||||
|
||||
// WinAppSDK's Dynamic Dependencies requires a non-packaged process
|
||||
THROW_HR_IF(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), AppModel::Identity::IsPackagedProcess());
|
||||
|
||||
MddCore::PackageDependencyManager::DeletePackageDependency(packageDependencyId);
|
||||
|
@ -52,7 +70,14 @@ STDAPI MddAddPackageDependency(
|
|||
*packageFullName = nullptr;
|
||||
}
|
||||
|
||||
// Dynamic Dependencies requires a non-packaged process
|
||||
// Use the Win11 APIs if available (instead of Detour'ing to our own implementation)
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
RETURN_IF_FAILED(MddCore::Win11::AddPackageDependency(packageDependencyId, rank, options, packageDependencyContext, packageFullName));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// WinAppSDK's Dynamic Dependencies requires a non-packaged process
|
||||
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), AppModel::Identity::IsPackagedProcess());
|
||||
|
||||
RETURN_IF_FAILED(MddCore::PackageGraphManager::AddToPackageGraph(packageDependencyId, rank, options, packageDependencyContext, packageFullName));
|
||||
|
@ -63,7 +88,14 @@ CATCH_RETURN();
|
|||
STDAPI_(void) MddRemovePackageDependency(
|
||||
_In_ MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext) noexcept try
|
||||
{
|
||||
// Dynamic Dependencies requires a non-packaged process
|
||||
// Use the Win11 APIs if available (instead of Detour'ing to our own implementation)
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
MddCore::Win11::RemovePackageDependency(packageDependencyContext);
|
||||
return;
|
||||
}
|
||||
|
||||
// WinAppSDK's Dynamic Dependencies requires a non-packaged process
|
||||
LOG_HR_IF(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), AppModel::Identity::IsPackagedProcess());
|
||||
|
||||
MddCore::PackageGraphManager::RemoveFromPackageGraph(packageDependencyContext);
|
||||
|
@ -76,13 +108,46 @@ STDAPI MddGetResolvedPackageFullNameForPackageDependency(
|
|||
{
|
||||
*packageFullName = nullptr;
|
||||
|
||||
// Dynamic Dependencies requires a non-packaged process
|
||||
// Use the Win11 APIs if available (instead of Detour'ing to our own implementation)
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
RETURN_IF_FAILED(MddCore::Win11::GetResolvedPackageFullNameForPackageDependency(packageDependencyId, packageFullName));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// WinAppSDK's Dynamic Dependencies requires a non-packaged process
|
||||
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), AppModel::Identity::IsPackagedProcess());
|
||||
|
||||
RETURN_HR_IF(E_INVALIDARG, !packageDependencyId || (packageDependencyId[0] == L'\0'));
|
||||
|
||||
wil::unique_process_heap_string fullName;
|
||||
RETURN_IF_FAILED(MddCore::PackageGraphManager::ResolvePackageDependency(packageDependencyId, MddAddPackageDependencyOptions::None, fullName));
|
||||
RETURN_IF_FAILED(MddCore::PackageGraphManager::GetResolvedPackageDependency(packageDependencyId, fullName));
|
||||
|
||||
*packageFullName = fullName.release();
|
||||
return S_OK;
|
||||
}
|
||||
CATCH_RETURN();
|
||||
|
||||
STDAPI MddGetResolvedPackageFullNameForPackageDependency2(
|
||||
_In_ PCWSTR packageDependencyId,
|
||||
_Outptr_result_maybenull_ PWSTR* packageFullName) noexcept try
|
||||
{
|
||||
*packageFullName = nullptr;
|
||||
|
||||
// Use the Win11 APIs if available (instead of Detour'ing to our own implementation)
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
RETURN_IF_FAILED(MddCore::Win11::GetResolvedPackageFullNameForPackageDependency2(packageDependencyId, packageFullName));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// WinAppSDK's Dynamic Dependencies requires a non-packaged process
|
||||
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), AppModel::Identity::IsPackagedProcess());
|
||||
|
||||
RETURN_HR_IF(E_INVALIDARG, !packageDependencyId || (packageDependencyId[0] == L'\0'));
|
||||
|
||||
wil::unique_process_heap_string fullName;
|
||||
RETURN_IF_FAILED(MddCore::PackageGraphManager::GetResolvedPackageDependency2(packageDependencyId, fullName));
|
||||
|
||||
*packageFullName = fullName.release();
|
||||
return S_OK;
|
||||
|
@ -95,7 +160,14 @@ STDAPI MddGetIdForPackageDependencyContext(
|
|||
{
|
||||
*packageDependencyId = nullptr;
|
||||
|
||||
// Dynamic Dependencies requires a non-packaged process
|
||||
// Use the Win11 APIs if available (instead of Detour'ing to our own implementation)
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
RETURN_IF_FAILED(MddCore::Win11::GetIdForPackageDependencyContext(packageDependencyContext, packageDependencyId));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// WinAppSDK's Dynamic Dependencies requires a non-packaged process
|
||||
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), AppModel::Identity::IsPackagedProcess());
|
||||
|
||||
RETURN_HR_IF(E_INVALIDARG, !packageDependencyContext);
|
||||
|
@ -110,6 +182,12 @@ CATCH_RETURN();
|
|||
|
||||
STDAPI_(UINT32) MddGetPackageGraphRevisionId() noexcept
|
||||
{
|
||||
// Use the Win11 APIs if available (instead of Detour'ing to our own implementation)
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
return MddCore::Win11::GetPackageGraphRevisionId();
|
||||
}
|
||||
|
||||
return MddCore::PackageGraphManager::GetPackageGraphRevisionId();
|
||||
}
|
||||
|
||||
|
|
|
@ -192,17 +192,28 @@ STDAPI MddAddPackageDependency(
|
|||
STDAPI_(void) MddRemovePackageDependency(
|
||||
_In_ MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext) noexcept;
|
||||
|
||||
/// Return the package full name that would be used if the
|
||||
/// PackageDependency were to be resolved. Does not add the
|
||||
/// Return the package full name to which the
|
||||
/// PackageDependency has been resolved. Does not add the
|
||||
/// package to the process graph.
|
||||
///
|
||||
/// @param packageFullName allocated via HeapAlloc; use HeapFree to deallocate.
|
||||
/// If the package dependency cannot be resolved the function
|
||||
/// succeeds but packageFullName is nullptr.
|
||||
/// @note An unknown packageDependencyId returns S_OK and packageFullName=null.
|
||||
STDAPI MddGetResolvedPackageFullNameForPackageDependency(
|
||||
_In_ PCWSTR packageDependencyId,
|
||||
_Outptr_result_maybenull_ PWSTR* packageFullName) noexcept;
|
||||
|
||||
/// Return the package full name to which the
|
||||
/// PackageDependency has been resolved. Does not add the
|
||||
/// package to the process graph.
|
||||
///
|
||||
/// @param packageFullName allocated via HeapAlloc; use HeapFree to deallocate.
|
||||
/// @note An unknown packageDependencyId returns HRESULT_FROM_WIN32(ERROR_NOT_FOUND).
|
||||
STDAPI MddGetResolvedPackageFullNameForPackageDependency2(
|
||||
_In_ PCWSTR packageDependencyId,
|
||||
_Outptr_result_maybenull_ PWSTR* packageFullName) noexcept;
|
||||
|
||||
/// Return the package dependency for the context.
|
||||
///
|
||||
/// @param packageDependencyId allocated via HeapAlloc; use HeapFree to deallocate.
|
||||
|
|
|
@ -109,6 +109,49 @@ HRESULT MddCore::PackageGraph::Add(
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT MddCore::PackageGraph::GetResolvedPackageDependency(
|
||||
PCWSTR packageDependencyId,
|
||||
wil::unique_process_heap_string& packageFullName) noexcept try
|
||||
{
|
||||
packageFullName.reset();
|
||||
|
||||
// Get the package dependency
|
||||
auto foundPackageDependency{ MddCore::PackageDependencyManager::GetPackageDependency(packageDependencyId) };
|
||||
if (foundPackageDependency)
|
||||
{
|
||||
// Is the package dependency already resolved?
|
||||
const auto& packageDependency{ *foundPackageDependency };
|
||||
if (!packageDependency.PackageFullName().empty())
|
||||
{
|
||||
// Gotcha!
|
||||
packageFullName = wil::make_process_heap_string(packageDependency.PackageFullName().c_str());
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
CATCH_RETURN();
|
||||
|
||||
HRESULT MddCore::PackageGraph::GetResolvedPackageDependency2(
|
||||
PCWSTR packageDependencyId,
|
||||
wil::unique_process_heap_string& packageFullName) noexcept try
|
||||
{
|
||||
packageFullName.reset();
|
||||
|
||||
// Get the package dependency
|
||||
auto foundPackageDependency{ MddCore::PackageDependencyManager::GetPackageDependency(packageDependencyId) };
|
||||
THROW_HR_IF(HRESULT_FROM_WIN32(ERROR_NOT_FOUND), !foundPackageDependency);
|
||||
|
||||
// Is the package dependency already resolved?
|
||||
const auto& packageDependency{ *foundPackageDependency };
|
||||
if (!packageDependency.PackageFullName().empty())
|
||||
{
|
||||
// Gotcha!
|
||||
packageFullName = wil::make_process_heap_string(packageDependency.PackageFullName().c_str());
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
CATCH_RETURN();
|
||||
|
||||
HRESULT MddCore::PackageGraph::ResolvePackageDependency(
|
||||
PCWSTR packageDependencyId,
|
||||
MddAddPackageDependencyOptions options,
|
||||
|
@ -128,7 +171,7 @@ HRESULT MddCore::PackageGraph::ResolvePackageDependency(
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
// Rewsolve it
|
||||
// Resolve it
|
||||
return ResolvePackageDependency(packageDependency, options, packageFullName);
|
||||
}
|
||||
CATCH_RETURN();
|
||||
|
|
|
@ -34,6 +34,24 @@ private:
|
|||
_In_ PCWSTR packageDependencyId,
|
||||
MDD_PACKAGEDEPENDENCY_CONTEXT& context);
|
||||
|
||||
public:
|
||||
HRESULT GetResolvedPackageDependency(
|
||||
PCWSTR packageDependencyId,
|
||||
wil::unique_process_heap_string& packageFullName) noexcept;
|
||||
|
||||
static HRESULT GetResolvedPackageDependency(
|
||||
const MddCore::PackageDependency& packageDependency,
|
||||
wil::unique_process_heap_string& packageFullName);
|
||||
|
||||
public:
|
||||
HRESULT GetResolvedPackageDependency2(
|
||||
PCWSTR packageDependencyId,
|
||||
wil::unique_process_heap_string& packageFullName) noexcept;
|
||||
|
||||
static HRESULT GetResolvedPackageDependency2(
|
||||
const MddCore::PackageDependency& packageDependency,
|
||||
wil::unique_process_heap_string& packageFullName);
|
||||
|
||||
public:
|
||||
HRESULT ResolvePackageDependency(
|
||||
PCWSTR packageDependencyId,
|
||||
|
|
|
@ -26,6 +26,24 @@ UINT32 MddCore::PackageGraphManager::SetPackageGraphRevisionId(const UINT32 valu
|
|||
return static_cast<UINT32>(InterlockedExchange(&s_packageGraphRevisionId, value));
|
||||
}
|
||||
|
||||
HRESULT MddCore::PackageGraphManager::GetResolvedPackageDependency(
|
||||
PCWSTR packageDependencyId,
|
||||
wil::unique_process_heap_string& packageFullName)
|
||||
{
|
||||
std::unique_lock<std::recursive_mutex> lock(s_lock);
|
||||
|
||||
return s_packageGraph.GetResolvedPackageDependency(packageDependencyId, packageFullName);
|
||||
}
|
||||
|
||||
HRESULT MddCore::PackageGraphManager::GetResolvedPackageDependency2(
|
||||
PCWSTR packageDependencyId,
|
||||
wil::unique_process_heap_string& packageFullName)
|
||||
{
|
||||
std::unique_lock<std::recursive_mutex> lock(s_lock);
|
||||
|
||||
return s_packageGraph.GetResolvedPackageDependency2(packageDependencyId, packageFullName);
|
||||
}
|
||||
|
||||
HRESULT MddCore::PackageGraphManager::ResolvePackageDependency(
|
||||
PCWSTR packageDependencyId,
|
||||
MddAddPackageDependencyOptions options,
|
||||
|
|
|
@ -20,6 +20,14 @@ public:
|
|||
static UINT32 SetPackageGraphRevisionId(const UINT32 value);
|
||||
|
||||
public:
|
||||
static HRESULT GetResolvedPackageDependency(
|
||||
PCWSTR packageDependencyId,
|
||||
wil::unique_process_heap_string& packageFullName);
|
||||
|
||||
static HRESULT GetResolvedPackageDependency2(
|
||||
PCWSTR packageDependencyId,
|
||||
wil::unique_process_heap_string& packageFullName);
|
||||
|
||||
static HRESULT ResolvePackageDependency(
|
||||
PCWSTR packageDependencyId,
|
||||
MddAddPackageDependencyOptions options,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include "IDynamicDependencyLifetimeManager.h"
|
||||
|
||||
#include "MddWin11.h"
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
HRESULT _MddBootstrapInitialize(
|
||||
|
@ -24,6 +26,9 @@ void FirstTimeInitialization(
|
|||
UINT32 majorMinorVersion,
|
||||
PCWSTR versionTag,
|
||||
PACKAGE_VERSION minVersion);
|
||||
std::wstring GetFrameworkPackageFamilyName(
|
||||
UINT32 majorMinorVersion,
|
||||
PCWSTR versionTag);
|
||||
wil::unique_cotaskmem_ptr<BYTE[]> GetFrameworkPackageInfoForPackage(PCWSTR packageFullName, const PACKAGE_INFO*& frameworkPackageInfo);
|
||||
DLL_DIRECTORY_COOKIE AddFrameworkToPath(PCWSTR path);
|
||||
void RemoveFrameworkFromPath(PCWSTR frameworkPath);
|
||||
|
@ -104,10 +109,9 @@ STDAPI MddBootstrapInitialize2(
|
|||
|
||||
auto& activityContext{ WindowsAppRuntime::MddBootstrap::Activity::Context::Get() };
|
||||
|
||||
PWSTR initializationFrameworkPackageFullName{};
|
||||
auto initializationCount{ activityContext.GetInitializeData(initializationFrameworkPackageFullName) };
|
||||
auto initializationCount{ activityContext.GetInitializeCount() };
|
||||
activityContext.SetMddBootstrapAPI(WindowsAppRuntime::MddBootstrap::Activity::MddBootstrapAPI::Initialize);
|
||||
auto threadCallback = wil::ThreadFailureCallback(wilResultLoggingThreadCallback);
|
||||
auto threadCallback{ wil::ThreadFailureCallback(wilResultLoggingThreadCallback) };
|
||||
auto initializeActivity{
|
||||
activityContext.GetInitializeActivity().Start(
|
||||
majorMinorVersion,
|
||||
|
@ -145,7 +149,7 @@ STDAPI MddBootstrapInitialize2(
|
|||
DebugBreak();
|
||||
}
|
||||
|
||||
if (hr == HRESULT_FROM_WIN32(ERROR_NO_MATCH))
|
||||
if (hr == STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED)
|
||||
{
|
||||
if (WI_IsFlagSet(options, MddBootstrapInitializeOptions_OnNoMatch_ShowUI) ||
|
||||
IsOptionEnabled(L"MICROSOFT_WINDOWSAPPRUNTIME_BOOTSTRAP_INITIALIZE_SHOWUI"))
|
||||
|
@ -171,6 +175,7 @@ STDAPI MddBootstrapInitialize2(
|
|||
|
||||
if (activityContext.GetInitializeActivity().IsRunning())
|
||||
{
|
||||
PCWSTR initializationFrameworkPackageFullName{};
|
||||
initializationCount = activityContext.GetInitializeData(initializationFrameworkPackageFullName);
|
||||
initializeActivity.StopWithResult(
|
||||
hr,
|
||||
|
@ -194,8 +199,7 @@ HRESULT _MddBootstrapInitialize(
|
|||
PCWSTR versionTag,
|
||||
PACKAGE_VERSION minVersion) noexcept try
|
||||
{
|
||||
PWSTR initializationFrameworkPackageFullName{};
|
||||
auto initializationCount{ WindowsAppRuntime::MddBootstrap::Activity::Context::Get().GetInitializeData(initializationFrameworkPackageFullName) };
|
||||
const auto initializationCount{ WindowsAppRuntime::MddBootstrap::Activity::Context::Get().GetInitializeCount() };
|
||||
|
||||
// Are we already initialized?
|
||||
if (initializationCount > 0)
|
||||
|
@ -218,10 +222,10 @@ STDAPI_(void) MddBootstrapShutdown() noexcept
|
|||
|
||||
auto& activityContext{ WindowsAppRuntime::MddBootstrap::Activity::Context::Get() };
|
||||
|
||||
PWSTR initializationFrameworkPackageFullName{};
|
||||
auto initializationCount{ activityContext.GetInitializeData(initializationFrameworkPackageFullName) };
|
||||
PCWSTR initializationFrameworkPackageFullName{};
|
||||
const auto initializationCount{ activityContext.GetInitializeData(initializationFrameworkPackageFullName) };
|
||||
activityContext.SetMddBootstrapAPI(WindowsAppRuntime::MddBootstrap::Activity::MddBootstrapAPI::Shutdown);
|
||||
auto threadCallback = wil::ThreadFailureCallback(wilResultLoggingThreadCallback);
|
||||
auto threadCallback{ wil::ThreadFailureCallback(wilResultLoggingThreadCallback) };
|
||||
auto shutdownActivity{
|
||||
activityContext.GetShutdownActivity().Start(
|
||||
static_cast<UINT32>(initializationCount),
|
||||
|
@ -231,7 +235,7 @@ STDAPI_(void) MddBootstrapShutdown() noexcept
|
|||
if (initializationCount == 1)
|
||||
{
|
||||
// Last one out turn out the lights...
|
||||
if (g_packageDependencyContext && g_windowsAppRuntimeDll)
|
||||
if (g_packageDependencyContext && (MddCore::Win11::IsSupported() || g_windowsAppRuntimeDll))
|
||||
{
|
||||
MddRemovePackageDependency(g_packageDependencyContext);
|
||||
g_packageDependencyContext = nullptr;
|
||||
|
@ -307,10 +311,16 @@ void VerifyInitializationIsCompatible(
|
|||
// Sanity check we're already initialized
|
||||
// g_lifetimeManager is optional. Don't check it
|
||||
// g_endTheLifetimeManagerEvent is optional. Don't check it
|
||||
FAIL_FAST_HR_IF(E_UNEXPECTED, g_windowsAppRuntimeDll == nullptr);
|
||||
// g_windowsAppRuntimeDll is only relevant if not delegating to OS APIs
|
||||
FAIL_FAST_HR_IF(E_UNEXPECTED, !MddCore::Win11::IsSupported() && (g_windowsAppRuntimeDll == nullptr));
|
||||
FAIL_FAST_HR_IF(E_UNEXPECTED, g_packageDependencyId == nullptr);
|
||||
FAIL_FAST_HR_IF(E_UNEXPECTED, g_packageDependencyContext == nullptr);
|
||||
|
||||
// Verify the parameter(s)
|
||||
// NOTE: GetFrameworkPackageFamilyName() verifies the resulting package family name is valid.
|
||||
// We don't care about the return value, just the verification along the way.
|
||||
GetFrameworkPackageFamilyName(majorMinorVersion, versionTag);
|
||||
|
||||
// Is the initialization request compatible with the current initialization state?
|
||||
THROW_HR_IF_MSG(MDD_E_BOOTSTRAP_INITIALIZE_INCOMPATIBLE,
|
||||
majorMinorVersion != g_initializationMajorMinorVersion,
|
||||
|
@ -351,74 +361,144 @@ void FirstTimeInitialization(
|
|||
FAIL_FAST_HR_IF(E_UNEXPECTED, g_packageDependencyContext != nullptr);
|
||||
|
||||
// Make a copy of the versionTag in preparation of succcess
|
||||
auto packageVersionTag{ std::wstring(!versionTag ? L"" : versionTag) };
|
||||
const std::wstring packageVersionTag{ !versionTag ? L"" : versionTag };
|
||||
|
||||
// Create the lifetime manager
|
||||
wil::com_ptr_nothrow<IDynamicDependencyLifetimeManager> lifetimeManager;
|
||||
wil::unique_event endTheLifetimeManagerEvent;
|
||||
auto& activityContext{ WindowsAppRuntime::MddBootstrap::Activity::Context::Get() };
|
||||
CreateLifetimeManager(majorMinorVersion, versionTag, minVersion, lifetimeManager, endTheLifetimeManagerEvent, activityContext.GetInitializationPackageFullName());
|
||||
|
||||
const PACKAGE_INFO* frameworkPackageInfo{};
|
||||
auto packageInfoBuffer{ GetFrameworkPackageInfoForPackage(activityContext.GetInitializationPackageFullName().get(), frameworkPackageInfo) };
|
||||
|
||||
// Temporarily add the framework's package directory to PATH so LoadLibrary can find it and any colocated imports
|
||||
wil::unique_dll_directory_cookie dllDirectoryCookie{ AddFrameworkToPath(frameworkPackageInfo->path) };
|
||||
|
||||
auto windowsAppRuntimeDllFilename{ std::wstring(frameworkPackageInfo->path) + L"\\Microsoft.WindowsAppRuntime.dll" };
|
||||
wil::unique_hmodule windowsAppRuntimeDll(LoadLibraryEx(windowsAppRuntimeDllFilename.c_str(), nullptr, LOAD_WITH_ALTERED_SEARCH_PATH));
|
||||
if (!windowsAppRuntimeDll)
|
||||
// Use the Win11 APIs if available (instead of WinAppSDK's implementation)
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
const auto lastError{ GetLastError() };
|
||||
THROW_WIN32_MSG(lastError, "Error in LoadLibrary: %d (0x%X) loading %ls", lastError, lastError, windowsAppRuntimeDllFilename.c_str());
|
||||
// Add the framework package to the package graph
|
||||
const std::wstring frameworkPackageFamilyName{ GetFrameworkPackageFamilyName(majorMinorVersion, packageVersionTag.c_str()) };
|
||||
const MddPackageDependencyProcessorArchitectures architectureFilter{};
|
||||
const auto lifetimeKind{ MddPackageDependencyLifetimeKind::Process };
|
||||
const MddCreatePackageDependencyOptions createOptions{};
|
||||
wil::unique_process_heap_string packageDependencyId;
|
||||
THROW_IF_FAILED(MddCore::Win11::TryCreatePackageDependency(nullptr, frameworkPackageFamilyName.c_str(), minVersion, architectureFilter, lifetimeKind, nullptr, createOptions, &packageDependencyId));
|
||||
//
|
||||
const MddAddPackageDependencyOptions addOptions{};
|
||||
MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext{};
|
||||
wil::unique_process_heap_string packageFullName;
|
||||
THROW_IF_FAILED(MddCore::Win11::AddPackageDependency(packageDependencyId.get(), MDD_PACKAGE_DEPENDENCY_RANK_DEFAULT, addOptions, &packageDependencyContext, &packageFullName));
|
||||
|
||||
// Update the activity context
|
||||
auto& activityContext{ WindowsAppRuntime::MddBootstrap::Activity::Context::Get() };
|
||||
activityContext.SetInitializationPackageFullName(packageFullName.get());
|
||||
|
||||
// Pass along test information (if necessary)
|
||||
if (!g_test_frameworkPackageNamePrefix.empty())
|
||||
{
|
||||
FAIL_FAST_HR_IF(E_UNEXPECTED, g_test_ddlmPackageNamePrefix.empty());
|
||||
FAIL_FAST_HR_IF(E_UNEXPECTED, g_test_ddlmPackagePublisherId.empty());
|
||||
FAIL_FAST_HR_IF(E_UNEXPECTED, g_test_mainPackageNamePrefix.empty());
|
||||
|
||||
::WindowsAppRuntime::VersionInfo::TestInitialize(frameworkPackageFamilyName.c_str());
|
||||
}
|
||||
|
||||
// Track our initialized state
|
||||
g_packageDependencyId = std::move(packageDependencyId);
|
||||
g_packageDependencyContext = packageDependencyContext;
|
||||
//
|
||||
g_initializationMajorMinorVersion = majorMinorVersion;
|
||||
g_initializationVersionTag = std::move(packageVersionTag);
|
||||
const auto frameworkPackageIdentity{ ::AppModel::Identity::PackageIdentity::FromPackageFullName(packageFullName.get()) };
|
||||
g_initializationFrameworkPackageVersion.Version = frameworkPackageIdentity.Version().Version;
|
||||
}
|
||||
|
||||
// Add the framework package to the package graph
|
||||
const MddPackageDependencyProcessorArchitectures architectureFilter{};
|
||||
const auto lifetimeKind{ MddPackageDependencyLifetimeKind::Process };
|
||||
const MddCreatePackageDependencyOptions createOptions{};
|
||||
wil::unique_process_heap_string packageDependencyId;
|
||||
THROW_IF_FAILED(MddTryCreatePackageDependency(nullptr, frameworkPackageInfo->packageFamilyName, minVersion, architectureFilter, lifetimeKind, nullptr, createOptions, &packageDependencyId));
|
||||
//
|
||||
const MddAddPackageDependencyOptions addOptions{};
|
||||
MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext{};
|
||||
THROW_IF_FAILED(MddAddPackageDependency(packageDependencyId.get(), MDD_PACKAGE_DEPENDENCY_RANK_DEFAULT, addOptions, &packageDependencyContext, nullptr));
|
||||
|
||||
// Remove our temporary path addition
|
||||
RemoveFrameworkFromPath(frameworkPackageInfo->path);
|
||||
dllDirectoryCookie.reset();
|
||||
|
||||
// Pass along test information (if necessary)
|
||||
if (!g_test_ddlmPackageNamePrefix.empty())
|
||||
else
|
||||
{
|
||||
FAIL_FAST_HR_IF(E_UNEXPECTED, g_test_ddlmPackagePublisherId.empty());
|
||||
FAIL_FAST_HR_IF(E_UNEXPECTED, g_test_frameworkPackageNamePrefix.empty());
|
||||
FAIL_FAST_HR_IF(E_UNEXPECTED, g_test_mainPackageNamePrefix.empty());
|
||||
// Create the lifetime manager
|
||||
wil::com_ptr_nothrow<IDynamicDependencyLifetimeManager> lifetimeManager;
|
||||
wil::unique_event endTheLifetimeManagerEvent;
|
||||
auto& activityContext{ WindowsAppRuntime::MddBootstrap::Activity::Context::Get() };
|
||||
CreateLifetimeManager(majorMinorVersion, versionTag, minVersion, lifetimeManager, endTheLifetimeManagerEvent, activityContext.GetInitializationPackageFullName());
|
||||
|
||||
uint16_t majorVersion{ static_cast<uint16_t>(majorMinorVersion >> 16) };
|
||||
uint16_t minorVersion{ static_cast<uint16_t>(majorMinorVersion) };
|
||||
PCWSTR packagVersionTagDelimiter{ packageVersionTag.empty() ? L"" : L"-" };
|
||||
const PACKAGE_INFO* frameworkPackageInfo{};
|
||||
auto packageInfoBuffer{ GetFrameworkPackageInfoForPackage(activityContext.GetInitializationPackageFullName().get(), frameworkPackageInfo) };
|
||||
|
||||
WCHAR frameworkPackageFamilyName[PACKAGE_FAMILY_NAME_MAX_LENGTH + 1]{};
|
||||
wsprintf(frameworkPackageFamilyName, L"%s-%hu.%hu%s%s_8wekyb3d8bbwe", g_test_frameworkPackageNamePrefix.c_str(),
|
||||
majorVersion, minorVersion, packagVersionTagDelimiter, packageVersionTag.c_str());
|
||||
// Temporarily add the framework's package directory to PATH so LoadLibrary can find it and any colocated imports
|
||||
wil::unique_dll_directory_cookie dllDirectoryCookie{ AddFrameworkToPath(frameworkPackageInfo->path) };
|
||||
|
||||
WCHAR mainPackageFamilyName[PACKAGE_FAMILY_NAME_MAX_LENGTH + 1]{};
|
||||
wsprintf(mainPackageFamilyName, L"%s-%hu.%hu%s%s_8wekyb3d8bbwe", g_test_mainPackageNamePrefix.c_str(),
|
||||
majorVersion, minorVersion, packagVersionTagDelimiter, packageVersionTag.c_str());
|
||||
::WindowsAppRuntime::VersionInfo::TestInitialize(frameworkPackageFamilyName, mainPackageFamilyName);
|
||||
auto windowsAppRuntimeDllFilename{ std::wstring(frameworkPackageInfo->path) + L"\\Microsoft.WindowsAppRuntime.dll" };
|
||||
wil::unique_hmodule windowsAppRuntimeDll(LoadLibraryEx(windowsAppRuntimeDllFilename.c_str(), nullptr, LOAD_WITH_ALTERED_SEARCH_PATH));
|
||||
if (!windowsAppRuntimeDll)
|
||||
{
|
||||
const auto lastError{ GetLastError() };
|
||||
THROW_WIN32_MSG(lastError, "Error in LoadLibrary: %d (0x%X) loading %ls", lastError, lastError, windowsAppRuntimeDllFilename.c_str());
|
||||
}
|
||||
|
||||
// Add the framework package to the package graph
|
||||
const MddPackageDependencyProcessorArchitectures architectureFilter{};
|
||||
const auto lifetimeKind{ MddPackageDependencyLifetimeKind::Process };
|
||||
const MddCreatePackageDependencyOptions createOptions{};
|
||||
wil::unique_process_heap_string packageDependencyId;
|
||||
THROW_IF_FAILED(MddTryCreatePackageDependency(nullptr, frameworkPackageInfo->packageFamilyName, minVersion, architectureFilter, lifetimeKind, nullptr, createOptions, &packageDependencyId));
|
||||
//
|
||||
const MddAddPackageDependencyOptions addOptions{};
|
||||
MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext{};
|
||||
THROW_IF_FAILED(MddAddPackageDependency(packageDependencyId.get(), MDD_PACKAGE_DEPENDENCY_RANK_DEFAULT, addOptions, &packageDependencyContext, nullptr));
|
||||
|
||||
// Remove our temporary path addition
|
||||
RemoveFrameworkFromPath(frameworkPackageInfo->path);
|
||||
dllDirectoryCookie.reset();
|
||||
|
||||
// Pass along test information (if necessary)
|
||||
if (!g_test_ddlmPackageNamePrefix.empty())
|
||||
{
|
||||
FAIL_FAST_HR_IF(E_UNEXPECTED, g_test_ddlmPackagePublisherId.empty());
|
||||
FAIL_FAST_HR_IF(E_UNEXPECTED, g_test_frameworkPackageNamePrefix.empty());
|
||||
FAIL_FAST_HR_IF(E_UNEXPECTED, g_test_mainPackageNamePrefix.empty());
|
||||
|
||||
uint16_t majorVersion{ static_cast<uint16_t>(majorMinorVersion >> 16) };
|
||||
uint16_t minorVersion{ static_cast<uint16_t>(majorMinorVersion) };
|
||||
PCWSTR packagVersionTagDelimiter{ packageVersionTag.empty() ? L"" : L"-" };
|
||||
|
||||
const std::wstring frameworkPackageFamilyName{ std::format(L"{}-{}.{}{}{}_8wekyb3d8bbwe",
|
||||
g_test_frameworkPackageNamePrefix,
|
||||
majorVersion, minorVersion,
|
||||
packagVersionTagDelimiter, packageVersionTag) };
|
||||
FAIL_FAST_HR_IF_MSG(E_UNEXPECTED, frameworkPackageFamilyName.length() > PACKAGE_FAMILY_NAME_MAX_LENGTH, "%ls", frameworkPackageFamilyName.c_str());
|
||||
|
||||
const std::wstring mainPackageFamilyName{ std::format(L"{}-{}.{}{}{}_8wekyb3d8bbwe",
|
||||
g_test_mainPackageNamePrefix,
|
||||
majorVersion, minorVersion,
|
||||
packagVersionTagDelimiter, packageVersionTag) };
|
||||
FAIL_FAST_HR_IF_MSG(E_UNEXPECTED, mainPackageFamilyName.length() > PACKAGE_FAMILY_NAME_MAX_LENGTH, "%ls", mainPackageFamilyName.c_str());
|
||||
|
||||
::WindowsAppRuntime::VersionInfo::TestInitialize(frameworkPackageFamilyName.c_str(), mainPackageFamilyName.c_str());
|
||||
}
|
||||
|
||||
// Track our initialized state
|
||||
g_lifetimeManager = lifetimeManager.detach();
|
||||
g_endTheLifetimeManagerEvent = std::move(endTheLifetimeManagerEvent);
|
||||
g_windowsAppRuntimeDll = std::move(windowsAppRuntimeDll);
|
||||
g_packageDependencyId = std::move(packageDependencyId);
|
||||
g_packageDependencyContext = packageDependencyContext;
|
||||
//
|
||||
g_initializationMajorMinorVersion = majorMinorVersion;
|
||||
g_initializationVersionTag = std::move(packageVersionTag);
|
||||
g_initializationFrameworkPackageVersion.Version = frameworkPackageInfo->packageId.version.Version;
|
||||
}
|
||||
}
|
||||
|
||||
// Track our initialized state
|
||||
g_lifetimeManager = lifetimeManager.detach();
|
||||
g_endTheLifetimeManagerEvent = std::move(endTheLifetimeManagerEvent);
|
||||
g_windowsAppRuntimeDll = std::move(windowsAppRuntimeDll);
|
||||
g_packageDependencyId = std::move(packageDependencyId);
|
||||
g_packageDependencyContext = packageDependencyContext;
|
||||
//
|
||||
g_initializationMajorMinorVersion = majorMinorVersion;
|
||||
g_initializationVersionTag = std::move(packageVersionTag);
|
||||
g_initializationFrameworkPackageVersion.Version = frameworkPackageInfo->packageId.version.Version;
|
||||
/// Determine the package family name for the Windows App Runtime Framework package
|
||||
std::wstring GetFrameworkPackageFamilyName(
|
||||
UINT32 majorMinorVersion,
|
||||
PCWSTR versionTag)
|
||||
{
|
||||
PCWSTR namePrefix{ !g_test_frameworkPackageNamePrefix.empty() ?
|
||||
g_test_frameworkPackageNamePrefix.c_str() :
|
||||
L"Microsoft.WindowsAppRuntime" };
|
||||
|
||||
const uint16_t majorVersion{ static_cast<uint16_t>(majorMinorVersion >> 16) };
|
||||
const uint16_t minorVersion{ static_cast<uint16_t>(majorMinorVersion) };
|
||||
|
||||
PCWSTR packageVersionTag{ !versionTag ? L"" : versionTag };
|
||||
PCWSTR packageVersionTagDelimiter{ (packageVersionTag[0] == L'\0') ? L"" : L"-"};
|
||||
|
||||
const std::wstring packageFamilyName{ std::format(L"{}-{}.{}{}{}_8wekyb3d8bbwe",
|
||||
namePrefix, majorVersion, minorVersion,
|
||||
packageVersionTagDelimiter, packageVersionTag) };
|
||||
THROW_HR_IF_MSG(E_INVALIDARG, packageFamilyName.length() > PACKAGE_FAMILY_NAME_MAX_LENGTH, "%ls", packageFamilyName.c_str());
|
||||
|
||||
return packageFamilyName;
|
||||
}
|
||||
|
||||
/// Determine the path for the Windows App Runtime Framework package
|
||||
|
@ -670,17 +750,21 @@ CLSID FindDDLMViaAppExtension(
|
|||
// Look for windows.appExtension with name="microsoft.winappruntime.ddlm-<majorversion>.<minorversion>-<shortarchitecture>[-shorttag]"
|
||||
// NOTE: <majorversion>.<minorversion> MUST have a string length <= 8 characters ("12.34567", "12345.67", etc) to fit within
|
||||
// the maximum allowed length of a windows.appExtension's Name (39 chars) on Windows versions <= RS5 (10.0.17763.0).
|
||||
WCHAR appExtensionName[100]{};
|
||||
std::wstring appExtensionName;
|
||||
const UINT16 majorVersion{ HIWORD(majorMinorVersion) };
|
||||
const UINT16 minorVersion{ LOWORD(majorMinorVersion) };
|
||||
const auto versionShortTag{ AppModel::Identity::GetVersionShortTagFromVersionTag(versionTag) };
|
||||
if (!versionShortTag.empty())
|
||||
{
|
||||
wsprintf(appExtensionName, L"microsoft.winappruntime.ddlm-%hu.%hu-%s-%s", majorVersion, minorVersion, AppModel::Identity::GetCurrentArchitectureAsShortString(), versionShortTag.c_str());
|
||||
appExtensionName = std::format(L"microsoft.winappruntime.ddlm-{}.{}-{}-{}",
|
||||
majorVersion, minorVersion, AppModel::Identity::GetCurrentArchitectureAsShortString(), versionShortTag);
|
||||
THROW_HR_IF_MSG(E_INVALIDARG, appExtensionName.length() > PACKAGE_NAME_MAX_LENGTH, "%ls", appExtensionName.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
wsprintf(appExtensionName, L"microsoft.winappruntime.ddlm-%hu.%hu-%s", majorVersion, minorVersion, AppModel::Identity::GetCurrentArchitectureAsShortString());
|
||||
appExtensionName = std::format(L"microsoft.winappruntime.ddlm-{}.{}-{}",
|
||||
majorVersion, minorVersion, AppModel::Identity::GetCurrentArchitectureAsShortString());
|
||||
THROW_HR_IF_MSG(E_INVALIDARG, appExtensionName.length() > PACKAGE_NAME_MAX_LENGTH, "%ls", appExtensionName.c_str());
|
||||
}
|
||||
|
||||
auto catalog{ winrt::Windows::ApplicationModel::AppExtensions::AppExtensionCatalog::Open(appExtensionName) };
|
||||
|
@ -742,8 +826,8 @@ CLSID FindDDLMViaAppExtension(
|
|||
continue;
|
||||
}
|
||||
}
|
||||
THROW_HR_IF_MSG(HRESULT_FROM_WIN32(ERROR_NO_MATCH), !foundAny, "AppExtension.Name=%ls, Major=%hu, Minor=%hu, Tag=%ls, MinVersion=%hu.%hu.%hu.%hu",
|
||||
appExtensionName, majorVersion, minorVersion, (!versionTag ? L"" : versionTag),
|
||||
THROW_HR_IF_MSG(STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED, !foundAny, "AppExtension.Name=%ls, Major=%hu, Minor=%hu, Tag=%ls, MinVersion=%hu.%hu.%hu.%hu",
|
||||
appExtensionName.c_str(), majorVersion, minorVersion, (!versionTag ? L"" : versionTag),
|
||||
minVersion.Major, minVersion.Minor, minVersion.Build, minVersion.Revision);
|
||||
return bestFitClsid;
|
||||
}
|
||||
|
@ -940,7 +1024,7 @@ void FindDDLMViaEnumeration(
|
|||
continue;
|
||||
}
|
||||
}
|
||||
THROW_HR_IF_MSG(HRESULT_FROM_WIN32(ERROR_NO_MATCH), !foundAny, "Enumeration: %ls", criteria.get());
|
||||
THROW_HR_IF_MSG(STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED, !foundAny, "Enumeration: %ls", criteria.get());
|
||||
(void)LOG_HR_MSG(MDD_E_BOOTSTRAP_INITIALIZE_DDLM_FOUND,
|
||||
"Bootstrap.Intitialize: %ls best matches the criteria (%ls) of %d packages scanned",
|
||||
bestFitPackageFullName.c_str(), criteria.get(), packagesScanned);
|
||||
|
|
|
@ -56,10 +56,15 @@ namespace WindowsAppRuntime::MddBootstrap::Activity
|
|||
return m_mddBootstrapAPI;
|
||||
}
|
||||
|
||||
const uint32_t GetInitializeData(PWSTR& initializationPackageFullName) const
|
||||
const uint32_t GetInitializeCount() const
|
||||
{
|
||||
return m_initializationCount;
|
||||
}
|
||||
|
||||
const uint32_t GetInitializeData(PCWSTR& initializationPackageFullName) const
|
||||
{
|
||||
initializationPackageFullName = m_initializationPackageFullName.get();
|
||||
return m_initializationCount;
|
||||
return GetInitializeCount();
|
||||
}
|
||||
|
||||
wil::unique_cotaskmem_string& GetInitializationPackageFullName()
|
||||
|
@ -113,7 +118,15 @@ namespace WindowsAppRuntime::MddBootstrap::Activity
|
|||
|
||||
void SetInitializationPackageFullName(PWSTR initializationPackageFullName)
|
||||
{
|
||||
m_initializationPackageFullName.reset(initializationPackageFullName);
|
||||
if (initializationPackageFullName)
|
||||
{
|
||||
auto packageFullName{ wil::make_cotaskmem_string(initializationPackageFullName) };
|
||||
m_initializationPackageFullName = std::move(packageFullName);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_initializationPackageFullName.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void StopActivityForWilReturnHR(const bool stopActivityForWilReturnHR)
|
||||
|
|
|
@ -12,7 +12,7 @@ void MddBootstrap_StopActivity(
|
|||
{
|
||||
if (isActivityRunning)
|
||||
{
|
||||
PWSTR initializationFrameworkPackageFullName{};
|
||||
PCWSTR initializationFrameworkPackageFullName{};
|
||||
auto initializationCount{ activityContext.GetInitializeData(initializationFrameworkPackageFullName) };
|
||||
|
||||
if (activityContext.GetMddBootstrapAPI() == WindowsAppRuntime::MddBootstrap::Activity::MddBootstrapAPI::Initialize)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
const HRESULT hresult,
|
||||
UINT32 initializationCount,
|
||||
UINT32 IntegrityFlags,
|
||||
PWSTR resolvedFrameworkPackageFullName,
|
||||
PCWSTR resolvedFrameworkPackageFullName,
|
||||
UINT32 failureType,
|
||||
PCSTR failureFile,
|
||||
unsigned int failureLineNumber,
|
||||
|
@ -78,7 +78,7 @@ public:
|
|||
BEGIN_COMPLIANT_CRITICAL_DATA_ACTIVITY_CLASS(Shutdown, PDT_ProductAndServicePerformance);
|
||||
void StartActivity(
|
||||
UINT32 initializationCount,
|
||||
PWSTR resolvedFrameworkPackageFullName)
|
||||
PCWSTR resolvedFrameworkPackageFullName)
|
||||
{
|
||||
// Set lifetime activity Id that helps in corelating all sub-activities/telemetry from a single Mdd Bootstrap lifetime
|
||||
SetRelatedActivityId(GetLifetimeActivityId());
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "pch.h"
|
||||
|
||||
#include "MddWin11.h"
|
||||
|
||||
// Including this file once per binary will automatically opt WIL error handling macros into calling RoOriginateError when they
|
||||
// begin logging a new error. This greatly improves the debuggability of errors that propagate before a failfast.
|
||||
#include <wil/result_originate.h>
|
||||
|
@ -12,10 +14,19 @@ BOOL APIENTRY DllMain(HMODULE hmodule, DWORD reason, LPVOID reserved)
|
|||
switch (reason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
DisableThreadLibraryCalls(hmodule);
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
FAIL_FAST_IF_FAILED(MddWin11Initialize());
|
||||
break;
|
||||
}
|
||||
case DLL_PROCESS_DETACH:
|
||||
{
|
||||
MddWin11Shutdown();
|
||||
break;
|
||||
}
|
||||
case DLL_THREAD_ATTACH:
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ EXPORTS
|
|||
MddDeletePackageDependency
|
||||
MddGetIdForPackageDependencyContext
|
||||
MddGetResolvedPackageFullNameForPackageDependency
|
||||
MddGetResolvedPackageFullNameForPackageDependency2
|
||||
MddRemovePackageDependency
|
||||
MddTryCreatePackageDependency
|
||||
MddLifetimeManagementGC
|
||||
|
|
|
@ -30,11 +30,8 @@ static HRESULT DetoursInitialize()
|
|||
// Detour APIs to our implementation
|
||||
DetourRestoreAfterWith();
|
||||
FAIL_FAST_IF_WIN32_ERROR(DetourTransactionBegin());
|
||||
|
||||
FAIL_FAST_IF_FAILED(MddWin11Initialize());
|
||||
FAIL_FAST_IF_FAILED(MddDetourPackageGraphInitialize());
|
||||
FAIL_FAST_IF_FAILED(UrfwInitialize());
|
||||
|
||||
FAIL_FAST_IF_WIN32_ERROR(DetourTransactionCommit());
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -56,10 +53,8 @@ static HRESULT DetoursShutdown()
|
|||
// Stop Detour'ing APIs to our implementation
|
||||
FAIL_FAST_IF_WIN32_ERROR(DetourTransactionBegin());
|
||||
FAIL_FAST_IF_WIN32_ERROR(DetourUpdateThread(GetCurrentThread()));
|
||||
|
||||
UrfwShutdown();
|
||||
MddDetourPackageGraphShutdown();
|
||||
|
||||
FAIL_FAST_IF_WIN32_ERROR(DetourTransactionCommit());
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -71,12 +66,14 @@ BOOL APIENTRY DllMain(HMODULE hmodule, DWORD reason, LPVOID reserved)
|
|||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
DisableThreadLibraryCalls(hmodule);
|
||||
FAIL_FAST_IF_FAILED(MddWin11Initialize());
|
||||
FAIL_FAST_IF_FAILED(DetoursInitialize());
|
||||
break;
|
||||
}
|
||||
case DLL_PROCESS_DETACH:
|
||||
{
|
||||
DetoursShutdown();
|
||||
MddWin11Shutdown();
|
||||
break;
|
||||
}
|
||||
case DLL_THREAD_ATTACH:
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,252 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(NugetPackageDirectory)\Microsoft.Build.Tasks.Git.$(MicrosoftBuildTasksGitVersion)\build\Microsoft.Build.Tasks.Git.props" Condition="Exists('$(NugetPackageDirectory)\Microsoft.Build.Tasks.Git.$(MicrosoftBuildTasksGitVersion)\build\Microsoft.Build.Tasks.Git.props')" />
|
||||
<Import Project="$(NugetPackageDirectory)\Microsoft.Windows.CppWinRT.$(MicrosoftWindowsCppWinRTVersion)\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(NugetPackageDirectory)\Microsoft.Windows.CppWinRT.$(MicrosoftWindowsCppWinRTVersion)\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="$(NugetPackageDirectory)\Microsoft.SourceLink.Common.$(MicrosoftSourceLinkCommonVersion)\build\Microsoft.SourceLink.Common.props" Condition="Exists('$(NugetPackageDirectory)\Microsoft.SourceLink.Common.$(MicrosoftSourceLinkCommonVersion)\build\Microsoft.SourceLink.Common.props')" />
|
||||
<Import Project="$(NugetPackageDirectory)\Microsoft.SourceLink.GitHub.$(MicrosoftSourceLinkGitHubVersion)\build\Microsoft.SourceLink.GitHub.props" Condition="Exists('$(NugetPackageDirectory)\Microsoft.SourceLink.GitHub.$(MicrosoftSourceLinkGitHubVersion)\build\Microsoft.SourceLink.GitHub.props')" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{d45d4170-e055-4926-8b03-04daa5f02c6c}</ProjectGuid>
|
||||
<RootNamespace>WindowsAppRuntime_MSIXInstallFromPath</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<UseUnicrt>true</UseUnicrt>
|
||||
<CppWinRTModernIDL>true</CppWinRTModernIDL>
|
||||
<CppWinRTFastAbi>true</CppWinRTFastAbi>
|
||||
<CppWinRTOptimized>true</CppWinRTOptimized>
|
||||
<CppWinRTGenerateWindowsMetadata>false</CppWinRTGenerateWindowsMetadata>
|
||||
<CppWinRTNamespaceMergeDepth>9</CppWinRTNamespaceMergeDepth>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
<Import Project="..\Common\Common.vcxitems" Label="Shared" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<TargetName>WindowsAppRuntime_MSIXInstallFromPath</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<TargetName>WindowsAppRuntime_MSIXInstallFromPath</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<TargetName>WindowsAppRuntime_MSIXInstallFromPath</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<TargetName>WindowsAppRuntime_MSIXInstallFromPath</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<TargetName>WindowsAppRuntime_MSIXInstallFromPath</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
<TargetName>WindowsAppRuntime_MSIXInstallFromPath</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<RepoRoot>$(MSBuildThisFileDirectory)..\..\</RepoRoot>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>UNICODE;_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)$(PlatformTarget)\$(Configuration);$(SolutionDir)common;$(OutDir)\..\PushNotificationsLongRunningTask.ProxyStub;$(RepoRoot)dev\PushNotifications\PushNotificationsLongRunningTask.StartupTask;$(RepoRoot)\Dev\PushNotifications</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<AdditionalDependencies>onecore.lib;onecoreuap.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)$(PlatformTarget)\$(Configuration);$(SolutionDir)common;$(OutDir)\..\PushNotificationsLongRunningTask.ProxyStub;$(RepoRoot)dev\PushNotifications\PushNotificationsLongRunningTask.StartupTask;$(RepoRoot)\Dev\PushNotifications</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<AdditionalDependencies>onecore.lib;onecoreuap.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)$(PlatformTarget)\$(Configuration);$(SolutionDir)common;$(OutDir)\..\PushNotificationsLongRunningTask.ProxyStub;$(RepoRoot)dev\PushNotifications\PushNotificationsLongRunningTask.StartupTask;$(RepoRoot)\Dev\PushNotifications</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<AdditionalDependencies>onecore.lib;onecoreuap.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)$(PlatformTarget)\$(Configuration);$(SolutionDir)common;$(OutDir)\..\PushNotificationsLongRunningTask.ProxyStub;$(RepoRoot)dev\PushNotifications\PushNotificationsLongRunningTask.StartupTask;$(RepoRoot)\Dev\PushNotifications</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<AdditionalDependencies>onecore.lib;onecoreuap.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)$(PlatformTarget)\$(Configuration);$(SolutionDir)common;$(OutDir)\..\PushNotificationsLongRunningTask.ProxyStub;$(RepoRoot)dev\PushNotifications\PushNotificationsLongRunningTask.StartupTask;$(RepoRoot)\Dev\PushNotifications</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<AdditionalDependencies>onecore.lib;onecoreuap.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)$(PlatformTarget)\$(Configuration);$(SolutionDir)common;$(OutDir)\..\PushNotificationsLongRunningTask.ProxyStub;$(RepoRoot)dev\PushNotifications\PushNotificationsLongRunningTask.StartupTask;$(RepoRoot)\Dev\PushNotifications</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<AdditionalDependencies>onecore.lib;onecoreuap.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(NugetPackageDirectory)\Microsoft.Windows.CppWinRT.$(MicrosoftWindowsCppWinRTVersion)\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(NugetPackageDirectory)\Microsoft.Windows.CppWinRT.$(MicrosoftWindowsCppWinRTVersion)\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="$(NugetPackageDirectory)\Microsoft.SourceLink.Common.$(MicrosoftSourceLinkCommonVersion)\build\Microsoft.SourceLink.Common.targets" Condition="Exists('$(NugetPackageDirectory)\Microsoft.SourceLink.Common.$(MicrosoftSourceLinkCommonVersion)\build\Microsoft.SourceLink.Common.targets')" />
|
||||
<Import Project="$(NugetPackageDirectory)\Microsoft.Build.Tasks.Git.$(MicrosoftBuildTasksGitVersion)\build\Microsoft.Build.Tasks.Git.targets" Condition="Exists('$(NugetPackageDirectory)\Microsoft.Build.Tasks.Git.$(MicrosoftBuildTasksGitVersion)\build\Microsoft.Build.Tasks.Git.targets')" />
|
||||
<Import Project="$(NugetPackageDirectory)\Microsoft.SourceLink.GitHub.$(MicrosoftSourceLinkGitHubVersion)\build\Microsoft.SourceLink.GitHub.targets" Condition="Exists('$(NugetPackageDirectory)\Microsoft.SourceLink.GitHub.$(MicrosoftSourceLinkGitHubVersion)\build\Microsoft.SourceLink.GitHub.targets')" />
|
||||
<Import Project="$(NugetPackageDirectory)\Microsoft.Windows.ImplementationLibrary.$(MicrosoftWindowsImplementationLibraryVersion)\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('$(NugetPackageDirectory)\Microsoft.Windows.ImplementationLibrary.$(MicrosoftWindowsImplementationLibraryVersion)\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(NugetPackageDirectory)\Microsoft.Windows.CppWinRT.$(MicrosoftWindowsCppWinRTVersion)\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(NugetPackageDirectory)\Microsoft.Windows.CppWinRT.$(MicrosoftWindowsCppWinRTVersion)\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('$(NugetPackageDirectory)\Microsoft.Windows.CppWinRT.$(MicrosoftWindowsCppWinRTVersion)\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(NugetPackageDirectory)\Microsoft.Windows.CppWinRT.$(MicrosoftWindowsCppWinRTVersion)\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('$(NugetPackageDirectory)\Microsoft.SourceLink.Common.$(MicrosoftSourceLinkCommonVersion)\build\Microsoft.SourceLink.Common.props')" Text="$([System.String]::Format('$(ErrorText)', '$(NugetPackageDirectory)\Microsoft.SourceLink.Common.$(MicrosoftSourceLinkCommonVersion)\build\Microsoft.SourceLink.Common.props'))" />
|
||||
<Error Condition="!Exists('$(NugetPackageDirectory)\Microsoft.SourceLink.Common.$(MicrosoftSourceLinkCommonVersion)\build\Microsoft.SourceLink.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(NugetPackageDirectory)\Microsoft.SourceLink.Common.$(MicrosoftSourceLinkCommonVersion)\build\Microsoft.SourceLink.Common.targets'))" />
|
||||
<Error Condition="!Exists('$(NugetPackageDirectory)\Microsoft.Build.Tasks.Git.$(MicrosoftBuildTasksGitVersion)\build\Microsoft.Build.Tasks.Git.props')" Text="$([System.String]::Format('$(ErrorText)', '$(NugetPackageDirectory)\Microsoft.Build.Tasks.Git.$(MicrosoftBuildTasksGitVersion)\build\Microsoft.Build.Tasks.Git.props'))" />
|
||||
<Error Condition="!Exists('$(NugetPackageDirectory)\Microsoft.Build.Tasks.Git.$(MicrosoftBuildTasksGitVersion)\build\Microsoft.Build.Tasks.Git.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(NugetPackageDirectory)\Microsoft.Build.Tasks.Git.$(MicrosoftBuildTasksGitVersion)\build\Microsoft.Build.Tasks.Git.targets'))" />
|
||||
<Error Condition="!Exists('$(NugetPackageDirectory)\Microsoft.SourceLink.GitHub.$(MicrosoftSourceLinkGitHubVersion)\build\Microsoft.SourceLink.GitHub.props')" Text="$([System.String]::Format('$(ErrorText)', '$(NugetPackageDirectory)\Microsoft.SourceLink.GitHub.$(MicrosoftSourceLinkGitHubVersion)\build\Microsoft.SourceLink.GitHub.props'))" />
|
||||
<Error Condition="!Exists('$(NugetPackageDirectory)\Microsoft.SourceLink.GitHub.$(MicrosoftSourceLinkGitHubVersion)\build\Microsoft.SourceLink.GitHub.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(NugetPackageDirectory)\Microsoft.SourceLink.GitHub.$(MicrosoftSourceLinkGitHubVersion)\build\Microsoft.SourceLink.GitHub.targets'))" />
|
||||
<Error Condition="!Exists('$(NugetPackageDirectory)\Microsoft.Windows.ImplementationLibrary.$(MicrosoftWindowsImplementationLibraryVersion)\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(NugetPackageDirectory)\Microsoft.Windows.ImplementationLibrary.$(MicrosoftWindowsImplementationLibraryVersion)\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -1,27 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <unknwn.h>
|
||||
#include <appmodel.h>
|
||||
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
|
||||
#include <wil/cppwinrt.h>
|
||||
#include <wil/token_helpers.h>
|
||||
#include <wil/win32_helpers.h>
|
||||
#include <wil/result.h>
|
||||
#include <wil/com.h>
|
||||
#include <wil/resource.h>
|
||||
|
||||
#include <winrt/Windows.Foundation.h>
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
|
||||
#include <winrt/Windows.ApplicationModel.h>
|
||||
#include <winrt/Windows.Management.Deployment.h>
|
||||
|
||||
#include <AppModel.Package.h>
|
||||
#include <Microsoft.Utf8.h>
|
||||
|
|
@ -1,325 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
||||
#include <PushNotificationsLongRunningPlatform-Startup.h>
|
||||
void Help();
|
||||
HRESULT JustDoIt(PCWSTR path, bool forceDeployment) noexcept;
|
||||
void AddPackageIfNecessary(PCWSTR path, const std::wstring& filename, const std::wstring& packageFullName, bool forceDeployment);
|
||||
bool NeedToRegisterPackage(const std::wstring& packageFullName);
|
||||
bool NeedToRegisterPackage(PCWSTR packageFullName);
|
||||
HRESULT AddPackage(PCWSTR path, const std::wstring& filename, bool forceDeployment);
|
||||
|
||||
class PackageId
|
||||
{
|
||||
public:
|
||||
static PackageId FromPackageFullName(const std::wstring& packageFullName)
|
||||
{
|
||||
return FromPackageFullName(packageFullName.c_str());
|
||||
}
|
||||
|
||||
static PackageId FromPackageFullName(PCWSTR packageFullName)
|
||||
{
|
||||
PackageId packageId;
|
||||
uint32_t bufferLength{ sizeof(packageId.m_buffer) };
|
||||
THROW_IF_WIN32_ERROR(PackageIdFromFullName(packageFullName, PACKAGE_INFORMATION_BASIC, &bufferLength, packageId.m_buffer));
|
||||
packageId.m_packageId = reinterpret_cast<PACKAGE_ID*>(packageId.m_buffer);
|
||||
packageId.m_packageFullName = packageFullName;
|
||||
return packageId;
|
||||
}
|
||||
|
||||
PackageId() = default;
|
||||
|
||||
PackageId(PackageId&& other) :
|
||||
m_packageFullName(std::move(other.m_packageFullName))
|
||||
{
|
||||
memcpy(m_buffer, other.m_buffer, sizeof(m_buffer));
|
||||
m_packageId = reinterpret_cast<PACKAGE_ID*>(m_buffer);
|
||||
|
||||
other.m_packageId = nullptr;
|
||||
memset(other.m_buffer, 0, sizeof(other.m_buffer));
|
||||
}
|
||||
|
||||
~PackageId() = default;
|
||||
|
||||
PackageId& operator=(PackageId&& other)
|
||||
{
|
||||
if (this != &other)
|
||||
{
|
||||
m_packageFullName = std::move(other.m_packageFullName);
|
||||
memcpy(m_buffer, other.m_buffer, sizeof(m_buffer));
|
||||
m_packageId = reinterpret_cast<PACKAGE_ID*>(m_buffer);
|
||||
|
||||
other.m_packageId = nullptr;
|
||||
memset(other.m_buffer, 0, sizeof(other.m_buffer));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
const std::wstring& PackageFullName() const
|
||||
{
|
||||
return m_packageFullName;
|
||||
}
|
||||
|
||||
PCWSTR Name() const
|
||||
{
|
||||
return m_packageId->name;
|
||||
}
|
||||
|
||||
PACKAGE_VERSION Version() const
|
||||
{
|
||||
return m_packageId->version;
|
||||
}
|
||||
|
||||
winrt::Windows::System::ProcessorArchitecture Architecture() const
|
||||
{
|
||||
return static_cast<winrt::Windows::System::ProcessorArchitecture>(m_packageId->processorArchitecture);
|
||||
}
|
||||
|
||||
PCWSTR ResourceId() const
|
||||
{
|
||||
return m_packageId->resourceId;
|
||||
}
|
||||
|
||||
PCWSTR PublisherId() const
|
||||
{
|
||||
return m_packageId->publisherId;
|
||||
}
|
||||
|
||||
PCWSTR PackageFamilyName() const
|
||||
{
|
||||
if (m_packageFamilyName.empty())
|
||||
{
|
||||
wchar_t packageFamilyName[PACKAGE_FAMILY_NAME_MAX_LENGTH + 1]{};
|
||||
uint32_t packageFamilyNameLength{ ARRAYSIZE(packageFamilyName) };
|
||||
THROW_IF_WIN32_ERROR_MSG(::PackageFamilyNameFromFullName(m_packageFullName.c_str(), &packageFamilyNameLength, packageFamilyName), "PackageFullName:%ls", m_packageFullName.c_str());
|
||||
m_packageFamilyName = packageFamilyName;
|
||||
}
|
||||
return m_packageFamilyName.c_str();
|
||||
}
|
||||
|
||||
explicit operator bool() const
|
||||
{
|
||||
return m_packageId != nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
std::wstring m_packageFullName;
|
||||
mutable std::wstring m_packageFamilyName;
|
||||
const PACKAGE_ID * m_packageId{};
|
||||
BYTE m_buffer[sizeof(PACKAGE_ID) + (PACKAGE_NAME_MAX_LENGTH + 1 +
|
||||
PACKAGE_RESOURCEID_MAX_LENGTH + 1 +
|
||||
PACKAGE_PUBLISHERID_MAX_LENGTH + 1) * sizeof(WCHAR)]{};
|
||||
};
|
||||
|
||||
void Help()
|
||||
{
|
||||
wprintf(L"WindowsAppRuntime_MSIXInstallFromPath [options] <path>\n"
|
||||
L"options:\n"
|
||||
L" -f, --force = Force shutdown WinAppSDK's processes if necessary to update WinAppSDK's MSIX packages\n"
|
||||
L" -?, --help = Display help\n"
|
||||
L" -- = End of options\n"
|
||||
L"where:\n"
|
||||
L" path = Path where Windows App SDK's MSIX packages can be found\n"
|
||||
L" => Microsoft.WindowsAppRuntime.*.msix\n"
|
||||
L" => Microsoft.WindowsAppRuntime.DDLM.*.msix\n"
|
||||
L" => Microsoft.WindowsAppRuntime.Main.*.msix\n"
|
||||
L" => Microsoft.WindowsAppRuntime.Singleton.*.msix\n");
|
||||
}
|
||||
HRESULT JustDoIt(PCWSTR path, bool forceDeployment) noexcept try
|
||||
{
|
||||
wprintf(L"path: %s\n", path);
|
||||
|
||||
// Install packages
|
||||
auto fpath{ std::filesystem::path(path) };
|
||||
auto inventory{ fpath / L"MSIX.inventory" };
|
||||
std::string lineUtf8;
|
||||
std::ifstream f{ inventory };
|
||||
|
||||
THROW_HR_IF_MSG(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), std::filesystem::exists(inventory), "%ls", inventory.c_str());
|
||||
|
||||
while (getline(f, lineUtf8))
|
||||
{
|
||||
// Skip blank lines
|
||||
if (lineUtf8.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip comments
|
||||
if (lineUtf8[0] == '#')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Parse the line
|
||||
auto line{ Microsoft::Utf8::ToUtf16<std::wstring>(lineUtf8.c_str()) };
|
||||
auto offset{ line.find(L'=') };
|
||||
THROW_HR_IF_MSG(E_UNEXPECTED, offset == std::wstring::npos, "line:%s", lineUtf8.c_str());
|
||||
auto filename{ line.substr(0, offset) };
|
||||
THROW_HR_IF_MSG(E_UNEXPECTED, filename.empty(), "line:%s", lineUtf8.c_str());
|
||||
auto packageFullName{ std::wstring(line.c_str() + offset + 1) };
|
||||
THROW_HR_IF_MSG(E_UNEXPECTED, packageFullName.empty(), "line:%s", lineUtf8.c_str());
|
||||
|
||||
AddPackageIfNecessary(path, filename, packageFullName, forceDeployment);
|
||||
}
|
||||
|
||||
// Restart Push Notifications Long Running Platform when ForceDeployment option is applied.
|
||||
if (forceDeployment)
|
||||
{
|
||||
// wil callback will be set up to log telemetry events for LRP.
|
||||
THROW_IF_FAILED_MSG(StartupNotificationsLongRunningPlatform(), "Restarting Push Notifications LRP failed after 3 attempts.");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
CATCH_RETURN();
|
||||
|
||||
void AddPackageIfNecessary(PCWSTR path, const std::wstring& filename, const std::wstring& packageFullName, bool forceDeployment)
|
||||
{
|
||||
wprintf(L"Path: %s\n", path);
|
||||
wprintf(L"Filename: %s\n", filename.c_str());
|
||||
wprintf(L"PackageFullName: %s\n", packageFullName.c_str());
|
||||
wprintf(L"forceDeployment:%s\n", forceDeployment ? L"true" : L"false");
|
||||
|
||||
if (!NeedToRegisterPackage(packageFullName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto hr{ AddPackage(path, filename, forceDeployment) };
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"AddPackage(): 0x%X Path:%s Filename:%s PackageFullName:%s forceDeployment:%s", hr, path, filename.c_str(), packageFullName.c_str(), forceDeployment ? L"true" : L"false");
|
||||
THROW_HR_MSG(hr, "Path:%ls Filename:%ls PackageFullName:%ls forceDeployment:%ls", path, filename.c_str(), packageFullName.c_str(), forceDeployment ? L"true" : L"false");
|
||||
}
|
||||
}
|
||||
|
||||
bool NeedToRegisterPackage(const std::wstring& packageFullName)
|
||||
{
|
||||
return NeedToRegisterPackage(packageFullName.c_str());
|
||||
}
|
||||
|
||||
bool NeedToRegisterPackage(PCWSTR packageFullName)
|
||||
{
|
||||
auto packageId{ PackageId::FromPackageFullName(packageFullName) };
|
||||
|
||||
// Is there an equal-or-better package already registered?
|
||||
wprintf(L"Family: %s\n", packageId.PackageFamilyName());
|
||||
auto packageFullNames{ AppModel::Package::FindByFamily(packageId.PackageFamilyName()) };
|
||||
if (packageFullNames.empty())
|
||||
{
|
||||
wprintf(L"1 None found\n");
|
||||
return true;
|
||||
}
|
||||
for (auto registeredPackageFullName : packageFullNames)
|
||||
{
|
||||
auto registeredPackage{ PackageId::FromPackageFullName(registeredPackageFullName) };
|
||||
wprintf(L"C %ls %ls %d %d %I64X %I64X\n",
|
||||
packageId.PackageFullName().c_str(), registeredPackage.PackageFullName().c_str(),
|
||||
packageId.Architecture(), registeredPackage.Architecture(),
|
||||
packageId.Version().Version, registeredPackage.Version().Version);
|
||||
if (registeredPackage.Architecture() != packageId.Architecture())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (registeredPackage.Version().Version >= packageId.Version().Version)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// This registered package is equal-or-better than the specified package.
|
||||
// No need to register the specified package
|
||||
wprintf(L"2 %ls not-needed because %ls\n", packageFullName, registeredPackage.PackageFullName().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Nope. The specified package is better than anything current registered
|
||||
wprintf(L"3 Nothing better\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
HRESULT AddPackage(PCWSTR path, const std::wstring& filename, bool forceDeployment)
|
||||
{
|
||||
const auto packagePath{ std::filesystem::path(path) / filename };
|
||||
const auto packagePathUri{ winrt::Windows::Foundation::Uri(packagePath.c_str()) };
|
||||
winrt::Windows::Management::Deployment::PackageManager packageManager;
|
||||
|
||||
const auto options{ forceDeployment ?
|
||||
winrt::Windows::Management::Deployment::DeploymentOptions::ForceTargetApplicationShutdown :
|
||||
winrt::Windows::Management::Deployment::DeploymentOptions::None };
|
||||
auto deploymentResult{ packageManager.AddPackageAsync(packagePathUri, nullptr, options).get() };
|
||||
return deploymentResult.ExtendedErrorCode();
|
||||
}
|
||||
|
||||
int wmain(int argc, wchar_t *argv[])
|
||||
{
|
||||
try
|
||||
{
|
||||
winrt::init_apartment();
|
||||
|
||||
bool forceDeployment{};
|
||||
|
||||
// Parse the command line
|
||||
int index{ 1 };
|
||||
for (; index < argc; ++index)
|
||||
{
|
||||
auto arg{ argv[index] };
|
||||
if (arg[0] != L'-')
|
||||
{
|
||||
// Options are -o (short form) or --option (long form)
|
||||
break;
|
||||
}
|
||||
else if ((CompareStringOrdinal(arg, -1, L"--", -1, TRUE) == CSTR_EQUAL))
|
||||
{
|
||||
// -- = end of options
|
||||
++index;
|
||||
break;
|
||||
}
|
||||
else if ((CompareStringOrdinal(arg, -1, L"-f", -1, TRUE) == CSTR_EQUAL) ||
|
||||
(CompareStringOrdinal(arg, -1, L"--force", -1, TRUE) == CSTR_EQUAL))
|
||||
{
|
||||
forceDeployment = true;
|
||||
}
|
||||
else if ((CompareStringOrdinal(arg, -1, L"-?", -1, FALSE) == CSTR_EQUAL) ||
|
||||
(CompareStringOrdinal(arg, -1, L"--help", -1, FALSE) == CSTR_EQUAL))
|
||||
{
|
||||
Help();
|
||||
return ERROR_BAD_ARGUMENTS;
|
||||
}
|
||||
else
|
||||
{
|
||||
Help();
|
||||
return ERROR_BAD_ARGUMENTS;
|
||||
}
|
||||
}
|
||||
|
||||
if (index >= argc)
|
||||
{
|
||||
Help();
|
||||
return ERROR_BAD_ARGUMENTS;
|
||||
}
|
||||
auto path{ argv[index++] };
|
||||
|
||||
if (index < argc)
|
||||
{
|
||||
Help();
|
||||
return ERROR_BAD_ARGUMENTS;
|
||||
}
|
||||
|
||||
return JustDoIt(path, forceDeployment);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
const auto e{ winrt::hresult_error(winrt::to_hresult(), winrt::take_ownership_from_abi) };
|
||||
const auto hr{ e.code() };
|
||||
const auto message{ e.message() };
|
||||
(void) LOG_HR_MSG(hr, "%ls", message.c_str());
|
||||
wprintf(L"0x%X %s", hr.value, message.c_str());
|
||||
return hr;
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Build.Tasks.Git" version="1.1.1" targetFramework="native" developmentDependency="true" />
|
||||
<package id="Microsoft.SourceLink.Common" version="1.1.1" targetFramework="native" developmentDependency="true" />
|
||||
<package id="Microsoft.SourceLink.GitHub" version="1.1.1" targetFramework="native" developmentDependency="true" />
|
||||
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.220914.1" targetFramework="native" />
|
||||
</packages>
|
|
@ -1,6 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
|
|
@ -1,16 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
// pch.h: This is a precompiled header file.
|
||||
// Files listed below are compiled only once, improving build performance for future builds.
|
||||
// This also affects IntelliSense performance, including code completion and many code browsing features.
|
||||
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
|
||||
// Do not add files here that you will be updating frequently as this negates the performance advantage.
|
||||
|
||||
#ifndef PCH_H
|
||||
#define PCH_H
|
||||
|
||||
// add headers that you want to pre-compile here
|
||||
#include "framework.h"
|
||||
|
||||
#endif //PCH_H
|
|
@ -190,7 +190,7 @@ namespace Test::DynamicDependency
|
|||
// Major.Minor = 0.0 == No such framework package
|
||||
const UINT32 doesNotExist{};
|
||||
const PACKAGE_VERSION minVersionMatchAny{};
|
||||
VERIFY_ARE_EQUAL(HRESULT_FROM_WIN32(ERROR_NO_MATCH), MddBootstrapInitialize(doesNotExist, nullptr, minVersionMatchAny));
|
||||
VERIFY_ARE_EQUAL(STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED, MddBootstrapInitialize(doesNotExist, nullptr, minVersionMatchAny));
|
||||
}
|
||||
|
||||
TEST_METHOD(Initialize_DDLMMinVersionNoMatch)
|
||||
|
@ -203,7 +203,7 @@ namespace Test::DynamicDependency
|
|||
// Version <major>.65535.65535.65535 to find framework packages for the major.minor version but none meeting this minVersion criteria
|
||||
const UINT32 c_Version_MajorMinor{ Test::Packages::DynamicDependencyLifetimeManager::c_Version_MajorMinor };
|
||||
PACKAGE_VERSION minVersionNoMatch{ static_cast<UINT64>(Test::Packages::DynamicDependencyLifetimeManager::c_Version.Major) << 48 | 0x0000FFFFFFFFFFFFuI64 };
|
||||
VERIFY_ARE_EQUAL(HRESULT_FROM_WIN32(ERROR_NO_MATCH), MddBootstrapInitialize(c_Version_MajorMinor, nullptr, minVersionNoMatch));
|
||||
VERIFY_ARE_EQUAL(STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED, MddBootstrapInitialize(c_Version_MajorMinor, nullptr, minVersionNoMatch));
|
||||
}
|
||||
|
||||
TEST_METHOD(Initialize)
|
||||
|
@ -253,7 +253,8 @@ namespace Test::DynamicDependency
|
|||
const UINT32 c_Version_MajorMinor_Incompatible{ c_Version_MajorMinor + 1 };
|
||||
VERIFY_ARE_EQUAL(MDD_E_BOOTSTRAP_INITIALIZE_INCOMPATIBLE, MddBootstrapInitialize(c_Version_MajorMinor_Incompatible, nullptr, c_minVersion));
|
||||
|
||||
VERIFY_ARE_EQUAL(MDD_E_BOOTSTRAP_INITIALIZE_INCOMPATIBLE, MddBootstrapInitialize(c_Version_MajorMinor, L"NotTheVersionTag", c_minVersion));
|
||||
VERIFY_ARE_EQUAL(E_INVALIDARG, MddBootstrapInitialize(c_Version_MajorMinor, L"MakesPackageFamilyNameTooLong", c_minVersion));
|
||||
VERIFY_ARE_EQUAL(MDD_E_BOOTSTRAP_INITIALIZE_INCOMPATIBLE, MddBootstrapInitialize(c_Version_MajorMinor, L"Zathras", c_minVersion));
|
||||
|
||||
const PACKAGE_VERSION c_minVersion_Incompatible{ UINT64_MAX };
|
||||
VERIFY_ARE_EQUAL(MDD_E_BOOTSTRAP_INITIALIZE_INCOMPATIBLE, MddBootstrapInitialize(c_Version_MajorMinor, nullptr, c_minVersion_Incompatible));
|
||||
|
@ -288,7 +289,8 @@ namespace Test::DynamicDependency
|
|||
const PACKAGE_VERSION c_minVersion3{};
|
||||
VERIFY_ARE_EQUAL(c_minVersion3.Version, c_minVersion1.Version);
|
||||
VERIFY_ARE_NOT_EQUAL(c_minVersion3.Version, c_minVersion2.Version);
|
||||
VERIFY_ARE_EQUAL(HRESULT_FROM_WIN32(ERROR_NO_MATCH), MddBootstrapInitialize(c_Version_MajorMinor3, L"NotTheVersionTag", c_minVersion3));
|
||||
VERIFY_ARE_EQUAL(E_INVALIDARG, MddBootstrapInitialize(c_Version_MajorMinor3, L"MakesPackageFamilyNameTooLong", c_minVersion3));
|
||||
VERIFY_ARE_EQUAL(STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED, MddBootstrapInitialize(c_Version_MajorMinor3, L"Zathras", c_minVersion3));
|
||||
|
||||
// Incompatible criteria. Verify Initialize+Shutdown brought us
|
||||
// back to initial state so we can fail to initialize as expected
|
||||
|
@ -297,7 +299,7 @@ namespace Test::DynamicDependency
|
|||
VERIFY_ARE_NOT_EQUAL(c_minVersion4.Version, c_minVersion1.Version);
|
||||
VERIFY_ARE_NOT_EQUAL(c_minVersion4.Version, c_minVersion2.Version);
|
||||
VERIFY_ARE_NOT_EQUAL(c_minVersion4.Version, c_minVersion3.Version);
|
||||
VERIFY_ARE_EQUAL(HRESULT_FROM_WIN32(ERROR_NO_MATCH), MddBootstrapInitialize(c_Version_MajorMinor4, nullptr, c_minVersion4));
|
||||
VERIFY_ARE_EQUAL(STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED, MddBootstrapInitialize(c_Version_MajorMinor4, nullptr, c_minVersion4));
|
||||
|
||||
// Same criteria but MinVersion<package version. Verify Initialize+Shutdown brings us back
|
||||
// to initial state so we can initialize again with different (but successful) criteria
|
||||
|
@ -585,7 +587,7 @@ namespace Test::DynamicDependency
|
|||
// Major.Minor = 0.0 == No such framework package
|
||||
const UINT32 doesNotExist{};
|
||||
const PACKAGE_VERSION minVersionMatchAny{};
|
||||
VERIFY_ARE_EQUAL(HRESULT_FROM_WIN32(ERROR_NO_MATCH), MddBootstrapInitialize(doesNotExist, nullptr, minVersionMatchAny));
|
||||
VERIFY_ARE_EQUAL(STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED, MddBootstrapInitialize(doesNotExist, nullptr, minVersionMatchAny));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -626,7 +628,7 @@ namespace Test::DynamicDependency
|
|||
// Major.Minor = 0.0 == No such framework package
|
||||
const UINT32 doesNotExist{};
|
||||
const PACKAGE_VERSION minVersionMatchAny{};
|
||||
VERIFY_ARE_EQUAL(HRESULT_FROM_WIN32(ERROR_NO_MATCH), MddBootstrapInitialize(doesNotExist, nullptr, minVersionMatchAny));
|
||||
VERIFY_ARE_EQUAL(STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED, MddBootstrapInitialize(doesNotExist, nullptr, minVersionMatchAny));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include "Test_Win32.h"
|
||||
|
||||
#include <MddWin11.h>
|
||||
|
||||
namespace TF = ::Test::FileSystem;
|
||||
namespace TP = ::Test::Packages;
|
||||
|
||||
|
@ -134,7 +136,7 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_ProcessLifetime_Framewor
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
VerifyPackageGraphRevisionId(1);
|
||||
|
||||
// -- Add
|
||||
|
@ -183,7 +185,7 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_ProcessLifetime_Framewor
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
VerifyPackageGraphRevisionId(3);
|
||||
|
||||
// -- Delete
|
||||
|
@ -208,7 +210,8 @@ void Test::DynamicDependency::Test_Win32::GetResolvedPackageFullName_NotFound()
|
|||
{
|
||||
PCWSTR packageDependencyId{ L"This.Does.Not.Exist" };
|
||||
wil::unique_process_heap_string packageFullName;
|
||||
VERIFY_ARE_EQUAL(HRESULT_FROM_WIN32(ERROR_NOT_FOUND), MddGetResolvedPackageFullNameForPackageDependency(packageDependencyId, &packageFullName));
|
||||
VERIFY_SUCCEEDED(MddGetResolvedPackageFullNameForPackageDependency(packageDependencyId, &packageFullName));
|
||||
VERIFY_IS_NULL(packageFullName);
|
||||
}
|
||||
|
||||
void Test::DynamicDependency::Test_Win32::GetIdForPackageDependencyContext_Null()
|
||||
|
@ -235,15 +238,43 @@ void Test::DynamicDependency::Test_Win32::VerifyPackageDependency(
|
|||
const HRESULT expectedHR,
|
||||
PCWSTR expectedPackageFullName)
|
||||
{
|
||||
wil::unique_process_heap_string packageFullName;
|
||||
VERIFY_ARE_EQUAL(expectedHR, MddGetResolvedPackageFullNameForPackageDependency(packageDependencyId, &packageFullName));
|
||||
if (!expectedPackageFullName)
|
||||
// Given an unknown/undefined packageDependencyId our caller specifies expectedHR=HRESULT_FROM_WIN32(ERROR_NOT_FOUND).
|
||||
// Handle the condition appropriately:
|
||||
//
|
||||
// API | HRESULT | packageFullName
|
||||
// -------------------------------------------------------------------|-----------------------------------------|----------------
|
||||
// MddGetResolvedPackageFullNameForPackageDependency | S_OK | NULL
|
||||
// MddGetResolvedPackageFullNameForPackageDependency2 (Supported) | HRESULT_FROM_WIN32(ERROR_NOT_FOUND) | NULL
|
||||
// MddGetResolvedPackageFullNameForPackageDependency2 (not Supported) | HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED) | NULL
|
||||
|
||||
const HRESULT expectedHR1{ (expectedHR == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)) ? S_OK : expectedHR };
|
||||
const HRESULT expectedHR2{
|
||||
MddCore::Win11::IsSupported() && !MddCore::Win11::IsGetResolvedPackageFullNameForPackageDependency2Supported() ?
|
||||
HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED) :
|
||||
expectedHR };
|
||||
|
||||
wil::unique_process_heap_string packageFullName1;
|
||||
VERIFY_ARE_EQUAL(expectedHR1, MddGetResolvedPackageFullNameForPackageDependency(packageDependencyId, &packageFullName1));
|
||||
if (FAILED(expectedHR1) || !expectedPackageFullName)
|
||||
{
|
||||
VERIFY_IS_TRUE(!packageFullName);
|
||||
VERIFY_IS_NULL(packageFullName1);
|
||||
}
|
||||
else
|
||||
{
|
||||
VERIFY_ARE_EQUAL(std::wstring(packageFullName.get()), std::wstring(expectedPackageFullName));
|
||||
VERIFY_IS_NOT_NULL(packageFullName1, WEX::Common::String().Format(L"PackageFullName=null Expected=%s", expectedPackageFullName));
|
||||
VERIFY_ARE_EQUAL(std::wstring(packageFullName1.get()), std::wstring(expectedPackageFullName));
|
||||
}
|
||||
|
||||
wil::unique_process_heap_string packageFullName2;
|
||||
VERIFY_ARE_EQUAL(expectedHR2, MddGetResolvedPackageFullNameForPackageDependency2(packageDependencyId, &packageFullName2));
|
||||
if (FAILED(expectedHR2) || !expectedPackageFullName)
|
||||
{
|
||||
VERIFY_IS_NULL(packageFullName2);
|
||||
}
|
||||
else
|
||||
{
|
||||
VERIFY_IS_NOT_NULL(packageFullName2, WEX::Common::String().Format(L"PackageFullName=null Expected=%s", expectedPackageFullName));
|
||||
VERIFY_ARE_EQUAL(std::wstring(packageFullName2.get()), std::wstring(expectedPackageFullName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,6 +288,12 @@ void Test::DynamicDependency::Test_Win32::VerifyPackageDependency(
|
|||
|
||||
void Test::DynamicDependency::Test_Win32::VerifyPathEnvironmentVariable(PCWSTR path)
|
||||
{
|
||||
// N/A when DynamicDependency delegates to the Win11 OS API
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::wstring expectedPath{ path };
|
||||
std::wstring pathEnvironmentVariable{ wil::TryGetEnvironmentVariableW(L"PATH").get() };
|
||||
VERIFY_ARE_EQUAL(expectedPath, pathEnvironmentVariable);
|
||||
|
@ -264,6 +301,12 @@ void Test::DynamicDependency::Test_Win32::VerifyPathEnvironmentVariable(PCWSTR p
|
|||
|
||||
void Test::DynamicDependency::Test_Win32::VerifyPathEnvironmentVariable(PCWSTR path1, PCWSTR path)
|
||||
{
|
||||
// N/A when DynamicDependency delegates to the Win11 OS API
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::wstring pathEnvironmentVariable{ wil::TryGetEnvironmentVariableW(L"PATH").get() };
|
||||
std::wstring expectedPath{ std::wstring(path1) + L";" + path };
|
||||
VERIFY_ARE_EQUAL(expectedPath, pathEnvironmentVariable);
|
||||
|
@ -271,6 +314,12 @@ void Test::DynamicDependency::Test_Win32::VerifyPathEnvironmentVariable(PCWSTR p
|
|||
|
||||
void Test::DynamicDependency::Test_Win32::VerifyPathEnvironmentVariable(PCWSTR path1, PCWSTR path2, PCWSTR path)
|
||||
{
|
||||
// N/A when DynamicDependency delegates to the Win11 OS API
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::wstring pathEnvironmentVariable{ wil::TryGetEnvironmentVariableW(L"PATH").get() };
|
||||
std::wstring expectedPath{ std::wstring(path1) + L";" + path2 + L";" + path };
|
||||
VERIFY_ARE_EQUAL(expectedPath, pathEnvironmentVariable);
|
||||
|
@ -278,6 +327,12 @@ void Test::DynamicDependency::Test_Win32::VerifyPathEnvironmentVariable(PCWSTR p
|
|||
|
||||
void Test::DynamicDependency::Test_Win32::VerifyPathEnvironmentVariable(PCWSTR path1, PCWSTR path2, PCWSTR path3, PCWSTR path)
|
||||
{
|
||||
// N/A when DynamicDependency delegates to the Win11 OS API
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::wstring pathEnvironmentVariable{ wil::TryGetEnvironmentVariableW(L"PATH").get() };
|
||||
std::wstring expectedPath{ std::wstring(path1) + L";" + path2 + L";" + path3 + L";" + path };
|
||||
VERIFY_ARE_EQUAL(expectedPath, pathEnvironmentVariable);
|
||||
|
|
|
@ -33,7 +33,7 @@ void Test::DynamicDependency::Test_Win32::Add_Rank_A0_B10()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
|
||||
// -- Add
|
||||
|
||||
|
@ -77,7 +77,7 @@ void Test::DynamicDependency::Test_Win32::Add_Rank_A0_B10()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ void Test::DynamicDependency::Test_Win32::Add_Rank_Bneg10_A0()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
|
||||
// -- Add
|
||||
|
||||
|
@ -77,7 +77,7 @@ void Test::DynamicDependency::Test_Win32::Add_Rank_Bneg10_A0()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ void Test::DynamicDependency::Test_Win32::Add_Rank_B0prepend_A0()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
|
||||
// -- Add
|
||||
|
||||
|
@ -77,7 +77,7 @@ void Test::DynamicDependency::Test_Win32::Add_Rank_B0prepend_A0()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ void Test::DynamicDependency::Test_Win32::Create_Add_Architectures_Current()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
|
||||
// -- Add
|
||||
|
||||
|
@ -80,7 +80,7 @@ void Test::DynamicDependency::Test_Win32::Create_Add_Architectures_Current()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ void Test::DynamicDependency::Test_Win32::Create_Add_Architectures_Explicit()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
|
||||
// -- Add
|
||||
|
||||
|
@ -86,7 +86,7 @@ void Test::DynamicDependency::Test_Win32::Create_Add_Architectures_Explicit()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ void Test::DynamicDependency::Test_Win32::Create_DoNotVerifyDependencyResolution
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_FilePathLifetime_Framewo
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
|
||||
// -- Add
|
||||
|
||||
|
@ -103,7 +103,7 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_FilePathLifetime_Framewo
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_ProcessLifetime_Framewor
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
|
||||
// -- Add
|
||||
|
||||
|
@ -76,7 +76,7 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_ProcessLifetime_Framewor
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_RegistryLifetime_Framewo
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
|
||||
// -- Add
|
||||
|
||||
|
@ -101,7 +101,7 @@ void Test::DynamicDependency::Test_Win32::FullLifecycle_RegistryLifetime_Framewo
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd.get(), S_OK, nullptr);
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ void Test::DynamicDependency::Test_Win32::WinRTReentrancy()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkWidgets, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkWidgets.get(), S_OK, expectedPackageFullName_FrameworkWidgets);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkWidgets.get(), S_OK, nullptr);
|
||||
|
||||
// -- Add
|
||||
|
||||
|
@ -110,7 +110,7 @@ void Test::DynamicDependency::Test_Win32::WinRTReentrancy()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkWidgets, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkWidgets.get(), S_OK, expectedPackageFullName_FrameworkWidgets);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkWidgets.get(), S_OK, nullptr);
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\WindowsAppRuntime_DLL;$(OutDir)\..\WindowsAppRuntime_BootstrapDLL;$(OutDir)\..\Framework.Math.Add;$(OutDir)\..\Framework.Math.Multiply</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\WindowsAppRuntime_DLL;$(OutDir)\..\WindowsAppRuntime_BootstrapDLL;$(OutDir)\..\Framework.Math.Add;$(OutDir)\..\Framework.Math.Multiply;$(RepoRoot)\dev\common</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions);PRTEST_MODE_UWP=0</PreprocessorDefinitions>
|
||||
<UseFullPaths>true</UseFullPaths>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
|
@ -125,7 +125,7 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\WindowsAppRuntime_DLL;$(OutDir)\..\WindowsAppRuntime_BootstrapDLL;$(OutDir)\..\Framework.Math.Add;$(OutDir)\..\Framework.Math.Multiply</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\WindowsAppRuntime_DLL;$(OutDir)\..\WindowsAppRuntime_BootstrapDLL;$(OutDir)\..\Framework.Math.Add;$(OutDir)\..\Framework.Math.Multiply;$(RepoRoot)\dev\common</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions);PRTEST_MODE_UWP=0</PreprocessorDefinitions>
|
||||
<UseFullPaths>true</UseFullPaths>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
|
@ -140,7 +140,7 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\WindowsAppRuntime_DLL;$(OutDir)\..\WindowsAppRuntime_BootstrapDLL;$(OutDir)\..\Framework.Math.Add;$(OutDir)\..\Framework.Math.Multiply</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\WindowsAppRuntime_DLL;$(OutDir)\..\WindowsAppRuntime_BootstrapDLL;$(OutDir)\..\Framework.Math.Add;$(OutDir)\..\Framework.Math.Multiply;$(RepoRoot)\dev\common</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions);PRTEST_MODE_UWP=0</PreprocessorDefinitions>
|
||||
<UseFullPaths>true</UseFullPaths>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
|
@ -155,7 +155,7 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\WindowsAppRuntime_DLL;$(OutDir)\..\WindowsAppRuntime_BootstrapDLL;$(OutDir)\..\Framework.Math.Add;$(OutDir)\..\Framework.Math.Multiply</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\WindowsAppRuntime_DLL;$(OutDir)\..\WindowsAppRuntime_BootstrapDLL;$(OutDir)\..\Framework.Math.Add;$(OutDir)\..\Framework.Math.Multiply;$(RepoRoot)\dev\common</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions);PRTEST_MODE_UWP=0</PreprocessorDefinitions>
|
||||
<UseFullPaths>true</UseFullPaths>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
|
@ -170,7 +170,7 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\WindowsAppRuntime_DLL;$(OutDir)\..\WindowsAppRuntime_BootstrapDLL;$(OutDir)\..\Framework.Math.Add;$(OutDir)\..\Framework.Math.Multiply</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\WindowsAppRuntime_DLL;$(OutDir)\..\WindowsAppRuntime_BootstrapDLL;$(OutDir)\..\Framework.Math.Add;$(OutDir)\..\Framework.Math.Multiply;$(RepoRoot)\dev\common</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions);PRTEST_MODE_UWP=0</PreprocessorDefinitions>
|
||||
<UseFullPaths>true</UseFullPaths>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
|
@ -185,7 +185,7 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\WindowsAppRuntime_DLL;$(OutDir)\..\WindowsAppRuntime_BootstrapDLL;$(OutDir)\..\Framework.Math.Add;$(OutDir)\..\Framework.Math.Multiply</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\WindowsAppRuntime_DLL;$(OutDir)\..\WindowsAppRuntime_BootstrapDLL;$(OutDir)\..\Framework.Math.Add;$(OutDir)\..\Framework.Math.Multiply;$(RepoRoot)\dev\common</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions);PRTEST_MODE_UWP=0</PreprocessorDefinitions>
|
||||
<UseFullPaths>true</UseFullPaths>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include "Test_WinRT.h"
|
||||
|
||||
#include <MddWin11.h>
|
||||
|
||||
#include <wil/winrt.h>
|
||||
|
||||
namespace TF = ::Test::FileSystem;
|
||||
|
@ -96,14 +98,30 @@ void Test::DynamicDependency::Test_WinRT::GetFromId_Empty()
|
|||
{
|
||||
winrt::hstring packageDependencyId;
|
||||
auto packageDependency{ winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependency::GetFromId(packageDependencyId) };
|
||||
VERIFY_IS_TRUE(!packageDependency);
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
//TODO Remove once GetFromId() fails for no-such-id
|
||||
VERIFY_IS_TRUE(!!packageDependency);
|
||||
}
|
||||
else
|
||||
{
|
||||
VERIFY_IS_TRUE(!packageDependency);
|
||||
}
|
||||
}
|
||||
|
||||
void Test::DynamicDependency::Test_WinRT::GetFromId_NotFound()
|
||||
{
|
||||
winrt::hstring packageDependencyId{ L"This.Does.Not.Exist" };
|
||||
auto packageDependency{ winrt::Microsoft::Windows::ApplicationModel::DynamicDependency::PackageDependency::GetFromId(packageDependencyId) };
|
||||
VERIFY_IS_TRUE(!packageDependency);
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
//TODO Remove once GetFromId() fails for no-such-id
|
||||
VERIFY_IS_TRUE(!!packageDependency);
|
||||
}
|
||||
else
|
||||
{
|
||||
VERIFY_IS_TRUE(!packageDependency);
|
||||
}
|
||||
}
|
||||
|
||||
void Test::DynamicDependency::Test_WinRT::FullLifecycle_ProcessLifetime_Framework_WindowsAppRuntime()
|
||||
|
@ -133,7 +151,7 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_ProcessLifetime_Framewor
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependency_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependency_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
VerifyGenerationId(1);
|
||||
|
||||
// -- Add
|
||||
|
@ -180,7 +198,7 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_ProcessLifetime_Framewor
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
VerifyGenerationId(3);
|
||||
|
||||
// -- Delete
|
||||
|
@ -241,15 +259,43 @@ void Test::DynamicDependency::Test_WinRT::VerifyPackageDependency(
|
|||
const HRESULT expectedHR,
|
||||
PCWSTR expectedPackageFullName)
|
||||
{
|
||||
wil::unique_process_heap_string packageFullName;
|
||||
VERIFY_ARE_EQUAL(expectedHR, MddGetResolvedPackageFullNameForPackageDependency(packageDependencyId, &packageFullName));
|
||||
if (!expectedPackageFullName)
|
||||
// Given an unknown/undefined packageDependencyId our caller specifies expectedHR=HRESULT_FROM_WIN32(ERROR_NOT_FOUND).
|
||||
// Handle the condition appropriately:
|
||||
//
|
||||
// API | HRESULT | packageFullName
|
||||
// -------------------------------------------------------------------|-----------------------------------------|----------------
|
||||
// MddGetResolvedPackageFullNameForPackageDependency | S_OK | NULL
|
||||
// MddGetResolvedPackageFullNameForPackageDependency2 (Supported) | HRESULT_FROM_WIN32(ERROR_NOT_FOUND) | NULL
|
||||
// MddGetResolvedPackageFullNameForPackageDependency2 (not Supported) | HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED) | NULL
|
||||
|
||||
const HRESULT expectedHR1{ (expectedHR == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)) ? S_OK : expectedHR };
|
||||
const HRESULT expectedHR2{
|
||||
MddCore::Win11::IsSupported() && !MddCore::Win11::IsGetResolvedPackageFullNameForPackageDependency2Supported() ?
|
||||
HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED) :
|
||||
expectedHR };
|
||||
|
||||
wil::unique_process_heap_string packageFullName1;
|
||||
VERIFY_ARE_EQUAL(expectedHR1, MddGetResolvedPackageFullNameForPackageDependency(packageDependencyId, &packageFullName1));
|
||||
if (FAILED(expectedHR1) || !expectedPackageFullName || (expectedPackageFullName[0] == L'\0'))
|
||||
{
|
||||
VERIFY_IS_TRUE(!packageFullName);
|
||||
VERIFY_IS_NULL(packageFullName1);
|
||||
}
|
||||
else
|
||||
{
|
||||
VERIFY_ARE_EQUAL(std::wstring(packageFullName.get()), std::wstring(expectedPackageFullName));
|
||||
VERIFY_IS_NOT_NULL(packageFullName1, WEX::Common::String().Format(L"PackageFullName=null Expected=%s", expectedPackageFullName));
|
||||
VERIFY_ARE_EQUAL(std::wstring(packageFullName1.get()), std::wstring(expectedPackageFullName));
|
||||
}
|
||||
|
||||
wil::unique_process_heap_string packageFullName2;
|
||||
VERIFY_ARE_EQUAL(expectedHR2, MddGetResolvedPackageFullNameForPackageDependency2(packageDependencyId, &packageFullName2));
|
||||
if (FAILED(expectedHR2) || !expectedPackageFullName || (expectedPackageFullName[0] == L'\0'))
|
||||
{
|
||||
VERIFY_IS_NULL(packageFullName2);
|
||||
}
|
||||
else
|
||||
{
|
||||
VERIFY_IS_NOT_NULL(packageFullName2, WEX::Common::String().Format(L"PackageFullName=null Expected=%s", expectedPackageFullName));
|
||||
VERIFY_ARE_EQUAL(std::wstring(packageFullName2.get()), std::wstring(expectedPackageFullName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -293,6 +339,12 @@ void Test::DynamicDependency::Test_WinRT::VerifyPackageDependency(
|
|||
|
||||
void Test::DynamicDependency::Test_WinRT::VerifyPathEnvironmentVariable(PCWSTR path)
|
||||
{
|
||||
// N/A when DynamicDependency delegates to the Win11 OS API
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::wstring expectedPath{ path };
|
||||
std::wstring pathEnvironmentVariable{ wil::TryGetEnvironmentVariableW(L"PATH").get() };
|
||||
VERIFY_ARE_EQUAL(expectedPath, pathEnvironmentVariable);
|
||||
|
@ -300,6 +352,12 @@ void Test::DynamicDependency::Test_WinRT::VerifyPathEnvironmentVariable(PCWSTR p
|
|||
|
||||
void Test::DynamicDependency::Test_WinRT::VerifyPathEnvironmentVariable(PCWSTR path1, PCWSTR path)
|
||||
{
|
||||
// N/A when DynamicDependency delegates to the Win11 OS API
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::wstring pathEnvironmentVariable{ wil::TryGetEnvironmentVariableW(L"PATH").get() };
|
||||
std::wstring expectedPath{ std::wstring(path1) + L";" + path };
|
||||
VERIFY_ARE_EQUAL(expectedPath, pathEnvironmentVariable);
|
||||
|
@ -307,6 +365,12 @@ void Test::DynamicDependency::Test_WinRT::VerifyPathEnvironmentVariable(PCWSTR p
|
|||
|
||||
void Test::DynamicDependency::Test_WinRT::VerifyPathEnvironmentVariable(PCWSTR path1, PCWSTR path2, PCWSTR path)
|
||||
{
|
||||
// N/A when DynamicDependency delegates to the Win11 OS API
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::wstring pathEnvironmentVariable{ wil::TryGetEnvironmentVariableW(L"PATH").get() };
|
||||
std::wstring expectedPath{ std::wstring(path1) + L";" + path2 + L";" + path };
|
||||
VERIFY_ARE_EQUAL(expectedPath, pathEnvironmentVariable);
|
||||
|
@ -314,6 +378,12 @@ void Test::DynamicDependency::Test_WinRT::VerifyPathEnvironmentVariable(PCWSTR p
|
|||
|
||||
void Test::DynamicDependency::Test_WinRT::VerifyPathEnvironmentVariable(PCWSTR path1, PCWSTR path2, PCWSTR path3, PCWSTR path)
|
||||
{
|
||||
// N/A when DynamicDependency delegates to the Win11 OS API
|
||||
if (MddCore::Win11::IsSupported())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::wstring pathEnvironmentVariable{ wil::TryGetEnvironmentVariableW(L"PATH").get() };
|
||||
std::wstring expectedPath{ std::wstring(path1) + L";" + path2 + L";" + path3 + L";" + path };
|
||||
VERIFY_ARE_EQUAL(expectedPath, pathEnvironmentVariable);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -36,7 +36,7 @@ void Test::DynamicDependency::Test_WinRT::Add_Rank_A0_B10()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
|
||||
// -- Add
|
||||
|
||||
|
@ -79,7 +79,7 @@ void Test::DynamicDependency::Test_WinRT::Add_Rank_A0_B10()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -36,7 +36,7 @@ void Test::DynamicDependency::Test_WinRT::Add_Rank_Bneg10_A0()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
|
||||
// -- Add
|
||||
|
||||
|
@ -79,7 +79,7 @@ void Test::DynamicDependency::Test_WinRT::Add_Rank_Bneg10_A0()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -36,7 +36,7 @@ void Test::DynamicDependency::Test_WinRT::Add_Rank_B0prepend_A0()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
|
||||
// -- Add
|
||||
|
||||
|
@ -79,7 +79,7 @@ void Test::DynamicDependency::Test_WinRT::Add_Rank_B0prepend_A0()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ void Test::DynamicDependency::Test_WinRT::Create_Add_Architectures_Current()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
|
||||
// -- Add
|
||||
|
||||
|
@ -81,7 +81,7 @@ void Test::DynamicDependency::Test_WinRT::Create_Add_Architectures_Current()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -46,7 +46,7 @@ void Test::DynamicDependency::Test_WinRT::Create_Add_Architectures_Explicit()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
|
||||
// -- Add
|
||||
|
||||
|
@ -87,7 +87,7 @@ void Test::DynamicDependency::Test_WinRT::Create_Add_Architectures_Explicit()
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ void Test::DynamicDependency::Test_WinRT::Create_DoNotVerifyDependencyResolution
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -43,7 +43,7 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_FilePathLifetime_Framewo
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
|
||||
// -- Add
|
||||
|
||||
|
@ -108,7 +108,7 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_FilePathLifetime_Framewo
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Copyright (c) Microsoft Corporation and Contributors.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -36,7 +36,7 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_ProcessLifetime_Framewor
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
|
||||
// -- Add
|
||||
|
||||
|
@ -77,7 +77,7 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_ProcessLifetime_Framewor
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation and Contributors. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation and Contributors. All rights reserved.
|
||||
// Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -43,7 +43,7 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_RegistryLifetime_Framewo
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
|
||||
// -- Add
|
||||
|
||||
|
@ -104,7 +104,7 @@ void Test::DynamicDependency::Test_WinRT::FullLifecycle_RegistryLifetime_Framewo
|
|||
VerifyPackageInPackageGraph(expectedPackageFullName_WindowsAppRuntimeFramework, S_OK);
|
||||
VerifyPackageNotInPackageGraph(expectedPackageFullName_FrameworkMathAdd, S_OK);
|
||||
VerifyPathEnvironmentVariable(packagePath_WindowsAppRuntimeFramework, pathEnvironmentVariable.c_str());
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, expectedPackageFullName_FrameworkMathAdd);
|
||||
VerifyPackageDependency(packageDependencyId_FrameworkMathAdd, S_OK, winrt::hstring());
|
||||
|
||||
// -- Delete
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
|
||||
#include <WexTestClass.h>
|
||||
|
||||
#include <appmodel.identity.h>
|
||||
|
||||
#include "TestFilesystem.h"
|
||||
#include "TestPackages.h"
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче