Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delegate to OS RegFreeWinRT when available (>=24H1) #4728

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
72d8853
Delegate to OS RegFreeWinRT when available (>=19H1)
DrusTheAxe Sep 17, 2024
b8e57f0
Merge branch 'main' into user/drustheaxe/no-urfw
DrusTheAxe Oct 3, 2024
1877de9
Changed DevCheck to emit expected TAEF version found (not just -Verbo…
DrusTheAxe Oct 7, 2024
f41ce39
Removed redundant checks done later in pipelines
DrusTheAxe Oct 7, 2024
f59671c
Added diagnostics for troubleshooting. Fixed compiler warnings
DrusTheAxe Oct 7, 2024
a7650e5
More debuggery
DrusTheAxe Oct 7, 2024
bfb4623
Added IsWindows11_24H2OrGreater(). Changed URFW to only delegate to O…
DrusTheAxe Oct 8, 2024
921330a
More diagnostics
DrusTheAxe Oct 8, 2024
1f7d875
Bumped TAEF to latest version 10.95.240918004
DrusTheAxe Oct 9, 2024
8ae5157
Moar debugging
DrusTheAxe Oct 9, 2024
b075a90
Fixes
DrusTheAxe Oct 9, 2024
2fdb8e2
Minor fix
DrusTheAxe Oct 10, 2024
01c1624
Removed previous interim block disabling Dynamic Dependencies delegat…
DrusTheAxe Oct 10, 2024
faacaec
Merge branch 'main' into user/drustheaxe/no-urfw
DrusTheAxe Oct 10, 2024
71d3e70
Fixed DevCheck not getting VS' path thus not checking VS stuff
DrusTheAxe Oct 10, 2024
91f7404
Split IsReady tests into RestrictedUser vs ElevatedUser
DrusTheAxe Oct 11, 2024
74239f5
Merge branch 'user/drustheaxe/no-urfw' of https://github.com/microsof…
DrusTheAxe Oct 11, 2024
1cd3b89
Fix mis-tagging of TAEF properties (though according to TAEF folks TE…
DrusTheAxe Oct 11, 2024
be7c32a
Merge branch 'user/drustheaxe/no-urfw' of https://github.com/microsof…
DrusTheAxe Oct 11, 2024
1f5ece7
Merge branch 'main' into user/drustheaxe/no-urfw
DrusTheAxe Oct 22, 2024
4571f2a
Merge branch 'user/drustheaxe/no-urfw' of https://github.com/microsof…
DrusTheAxe Oct 22, 2024
e7f005a
DevCheck -SyncDependencies update
DrusTheAxe Oct 22, 2024
8a76d28
Removed FrameworkUdk references in packages.config. Added Build Depen…
DrusTheAxe Oct 22, 2024
0c61350
PackageManager test tweaks
DrusTheAxe Oct 25, 2024
e63d322
Expanded enablement for further test investigation
DrusTheAxe Oct 25, 2024
b91e284
Fixed test to account for OS vs WinAppSDK error detection
DrusTheAxe Oct 31, 2024
c18108b
Merge branch 'main' into user/drustheaxe/no-urfw
DrusTheAxe Oct 31, 2024
cae1e08
Fixed RegisterNewerIfAvailable
DrusTheAxe Nov 5, 2024
0a95f7a
Removed 22H2 testing
DrusTheAxe Nov 5, 2024
c09ccc3
Fixed h/cpp mismatch
DrusTheAxe Nov 5, 2024
47d6221
Merge branch 'main' into user/drustheaxe/no-urfw
DrusTheAxe Nov 9, 2024
912119e
Removed non-existent GUID/reference (bad merge?)
DrusTheAxe Nov 12, 2024
7445541
Fixed test bug not handling all behavior coming out of OS API
DrusTheAxe Nov 21, 2024
4653258
Fixed tests
DrusTheAxe Nov 21, 2024
96323ec
Updated WinRT tests akin to Win32
DrusTheAxe Nov 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion build/AzurePipelinesTemplates/WindowsAppSDK-RunTests-Steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ steps:
inputs:
targetType: filePath
filePath: tools\DevCheck\DevCheck.ps1
arguments: -NoInteractive -Offline -Verbose -CheckTestPfx -Clean -CheckDependencies -ShowSystemInfo
arguments: -NoInteractive -Offline -Verbose -CheckTestPfx -Clean -CheckDependencies -CheckVisualStudio -ShowSystemInfo
workingDirectory: '$(Build.SourcesDirectory)'

- task: DownloadPipelineArtifact@2
Expand Down Expand Up @@ -146,6 +146,17 @@ steps:
Write-Host "WhoAmI"
Write-Host (whoami /user /groups /priv)

- task: PowerShell@2
displayName: 'Dump services'
inputs:
targetType: 'inline'
script: |
Get-Service
Get-Service | Write-Host
Get-Service | Out-Host
sc.exe queryex te.service | Write-Host
sc.exe qc te.service | Write-Host

- task: PowerShell@2
displayName: 'Run TAEF Tests'
inputs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ steps:
inputs:
targetType: filePath
filePath: tools\DevCheck\DevCheck.ps1
arguments: -NoInteractive -Offline -Verbose -CheckTestPfx -Clean -CheckDependencies -ShowSystemInfo
arguments: -NoInteractive -Offline -Verbose -CheckTestPfx -Clean -CheckDependencies -CheckVisualStudio -ShowSystemInfo
workingDirectory: '$(Build.SourcesDirectory)'

- task: PowerShell@2
Expand Down
17 changes: 11 additions & 6 deletions dev/Common/IsWindowsVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,35 @@ inline bool IsExportPresent(

inline bool IsWindows10_19H1OrGreater()
{
// GetPackageInfo2() added to kernelbase.dll in NTDDI_WIN10_19H1 (aka 19H1)
// GetPackageInfo2() added to kernelbase.dll in 19H1 (aka NTDDI_WIN10_19H1)
return IsExportPresent(L"kernelbase.dll", "GetPackageInfo2");
}

inline bool IsWindows10_20H1OrGreater()
{
// GetPackageInfo3() added to kernelbase.dll in NTDDI_WIN10_VB (aka 20H1)
// GetPackageInfo3() added to kernelbase.dll in 20H1 (aka NTDDI_WIN10_VB)
return IsExportPresent(L"kernelbase.dll", "GetPackageInfo3");
}
inline bool IsWindows11_21H2OrGreater()
{
// GetMachineTypeAttributes() added to kernelbase.dll in NTDDI_WIN10_CO (aka Windows 11 21H2)
// GetMachineTypeAttributes() added to kernelbase.dll in Windows 11 21H2 (aka NTDDI_WIN10_CO)
return IsExportPresent(L"kernelbase.dll", "GetMachineTypeAttributes");
}
inline bool IsWindows11_22H2OrGreater()
{
// GetPackageGraphRevisionId() added to kernelbase.dll in NTDDI_WIN10_NI (aka Windows 11 22H2)
// GetPackageGraphRevisionId() added to kernelbase.dll in Windows 11 22H2 (aka NTDDI_WIN10_NI)
return IsExportPresent(L"kernelbase.dll", "GetPackageGraphRevisionId");
}
inline bool IsWindows11_23H1OrGreater()
inline bool IsWindows11_24H1OrGreater()
{
// TryCreatePackageDependency2() added to in NTDDI_WIN10_GE (aka Windows 11 23H1)
// TryCreatePackageDependency2() added to in Windows 11 24H1 (aka NTDDI_WIN11_GE)
DrusTheAxe marked this conversation as resolved.
Show resolved Hide resolved
return IsExportPresent(L"kernelbase.dll", "TryCreatePackageDependency2");
}
inline bool IsWindows11_24H2OrGreater()
{
// MsixIsPackageFeatureSupported() added to in Windows 11 24H2 (aka NTDDI_WIN11_GE)
DrusTheAxe marked this conversation as resolved.
Show resolved Hide resolved
return IsExportPresent(L"appxdeploymentclient.dll", "MsixIsPackageFeatureSupported");
}
}

#endif // __ISWINDOWSVERSION_H
6 changes: 1 addition & 5 deletions dev/DynamicDependency/API/MddWin11.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace MddCore::Win11
__declspec(selectany) HMODULE g_dllApisetAppmodelRuntime_1_7{};
//TODO:47775758 GetResolved2 __declspec(selectany) decltype(&::GetResolvedPackageFullNameForPackageDependency2) g_win11GetResolvedPackageFullNameForPackageDependency2{};

__declspec(selectany) bool g_isSupported{ WindowsVersion::IsWindows11_22H2OrGreater() };
__declspec(selectany) bool g_isSupported{ WindowsVersion::IsWindows11_24H1OrGreater() };

constexpr PackageDependencyLifetimeKind ToLifetimeKind(MddPackageDependencyLifetimeKind lifetimeKind)
{
Expand Down Expand Up @@ -95,11 +95,7 @@ namespace MddCore::Win11

inline bool IsSupported()
{
#if defined(TODO_WindowsAppSDKAggregator_Test_Failures)
return MddCore::Win11::details::g_isSupported;
#else
return false;
#endif
}

inline bool IsGetResolvedPackageFullNameForPackageDependency2Supported()
Expand Down
2 changes: 1 addition & 1 deletion dev/MRTCore/mrt/Core/unittests/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Taef" version="10.94.240624002" targetFramework="native" />
<package id="Microsoft.Taef" version="10.95.240918004" targetFramework="native" />
</packages>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Taef" version="10.94.240624002" targetFramework="net45" />
<package id="Microsoft.Taef" version="10.95.240918004" targetFramework="net45" />
</packages>
2 changes: 1 addition & 1 deletion dev/MRTCore/mrt/mrm/UnitTests/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.240803.1" targetFramework="native" />
<package id="Microsoft.Taef" version="10.94.240624002" targetFramework="native" />
<package id="Microsoft.Taef" version="10.95.240918004" targetFramework="native" />
</packages>
11 changes: 8 additions & 3 deletions dev/PackageManager/API/M.W.M.D.PackageDeploymentManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,14 @@ namespace winrt::Microsoft::Windows::Management::Deployment::implementation
{
case winrt::Microsoft::Windows::Management::Deployment::PackageDeploymentFeature::PackageUriScheme_ms_uup:
{
//TODO Feature lookup
// Relies on PackageManagement_IsFeatureSupported(L"PackageUriScheme.ms-uup") exist in Microsoft.FrameworkUdk and enabled
return ::WindowsVersion::IsExportPresent(L"appxdeploymentclient.dll", "MsixRemovePackageByUriAsync");
BOOL isSupported{};
const HRESULT hr{ PackageManagement_IsFeatureSupported(L"PackageUriScheme.ms-uup", &isSupported) };
if (hr == E_NOTIMPL)
{
return false;
}
THROW_IF_FAILED_MSG(hr, "PackageUriScheme_ms_uup");
return !!isSupported;
}
case winrt::Microsoft::Windows::Management::Deployment::PackageDeploymentFeature::IsPackageReadyOrNewerAvailable:
{
Expand Down
46 changes: 38 additions & 8 deletions dev/UndockedRegFreeWinRT/urfw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <activation.h>
#include <VersionHelpers.h>

#include <IsWindowsVersion.h>

#include "urfw.h"

#include "catalog.h"
Expand Down Expand Up @@ -58,18 +60,18 @@ static decltype(RoGetActivationFactory)* TrueRoGetActivationFactory = RoGetActiv
static decltype(RoGetMetaDataFile)* TrueRoGetMetaDataFile = RoGetMetaDataFile;
static decltype(RoResolveNamespace)* TrueRoResolveNamespace = RoResolveNamespace;

static bool g_apisAreDetoured{};

enum class ActivationLocation
{
CurrentApartment,
CrossApartmentMTA
};

VOID CALLBACK EnsureMTAInitializedCallBack
(
VOID CALLBACK EnsureMTAInitializedCallBack(
PTP_CALLBACK_INSTANCE /*instance*/,
PVOID /*parameter*/,
PTP_WORK /*work*/
)
PTP_WORK /*work*/)
{
Microsoft::WRL::ComPtr<IComThreadingInfo> spThreadingInfo;
CoGetObjectContext(IID_PPV_ARGS(&spThreadingInfo));
Expand Down Expand Up @@ -405,10 +407,34 @@ HRESULT ExtRoLoadCatalog()

HRESULT UrfwInitialize() noexcept
{
#if defined(TODO_URFW_DELEGATE_TO_OS_19H1PLUS)
// Windows' Reg-Free WinRT first appeared in Windows 10 Version 1903, May 2019 Update (aka 19H1)
// https://blogs.windows.com/windowsdeveloper/2019/04/30/enhancing-non-packaged-desktop-apps-using-windows-runtime-components/
// Delegate to the OS' implementation when available
if (WindowsVersion::IsWindows10_19H1OrGreater())
{
return S_OK;
}
#elif defined(TODO_SEEME_PRODUCT_TARGET)
// Delegate to the OS' implementation on >= Windows 11 24H1
if (WindowsVersion::IsWindows11_22H2OrGreater())
{
return S_OK;
}
#else
// Delegate to the OS' implementation on >= Windows 11 24H1
if (WindowsVersion::IsWindows11_24H1OrGreater())
{
return S_OK;
}
#endif

// OS Reg-Free WinRT isn't available so let's do it ourselves...
DetourAttach(&(PVOID&)TrueRoActivateInstance, RoActivateInstanceDetour);
DetourAttach(&(PVOID&)TrueRoGetActivationFactory, RoGetActivationFactoryDetour);
DetourAttach(&(PVOID&)TrueRoGetMetaDataFile, RoGetMetaDataFileDetour);
DetourAttach(&(PVOID&)TrueRoResolveNamespace, RoResolveNamespaceDetour);
g_apisAreDetoured = true;
try
{
RETURN_IF_FAILED(ExtRoLoadCatalog());
Expand All @@ -422,10 +448,14 @@ HRESULT UrfwInitialize() noexcept

void UrfwShutdown() noexcept
{
DetourDetach(&(PVOID&)TrueRoActivateInstance, RoActivateInstanceDetour);
DetourDetach(&(PVOID&)TrueRoGetActivationFactory, RoGetActivationFactoryDetour);
DetourDetach(&(PVOID&)TrueRoGetMetaDataFile, RoGetMetaDataFileDetour);
DetourDetach(&(PVOID&)TrueRoResolveNamespace, RoResolveNamespaceDetour);
if (g_apisAreDetoured)
{
DetourDetach(&(PVOID&)TrueRoActivateInstance, RoActivateInstanceDetour);
DetourDetach(&(PVOID&)TrueRoGetActivationFactory, RoGetActivationFactoryDetour);
DetourDetach(&(PVOID&)TrueRoGetMetaDataFile, RoGetMetaDataFileDetour);
DetourDetach(&(PVOID&)TrueRoResolveNamespace, RoResolveNamespaceDetour);
g_apisAreDetoured = false;
}
}

extern "C" void WINAPI winrtact_Initialize()
Expand Down
2 changes: 1 addition & 1 deletion eng/Version.Dependencies.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<Dependency Name="Microsoft.Build.Tasks.Git" Version="1.1.1"/>
<Dependency Name="Microsoft.SourceLink.Common" Version="1.1.1"/>
<Dependency Name="Microsoft.SourceLink.GitHub" Version="1.1.1"/>
<Dependency Name="Microsoft.Taef" Version="10.94.240624002"/>
<Dependency Name="Microsoft.Taef" Version="10.95.240918004"/>
<Dependency Name="Microsoft.Telemetry.Inbox.Native" Version="10.0.19041.1-191206-1406.vb-release.x86fre" />
<Dependency Name="Microsoft.Windows.CppWinRT" Version="2.0.230706.1"/>
<Dependency Name="Microsoft.Windows.ImplementationLibrary" Version="1.0.240803.1"/>
Expand Down
2 changes: 1 addition & 1 deletion installer/test/InstallerFunctionalTests/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Taef" version="10.94.240624002" targetFramework="native" />
<package id="Microsoft.Taef" version="10.95.240918004" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.230706.1" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.240803.1" targetFramework="native" />
</packages>
2 changes: 1 addition & 1 deletion test/AccessControlTests/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Taef" version="10.94.240624002" targetFramework="native" />
<package id="Microsoft.Taef" version="10.95.240918004" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.230706.1" targetFramework="native" />
</packages>
2 changes: 1 addition & 1 deletion test/AppLifecycle/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Taef" version="10.94.240624002" targetFramework="native" />
<package id="Microsoft.Taef" version="10.95.240918004" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.230706.1" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.240803.1" targetFramework="native" />
</packages>
2 changes: 1 addition & 1 deletion test/AppNotificationBuilderTests/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Taef" version="10.94.240624002" targetFramework="native" />
<package id="Microsoft.Taef" version="10.95.240918004" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.230706.1" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.240803.1" targetFramework="native" />
</packages>
2 changes: 1 addition & 1 deletion test/AppNotificationTests/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Taef" version="10.94.240624002" targetFramework="native" />
<package id="Microsoft.Taef" version="10.95.240918004" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.230706.1" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.240803.1" targetFramework="native" />
</packages>
12 changes: 11 additions & 1 deletion test/ApplicationData/ApplicationDataTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace TD = ::Test::Diagnostics;
namespace TB = ::Test::Bootstrap;
namespace TP = ::Test::Packages;
namespace TD = ::Test::Diagnostics;

static const winrt::hstring null_hstring;

Expand All @@ -27,9 +28,10 @@ namespace Test::ApplicationData::Tests

TEST_CLASS_SETUP(ClassSetup)
{
::TD::DumpExecutionContext();
if (!::WindowsVersion::IsWindows11_21H2OrGreater())
{
WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped, L"PackageDeploymentManager requires Win11 >= 21H2 (SV1). Skipping tests");
WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped, L"ApplicationData requires Win11 >= 21H2 (SV1). Skipping tests");
return true;
}

Expand Down Expand Up @@ -237,15 +239,23 @@ namespace Test::ApplicationData::Tests
TEST_METHOD(MachineFolderAndPath_Main_NotSupported)
{
winrt::hstring packageFamilyName{ Main_PackageFamilyName };
WEX::Logging::Log::Comment(WEX::Common::String().Format(L"A1: %ls", packageFamilyName.c_str()));
auto applicationData{ winrt::Microsoft::Windows::Storage::ApplicationData::GetForPackageFamily(packageFamilyName) };
WEX::Logging::Log::Comment(WEX::Common::String().Format(L"A2: %ls", packageFamilyName.c_str()));
VERIFY_IS_NOT_NULL(applicationData);

WEX::Logging::Log::Comment(WEX::Common::String().Format(L"A3: %ls", packageFamilyName.c_str()));
VERIFY_IS_FALSE(applicationData.IsMachinePathSupported());

WEX::Logging::Log::Comment(WEX::Common::String().Format(L"A4: %ls", packageFamilyName.c_str()));
const auto machineFolder{ applicationData.MachineFolder() };
WEX::Logging::Log::Comment(WEX::Common::String().Format(L"A5: %ls", packageFamilyName.c_str()));
VERIFY_IS_NULL(machineFolder);
WEX::Logging::Log::Comment(WEX::Common::String().Format(L"A6: %ls", packageFamilyName.c_str()));
const auto machinePath{ applicationData.MachinePath() };
WEX::Logging::Log::Comment(WEX::Common::String().Format(L"A7: %ls", packageFamilyName.c_str()));
VERIFY_ARE_EQUAL(machinePath, null_hstring);
WEX::Logging::Log::Comment(WEX::Common::String().Format(L"A8: %ls", packageFamilyName.c_str()));
}

TEST_METHOD(MachineFolderAndPath_Framework_NotSupported)
Expand Down
2 changes: 1 addition & 1 deletion test/ApplicationData/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<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.Taef" version="10.94.240624002" targetFramework="native" />
<package id="Microsoft.Taef" version="10.95.240918004" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.230706.1" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.240803.1" targetFramework="native" />
</packages>
2 changes: 1 addition & 1 deletion test/Common/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Taef" version="10.94.240624002" targetFramework="native" />
<package id="Microsoft.Taef" version="10.95.240918004" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.230706.1" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.240803.1" targetFramework="native" />
</packages>
2 changes: 1 addition & 1 deletion test/Deployment/API/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Taef" version="10.94.240624002" targetFramework="native" />
<package id="Microsoft.Taef" version="10.95.240918004" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.230706.1" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.240803.1" targetFramework="native" />
</packages>
3 changes: 2 additions & 1 deletion test/DynamicDependency/Test_Win32/TestMddBootstrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,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(STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED, MddBootstrapInitialize(c_Version_MajorMinor3, L"NoSuchShortVersionTagActuallUsedByAnyPackageAndEvenIfTherIsThePackageFamilyNameWouldBeTooLong", c_minVersion3));
const HRESULT hr{ MddBootstrapInitialize(c_Version_MajorMinor3, L"NoSuchShortVersionTagActuallUsedByAnyPackageAndEvenIfTherIsThePackageFamilyNameWouldBeTooLong", c_minVersion3) };
VERIFY_IS_TRUE((hr == STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED) || (hr == E_INVALIDARG), WEX::Common::String().Format(L"HRESULT:0x%08X"));
VERIFY_ARE_EQUAL(STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED, MddBootstrapInitialize(c_Version_MajorMinor3, L"Zathras", c_minVersion3));

// Incompatible criteria. Verify Initialize+Shutdown brought us
Expand Down
22 changes: 16 additions & 6 deletions test/DynamicDependency/Test_Win32/Test_GetCurrentPackageInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,14 @@ namespace Test::DynamicDependency
VerifyGetCurrentPackageInfo123(PACKAGE_FILTER_HEAD | PACKAGE_FILTER_DIRECT | PACKAGE_FILTER_IS_IN_RELATED_SET | PACKAGE_FILTER_STATIC | PACKAGE_FILTER_DYNAMIC, HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), 1, 1, HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), 1, 1);

// Verify GetCurrentPackageInfo for GenerationId
VerifyGenerationId(1, S_OK);
VerifyGenerationId(1);

// -- Remove
WEX::Logging::Log::Comment(WEX::Common::String().Format(L"MddRemovePackageDependency(%p)...", packageDependencyContext_FrameworkMathAdd));
MddRemovePackageDependency(packageDependencyContext_FrameworkMathAdd);

// -- Delete
WEX::Logging::Log::Comment(WEX::Common::String().Format(L"MddDeletePackageDependency(%s)...", packageDependencyId_FrameworkMathAdd.get()));
MddDeletePackageDependency(packageDependencyId_FrameworkMathAdd.get());
}

Expand Down Expand Up @@ -231,8 +233,7 @@ namespace Test::DynamicDependency
}

void VerifyGenerationId(
const UINT32 expectedGenerationId,
const HRESULT expectedHR = HRESULT_FROM_WIN32(APPMODEL_ERROR_NO_PACKAGE))
const UINT32 expectedGenerationId)
{
if (!IsGetCurrentPackageInfo3Supported())
{
Expand All @@ -243,12 +244,21 @@ namespace Test::DynamicDependency
UINT32 bufferSize{ static_cast<UINT32>(sizeof(generationId)) };
const auto hr{ m_getCurrentPackageInfo3(0, PackageInfoType_PackageInfoGeneration, &bufferSize, &generationId, nullptr) };
auto message{ wil::str_printf<wil::unique_process_heap_string>(L"Get...GenerationId: hr:0x%X id:%u\n"
L" Expected: hr:0x%X id:%u",
hr, generationId, expectedHR, expectedGenerationId) };
L" Expected: hr:0x%X or 0x0 id:%u",
hr, generationId,
HRESULT_FROM_WIN32(APPMODEL_ERROR_NO_PACKAGE), expectedGenerationId) };
VERIFY_IS_TRUE(true, message.get());
OutputDebugStringW(message.get());
VERIFY_ARE_EQUAL(expectedHR, hr);
VERIFY_ARE_EQUAL(expectedGenerationId, generationId);
if (expectedGenerationId == 0)
{
VERIFY_IS_TRUE((hr == S_OK) || (hr == HRESULT_FROM_WIN32(APPMODEL_ERROR_NO_PACKAGE)),
WEX::Common::String().Format(L"hr: 0x%08X expected: 0x0 or 0x%08X", hr, HRESULT_FROM_WIN32(APPMODEL_ERROR_NO_PACKAGE)));
}
else
{
VERIFY_ARE_EQUAL(S_OK, hr);
}

const auto actualGenerationId{ MddGetGenerationId() };
VERIFY_ARE_EQUAL(expectedGenerationId, actualGenerationId);
Expand Down
Loading