diff --git a/WindowsAppRuntime.sln b/WindowsAppRuntime.sln
index 1ebd8089b6..afe7629998 100644
--- a/WindowsAppRuntime.sln
+++ b/WindowsAppRuntime.sln
@@ -497,6 +497,22 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Windows.Managemen
{B73AD907-6164-4294-88FB-F3C9C10DA1F1} = {B73AD907-6164-4294-88FB-F3C9C10DA1F1}
EndProjectSection
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ApplicationData", "ApplicationData", "{095B9BD4-CBBD-417E-84E9-63F2C3EA2BFC}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ApplicationData", "dev\ApplicationData\ApplicationData.vcxitems", "{7CF52890-56FA-47E2-84FB-68EE274324B6}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ApplicationData", "ApplicationData", "{B6440BA7-351C-4EAB-B38E-88995085643B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ApplicationDataTests", "test\ApplicationData\ApplicationDataTests.vcxproj", "{F4CBBB7A-5575-45B7-B586-2C99D2BE81A3}"
+ ProjectSection(ProjectDependencies) = postProject
+ {B73AD907-6164-4294-88FB-F3C9C10DA1F1} = {B73AD907-6164-4294-88FB-F3C9C10DA1F1}
+ EndProjectSection
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Windows.Storage.Projection", "dev\Projections\CS\Microsoft.Windows.Storage.Projection\Microsoft.Windows.Storage.Projection.csproj", "{A43865A2-151E-4064-B5DA-445DFF9688D9}"
+ ProjectSection(ProjectDependencies) = postProject
+ {B73AD907-6164-4294-88FB-F3C9C10DA1F1} = {B73AD907-6164-4294-88FB-F3C9C10DA1F1}
+ EndProjectSection
+EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PackageManager.Test.M.Black.msix", "PackageManager.Test.M.Black.msix", "{1AC589D7-FA54-470E-8640-AB2477CA844C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PackageManager.Test.M.Blacker.msix", "PackageManager.Test.M.Blacker.msix", "{4567CD12-A0A7-4E65-8075-B17C09261767}"
@@ -1759,6 +1775,38 @@ Global
{57E6CCBE-EDEB-4300-8334-98A591D11B3F}.Release|x64.Build.0 = Release|x64
{57E6CCBE-EDEB-4300-8334-98A591D11B3F}.Release|x86.ActiveCfg = Release|x86
{57E6CCBE-EDEB-4300-8334-98A591D11B3F}.Release|x86.Build.0 = Release|x86
+ {F4CBBB7A-5575-45B7-B586-2C99D2BE81A3}.Debug|Any CPU.ActiveCfg = Debug|x64
+ {F4CBBB7A-5575-45B7-B586-2C99D2BE81A3}.Debug|Any CPU.Build.0 = Debug|x64
+ {F4CBBB7A-5575-45B7-B586-2C99D2BE81A3}.Debug|ARM64.ActiveCfg = Debug|ARM64
+ {F4CBBB7A-5575-45B7-B586-2C99D2BE81A3}.Debug|ARM64.Build.0 = Debug|ARM64
+ {F4CBBB7A-5575-45B7-B586-2C99D2BE81A3}.Debug|x64.ActiveCfg = Debug|x64
+ {F4CBBB7A-5575-45B7-B586-2C99D2BE81A3}.Debug|x64.Build.0 = Debug|x64
+ {F4CBBB7A-5575-45B7-B586-2C99D2BE81A3}.Debug|x86.ActiveCfg = Debug|Win32
+ {F4CBBB7A-5575-45B7-B586-2C99D2BE81A3}.Debug|x86.Build.0 = Debug|Win32
+ {F4CBBB7A-5575-45B7-B586-2C99D2BE81A3}.Release|Any CPU.ActiveCfg = Release|x64
+ {F4CBBB7A-5575-45B7-B586-2C99D2BE81A3}.Release|Any CPU.Build.0 = Release|x64
+ {F4CBBB7A-5575-45B7-B586-2C99D2BE81A3}.Release|ARM64.ActiveCfg = Release|ARM64
+ {F4CBBB7A-5575-45B7-B586-2C99D2BE81A3}.Release|ARM64.Build.0 = Release|ARM64
+ {F4CBBB7A-5575-45B7-B586-2C99D2BE81A3}.Release|x64.ActiveCfg = Release|x64
+ {F4CBBB7A-5575-45B7-B586-2C99D2BE81A3}.Release|x64.Build.0 = Release|x64
+ {F4CBBB7A-5575-45B7-B586-2C99D2BE81A3}.Release|x86.ActiveCfg = Release|Win32
+ {F4CBBB7A-5575-45B7-B586-2C99D2BE81A3}.Release|x86.Build.0 = Release|Win32
+ {A43865A2-151E-4064-B5DA-445DFF9688D9}.Debug|Any CPU.ActiveCfg = Debug|x64
+ {A43865A2-151E-4064-B5DA-445DFF9688D9}.Debug|Any CPU.Build.0 = Debug|x64
+ {A43865A2-151E-4064-B5DA-445DFF9688D9}.Debug|ARM64.ActiveCfg = Debug|arm64
+ {A43865A2-151E-4064-B5DA-445DFF9688D9}.Debug|ARM64.Build.0 = Debug|arm64
+ {A43865A2-151E-4064-B5DA-445DFF9688D9}.Debug|x64.ActiveCfg = Debug|x64
+ {A43865A2-151E-4064-B5DA-445DFF9688D9}.Debug|x64.Build.0 = Debug|x64
+ {A43865A2-151E-4064-B5DA-445DFF9688D9}.Debug|x86.ActiveCfg = Debug|x86
+ {A43865A2-151E-4064-B5DA-445DFF9688D9}.Debug|x86.Build.0 = Debug|x86
+ {A43865A2-151E-4064-B5DA-445DFF9688D9}.Release|Any CPU.ActiveCfg = Release|x64
+ {A43865A2-151E-4064-B5DA-445DFF9688D9}.Release|Any CPU.Build.0 = Release|x64
+ {A43865A2-151E-4064-B5DA-445DFF9688D9}.Release|ARM64.ActiveCfg = Release|arm64
+ {A43865A2-151E-4064-B5DA-445DFF9688D9}.Release|ARM64.Build.0 = Release|arm64
+ {A43865A2-151E-4064-B5DA-445DFF9688D9}.Release|x64.ActiveCfg = Release|x64
+ {A43865A2-151E-4064-B5DA-445DFF9688D9}.Release|x64.Build.0 = Release|x64
+ {A43865A2-151E-4064-B5DA-445DFF9688D9}.Release|x86.ActiveCfg = Release|x86
+ {A43865A2-151E-4064-B5DA-445DFF9688D9}.Release|x86.Build.0 = Release|x86
{39277B4C-4FB5-45F6-B0AA-EE8086590CDA}.Debug|Any CPU.ActiveCfg = Debug|x64
{39277B4C-4FB5-45F6-B0AA-EE8086590CDA}.Debug|Any CPU.Build.0 = Debug|x64
{39277B4C-4FB5-45F6-B0AA-EE8086590CDA}.Debug|ARM64.ActiveCfg = Debug|ARM64
@@ -1972,6 +2020,11 @@ Global
{B6B68924-6A0B-457E-AD53-018696EC8889} = {6213B1A3-E854-498F-AAFA-4CFC1E71023E}
{D0A1DFB8-8CEE-4CFC-B57B-B7C574B411C2} = {B6B68924-6A0B-457E-AD53-018696EC8889}
{57E6CCBE-EDEB-4300-8334-98A591D11B3F} = {716C26A0-E6B0-4981-8412-D14A4D410531}
+ {095B9BD4-CBBD-417E-84E9-63F2C3EA2BFC} = {448ED2E5-0B37-4D97-9E6B-8C10A507976A}
+ {7CF52890-56FA-47E2-84FB-68EE274324B6} = {095B9BD4-CBBD-417E-84E9-63F2C3EA2BFC}
+ {B6440BA7-351C-4EAB-B38E-88995085643B} = {8630F7AA-2969-4DC9-8700-9B468C1DC21D}
+ {F4CBBB7A-5575-45B7-B586-2C99D2BE81A3} = {B6440BA7-351C-4EAB-B38E-88995085643B}
+ {A43865A2-151E-4064-B5DA-445DFF9688D9} = {716C26A0-E6B0-4981-8412-D14A4D410531}
{1AC589D7-FA54-470E-8640-AB2477CA844C} = {6213B1A3-E854-498F-AAFA-4CFC1E71023E}
{4567CD12-A0A7-4E65-8075-B17C09261767} = {6213B1A3-E854-498F-AAFA-4CFC1E71023E}
{39277B4C-4FB5-45F6-B0AA-EE8086590CDA} = {1AC589D7-FA54-470E-8640-AB2477CA844C}
@@ -1994,12 +2047,14 @@ Global
test\inc\inc.vcxitems*{56a1d696-feda-4333-bf37-772ebececb10}*SharedItemsImports = 4
test\inc\inc.vcxitems*{5b2d17fe-c371-417f-860c-3d32397c2404}*SharedItemsImports = 4
test\inc\inc.vcxitems*{7c502995-59c3-483b-86ba-815985353633}*SharedItemsImports = 4
+ dev\ApplicationData\ApplicationData.vcxitems*{7cf52890-56fa-47e2-84fb-68ee274324b6}*SharedItemsImports = 9
dev\Common\Common.vcxitems*{8828053c-d6ec-4744-8624-f8c676c2d4df}*SharedItemsImports = 9
dev\Licensing\Licensing.vcxitems*{885a43fa-052d-4b0d-a2dc-13ee15796435}*SharedItemsImports = 9
dev\PackageManager\API\PackageManager.vcxitems*{8a9a0c85-65a8-4bca-a49e-45fc4fdbc7d2}*SharedItemsImports = 9
test\inc\inc.vcxitems*{8e52d7ea-a200-4a6b-ba74-8efb49468caf}*SharedItemsImports = 4
dev\AppNotifications\AppNotifications.vcxitems*{b4824897-88e0-4927-8fb9-e60106f01ed9}*SharedItemsImports = 9
test\inc\inc.vcxitems*{b567fe2e-3a03-48d0-b2b5-760cdec35891}*SharedItemsImports = 9
+ dev\ApplicationData\ApplicationData.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4
dev\Common\Common.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4
dev\DynamicDependency\API\DynamicDependency.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4
dev\Licensing\Licensing.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4
diff --git a/build/CopyFilesToStagingDir.ps1 b/build/CopyFilesToStagingDir.ps1
index 6ceac3cd06..6a786b0269 100644
--- a/build/CopyFilesToStagingDir.ps1
+++ b/build/CopyFilesToStagingDir.ps1
@@ -47,6 +47,7 @@ PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windo
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Management.Deployment.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.PushNotifications.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Security.AccessControl.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
+PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Storage.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.System.Power.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.System.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\MsixDynamicDependency.h $FullPublishDir\Microsoft.WindowsAppRuntime\
@@ -114,6 +115,8 @@ PublishFile $FullBuildOutput\Microsoft.Windows.PushNotifications.Projection\Micr
PublishFile $FullBuildOutput\Microsoft.Windows.PushNotifications.Projection\Microsoft.Windows.PushNotifications.Projection.pdb $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.Security.AccessControl.Projection\Microsoft.Windows.Security.AccessControl.Projection.dll $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.Security.AccessControl.Projection\Microsoft.Windows.Security.AccessControl.Projection.pdb $NugetDir\lib\net6.0-windows10.0.17763.0
+PublishFile $FullBuildOutput\Microsoft.Windows.Storage.Projection\Microsoft.Windows.Storage.Projection.dll $NugetDir\lib\net6.0-windows10.0.17763.0
+PublishFile $FullBuildOutput\Microsoft.Windows.Storage.Projection\Microsoft.Windows.Storage.Projection.pdb $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.System.Power.Projection\Microsoft.Windows.System.Power.Projection.dll $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.System.Power.Projection\Microsoft.Windows.System.Power.Projection.pdb $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.System.Projection\Microsoft.Windows.System.Projection.dll $NugetDir\lib\net6.0-windows10.0.17763.0
@@ -181,6 +184,7 @@ PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windo
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Management.Deployment.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.PushNotifications.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Security.AccessControl.winmd $NugetDir\lib\uap10.0
+PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Storage.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.System.Power.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.System.winmd $NugetDir\lib\uap10.0
#
diff --git a/build/NuSpecs/AppxManifest.xml b/build/NuSpecs/AppxManifest.xml
index d715353b56..c6bcba8167 100644
--- a/build/NuSpecs/AppxManifest.xml
+++ b/build/NuSpecs/AppxManifest.xml
@@ -90,6 +90,10 @@
+
+
+
+
diff --git a/build/NuSpecs/WindowsAppSDK-Nuget-Native.WinRt.props b/build/NuSpecs/WindowsAppSDK-Nuget-Native.WinRt.props
index 9b721a7abc..86ac93e096 100644
--- a/build/NuSpecs/WindowsAppSDK-Nuget-Native.WinRt.props
+++ b/build/NuSpecs/WindowsAppSDK-Nuget-Native.WinRt.props
@@ -25,6 +25,11 @@
$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(_WindowsAppSDKFoundationPlatform)\native\Microsoft.WindowsAppRuntime.dll
true
+
+ $(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.Storage.winmd
+ $(MSBuildThisFileDirectory)..\..\runtimes\win10-$(_WindowsAppSDKFoundationPlatform)\native\Microsoft.WindowsAppRuntime.dll
+ true
+
$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.System.Power.winmd
$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(_WindowsAppSDKFoundationPlatform)\native\Microsoft.WindowsAppRuntime.dll
@@ -36,7 +41,7 @@
true
-
$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.System.winmd
$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(_WindowsAppSDKFoundationPlatform)\native\Microsoft.WindowsAppRuntime.dll
diff --git a/build/NuSpecs/WindowsAppSDK-Nuget-Native.targets b/build/NuSpecs/WindowsAppSDK-Nuget-Native.targets
index cc8c36d467..904986af27 100644
--- a/build/NuSpecs/WindowsAppSDK-Nuget-Native.targets
+++ b/build/NuSpecs/WindowsAppSDK-Nuget-Native.targets
@@ -30,6 +30,13 @@
+
+
+ false
+ Microsoft.WindowsAppRuntime.dll
+
+
+
false
diff --git a/dev/AppNotifications/AppNotificationUtility.cpp b/dev/AppNotifications/AppNotificationUtility.cpp
index 293cfddf0e..b05b9e975c 100644
--- a/dev/AppNotifications/AppNotificationUtility.cpp
+++ b/dev/AppNotifications/AppNotificationUtility.cpp
@@ -102,7 +102,7 @@ std::wstring Microsoft::Windows::AppNotifications::Helpers::RetrieveNotification
wchar_t appUserModelId[APPLICATION_USER_MODEL_ID_MAX_LENGTH] = {};
UINT32 appUserModelIdSize{ APPLICATION_USER_MODEL_ID_MAX_LENGTH };
- THROW_IF_FAILED(GetCurrentApplicationUserModelId(&appUserModelIdSize, appUserModelId));
+ THROW_IF_FAILED(::GetCurrentApplicationUserModelId(&appUserModelIdSize, appUserModelId));
return appUserModelId;
}
else
diff --git a/dev/ApplicationData/ApplicationData.idl b/dev/ApplicationData/ApplicationData.idl
new file mode 100644
index 0000000000..ebbbcedd76
--- /dev/null
+++ b/dev/ApplicationData/ApplicationData.idl
@@ -0,0 +1,167 @@
+// Copyright (c) Microsoft Corporation and Contributors.
+// Licensed under the MIT License.
+
+#include
+
+namespace Microsoft.Windows.Storage
+{
+ [contractversion(2)]
+ apicontract ApplicationDataContract{};
+
+ /// Specifies the type of data store.
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdatalocality
+ [contract(ApplicationDataContract, 1)]
+ enum ApplicationDataLocality
+ {
+ // NOTE: Values 0-99 match Windows.Storage.ApplicationDataLocality.
+ // Values 1000+ are unique to us here.
+ Local = 0,
+ LocalCache = 3,
+ SharedLocal = 4,
+ Temporary = 2,
+ Machine = 1000,
+ };
+
+ /// Specifies options for creating application data containers or returning existing containers.
+ [contract(ApplicationDataContract, 1)]
+ enum ApplicationDataCreateDisposition
+ {
+ /// Always returns the specified container. Creates the container if it does not exist.
+ Always = 0,
+
+ // Returns the specified container only if it already exists. Raises an exception of type System.Exception if the specified container does not exist.
+ Existing,
+ };
+
+ /// Represents a container for settings. The methods and properties of this class support creating, deleting, enumerating, and traversing the container hierarchy.
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdatacontainer
+ [contract(ApplicationDataContract, 1)]
+ runtimeclass ApplicationDataContainer : Windows.Foundation.IClosable
+ {
+ /// Return the child settings containers of the settings container.
+ /// https://learn.microsoft.com/uwp/api/windows.storage.applicationdatacontainer.containers
+ IMap Containers { get; };
+
+ /// Return the name of the current settings container.
+ /// https://learn.microsoft.com/uwp/api/windows.storage.applicationdatacontainer.name
+ String Name { get; };
+
+ /// Return the type of the app data store that is associated with the settings container.
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdatacontainer.locality
+ ApplicationDataLocality Locality { get; };
+
+ /// Return an object that represents the settings in the settings container.
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdatacontainer.values
+ Windows.Foundation.Collections.IPropertySet Values { get; };
+
+ /// Create or open the specified settings container in the settings container.
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdatacontainer.createcontainer
+ ApplicationDataContainer CreateContainer(String name, ApplicationDataCreateDisposition disposition);
+
+ /// Delete the specified settings container, its subcontainers, and all settings in the hierarchy.
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdatacontainer.deletecontainer
+ void DeleteContainer(String name);
+ };
+
+ /// Provides access to the application data store.
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdata
+ [contract(ApplicationDataContract, 1)]
+ runtimeclass ApplicationData : Windows.Foundation.IClosable
+ {
+ /// Get an instance of ApplicationData for the current user.
+ /// @note Requires the current process has package identity.
+ /// @note This is equivalent to Windows.Storage.ApplicationData.Current if running in an AppContainer.
+ /// @note This is equivalent to Windows.Storage.ApplicationDataManager.CreateForPackageFamily(GetCurrentPackageFamilyName()) if not running in an AppContainer.
+ static ApplicationData GetDefault();
+
+ /// Get an instance of ApplicationData for the specified user.
+ /// @note This is equivalent to Windows.Storage.ApplicationData.GetForUserAsync()
+ /// @note GetForUserAsync(null) is equivalent to GetDefault()
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdata.getforuserasync
+ static ApplicationData GetForUser(Windows.System.User user);
+
+ /// Get an instance of ApplicationData for the specified package family for the current user.
+ /// @note This is equivalent to Windows.Storage.ApplicationDataManager.CreateForPackageFamily()
+ /// @see https://learn.microsoft.com/uwp/api/windows.management.core.applicationdatamanager.createforpackagefamily
+ static ApplicationData GetForPackageFamily(String packageFamilyName);
+
+ /// Get an instance of ApplicationData for the specified unpackaged app for the current user.
+ [feature(Feature_ApplicationData)]
+ [contract(ApplicationDataContract, 2)]
+ static ApplicationData GetForUnpackaged(String publisher, String product);
+
+ /// Return true if the package family supports the machine data store.
+ Boolean IsMachinePathSupported { get; };
+
+ /// Return the path for the local cache data store not included in backup and restore operations.
+ /// @note This is equivalent to Windows.Storage.ApplicationData.LocalCacheFolder().Path()
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdata.localcachefolder
+ String LocalCachePath { get; };
+
+ /// Return the path for the local data store. This location is backed up to the cloud.
+ /// @note This is equivalent to Windows.Storage.ApplicationData.LocalFolder().Path()
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdata.localfolder
+ String LocalPath { get; };
+
+ /// Return the path for the machine data store.
+ /// @note This location is per-machine (not per-user like other *Path properties).
+ /// @note Empty string is returned if not supported.
+ /// @see IsMachinePathSupported
+ String MachinePath { get; };
+
+ /// Return the path for the shared data store.
+ /// @note This is equivalent to Windows.Storage.ApplicationData.SharedLocalFolder().Path()
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdata.sharedlocalfolder
+ String SharedLocalPath { get; };
+
+ /// Return the path for the temporary data store.
+ /// @note This is equivalent to Windows.Storage.ApplicationData.TemporaryFolder().Path()
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdata.temporaryfolder
+ String TemporaryPath { get; };
+
+ /// Return a StorageFolder for the local cache data store not included in backup and restore operations.
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdata.localcachefolder
+ Windows.Storage.StorageFolder LocalCacheFolder { get; };
+
+ /// Return a StorageFolder for the local data store. This location is backed up to the cloud.
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdata.localfolder
+ Windows.Storage.StorageFolder LocalFolder { get; };
+
+ /// Return a StorageFolder for the machine data store.
+ /// @note This location is per-machine (not per-user like other *Folder properties).
+ /// @note `null` is returned if not supported.
+ /// @see IsMachinePathSupported
+ Windows.Storage.StorageFolder MachineFolder { get; };
+
+ /// Return a StorageFolder for the shared data store.
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdata.sharedlocalfolder
+ Windows.Storage.StorageFolder SharedLocalFolder { get; };
+
+ /// Return a StorageFolder for the temporary data store.
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdata.temporaryfolder
+ Windows.Storage.StorageFolder TemporaryFolder { get; };
+
+ /// Return the settings container in the local data store.
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdata.localsettings
+ ApplicationDataContainer LocalSettings { get; };
+
+ /// Remove all data from the specified data store.
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdata.clearasync
+ Windows.Foundation.IAsyncAction ClearAsync(ApplicationDataLocality locality);
+
+ /// Clear the files and subfolders from the specified subfolder of the shared storage folder for the publisher.
+ /// @see GetPublisherCachePath()
+ /// @see GetPublisherCacheFolder()
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdata.clearpublishercachefolderasync
+ Windows.Foundation.IAsyncAction ClearPublisherCacheFolderAsync(String folderName);
+
+ /// Return the specified path of the shared data store for the publisher of the app.
+ /// @note This is equivalent to Windows.Storage.ApplicationData.GetPublisherCacheFolder(folderName).Path()
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdata.getpublishercachefolder
+ String GetPublisherCachePath(String folderName);
+
+ /// Return the specified subfolder of the shared data store for the publisher of the app.
+ /// @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdata.getpublishercachefolder
+ Windows.Storage.StorageFolder GetPublisherCacheFolder(String folderName);
+ }
+}
diff --git a/dev/ApplicationData/ApplicationData.vcxitems b/dev/ApplicationData/ApplicationData.vcxitems
new file mode 100644
index 0000000000..32e3851ac8
--- /dev/null
+++ b/dev/ApplicationData/ApplicationData.vcxitems
@@ -0,0 +1,29 @@
+
+
+
+ $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
+ true
+ {7cf52890-56fa-47e2-84fb-68ee274324b6}
+
+
+
+ %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dev/ApplicationData/ApplicationData.vcxitems.filters b/dev/ApplicationData/ApplicationData.vcxitems.filters
new file mode 100644
index 0000000000..215fe7b0dc
--- /dev/null
+++ b/dev/ApplicationData/ApplicationData.vcxitems.filters
@@ -0,0 +1,38 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+
+
+
+
diff --git a/dev/ApplicationData/ApplicationDataTelemetry.h b/dev/ApplicationData/ApplicationDataTelemetry.h
new file mode 100644
index 0000000000..9ce1d58fc5
--- /dev/null
+++ b/dev/ApplicationData/ApplicationDataTelemetry.h
@@ -0,0 +1,29 @@
+// Copyright (c) Microsoft Corporation and Contributors.
+// Licensed under the MIT license.
+
+#pragma once
+
+#include
+
+DECLARE_TRACELOGGING_CLASS(ApplicationDataTelemetryProvider,
+ "Microsoft.WindowsAppSDK.Notifications.ApplicationDataTelemetry",
+ // {cb014b10-5b3b-4117-a837-07b138bb519f}
+ (0xcb014b10, 0x5b3b, 0x4117, 0xa8, 0x37, 0x07, 0xb1, 0x38, 0xbb, 0x51, 0x9f));
+
+class ApplicationDataTelemetry : public wil::TraceLoggingProvider
+{
+ IMPLEMENT_TELEMETRY_CLASS(ApplicationDataTelemetry, ApplicationDataTelemetryProvider);
+
+public:
+
+ BEGIN_COMPLIANT_MEASURES_ACTIVITY_CLASS(ClearMachineFolderAsync, PDT_ProductAndServicePerformance);
+ DEFINE_ACTIVITY_START(winrt::hstring const& path) noexcept try
+ {
+ TraceLoggingClassWriteStart(
+ ClearMachineFolderAsync,
+ _GENERIC_PARTB_FIELDS_ENABLED,
+ TraceLoggingWideString(path.c_str(), "Path"));
+ }
+ CATCH_LOG()
+ END_ACTIVITY_CLASS();
+};
diff --git a/dev/ApplicationData/M.W.S.ApplicationData.cpp b/dev/ApplicationData/M.W.S.ApplicationData.cpp
new file mode 100644
index 0000000000..4b9d1ddaa2
--- /dev/null
+++ b/dev/ApplicationData/M.W.S.ApplicationData.cpp
@@ -0,0 +1,315 @@
+// Copyright (c) Microsoft Corporation and Contributors.
+// Licensed under the MIT License.
+
+#include "pch.h"
+
+#include "M.W.S.ApplicationData.h"
+#include "Microsoft.Windows.Storage.ApplicationData.g.cpp"
+
+#include "M.W.S.ApplicationDataContainer.h"
+
+#include
+
+#include
+
+#include "ApplicationDataTelemetry.h"
+
+static_assert(static_cast(winrt::Microsoft::Windows::Storage::ApplicationDataLocality::Local) == static_cast(winrt::Windows::Storage::ApplicationDataLocality::Local));
+static_assert(static_cast(winrt::Microsoft::Windows::Storage::ApplicationDataLocality::LocalCache) == static_cast(winrt::Windows::Storage::ApplicationDataLocality::LocalCache));
+static_assert(static_cast(winrt::Microsoft::Windows::Storage::ApplicationDataLocality::SharedLocal) == static_cast(winrt::Windows::Storage::ApplicationDataLocality::SharedLocal));
+static_assert(static_cast(winrt::Microsoft::Windows::Storage::ApplicationDataLocality::Temporary) == static_cast(winrt::Windows::Storage::ApplicationDataLocality::Temporary));
+
+namespace winrt::Microsoft::Windows::Storage::implementation
+{
+ ApplicationData::ApplicationData(winrt::Windows::Storage::ApplicationData const& value, hstring const& packageFamilyName) :
+ m_applicationData(value),
+ m_packageFamilyName(packageFamilyName)
+ {
+ }
+ winrt::Microsoft::Windows::Storage::ApplicationData ApplicationData::GetDefault()
+ {
+ const auto packageFamilyName{ ::AppModel::Identity::GetCurrentPackageFamilyName() };
+ winrt::Windows::Storage::ApplicationData applicationData{ nullptr };
+ if (wil::get_token_is_app_container())
+ {
+ applicationData = winrt::Windows::Storage::ApplicationData::Current();
+ }
+ else
+ {
+ applicationData = winrt::Windows::Management::Core::ApplicationDataManager::CreateForPackageFamily(packageFamilyName);
+ }
+ return winrt::make(applicationData, packageFamilyName);
+ }
+ winrt::Microsoft::Windows::Storage::ApplicationData ApplicationData::GetForUser(winrt::Windows::System::User user)
+ {
+ if (!user)
+ {
+ return GetDefault();
+ }
+ const auto packageFamilyName{ ::AppModel::Identity::GetCurrentPackageFamilyName() };
+ auto applicationData{ winrt::Windows::Storage::ApplicationData::GetForUserAsync(user).get() };
+ return winrt::make(applicationData, packageFamilyName);
+ }
+ winrt::Microsoft::Windows::Storage::ApplicationData ApplicationData::GetForPackageFamily(hstring const& packageFamilyName)
+ {
+ if (wil::get_token_is_app_container())
+ {
+ // ApplicationDataManager.CreateForPackageFamily requires the caller is not in an AppContainer
+ // But if you ask for your own package family name it's equivalent to GetDefault()
+ const auto currentPackageFamilyName{ ::AppModel::Identity::GetCurrentPackageFamilyName() };
+ if (CompareStringOrdinal(packageFamilyName.c_str(), -1, currentPackageFamilyName.c_str(), -1, TRUE) == CSTR_EQUAL)
+ {
+ return GetDefault();
+ }
+
+ // Let's fall through and let CreateForPackageFamily()'s error handling report the problem
+ }
+
+ try
+ {
+ auto applicationData{ winrt::Windows::Management::Core::ApplicationDataManager::CreateForPackageFamily(packageFamilyName) };
+ return winrt::make(applicationData, packageFamilyName);
+ }
+ catch (winrt::hresult_error& e)
+ {
+ // CreateForPackageFamily() fails for Framework packages with HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)
+ // But we succeed (the return object is just limited in function)
+ if (e.code() == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
+ {
+ UINT32 count{};
+ UINT32 bufferLength{};
+ UINT32 packageProperties{};
+ const auto rc{ ::FindPackagesByPackageFamily(packageFamilyName.c_str(), PACKAGE_FILTER_DIRECT, &count, nullptr, &bufferLength, nullptr, &packageProperties) };
+ if ((rc == ERROR_INSUFFICIENT_BUFFER) && (count > 0))
+ {
+ // The package family has package(s) registered for the user with at least 1 Framework package
+ // (and a package family can't have Framework and not-Framework packages in the same package family)
+ return winrt::make(nullptr, packageFamilyName);
+ }
+ }
+
+ // Nope! Not a framework. We have an actual error
+ throw;
+ }
+ }
+ winrt::Microsoft::Windows::Storage::ApplicationData ApplicationData::GetForUnpackaged(hstring const& publisher, hstring const& product)
+ {
+ // TODO implement GetForUnpackaged
+ throw hresult_not_implemented();
+ }
+ bool ApplicationData::IsMachinePathSupported()
+ {
+ const auto path{ _MachinePath(m_packageFamilyName) };
+ return !path.empty();
+ }
+ hstring ApplicationData::LocalCachePath()
+ {
+ if (!m_applicationData)
+ {
+ return winrt::hstring{};
+ }
+ return StorageFolderToPath(m_applicationData.LocalCacheFolder());
+ }
+ hstring ApplicationData::LocalPath()
+ {
+ if (!m_applicationData)
+ {
+ return winrt::hstring{};
+ }
+ return StorageFolderToPath(m_applicationData.LocalFolder());
+ }
+ hstring ApplicationData::MachinePath()
+ {
+ const auto path{ _MachinePath(m_packageFamilyName) };
+ return winrt::hstring{ path.c_str() };
+ }
+ hstring ApplicationData::SharedLocalPath()
+ {
+ if (!m_applicationData)
+ {
+ return winrt::hstring{};
+ }
+
+ // SharedLocalFolder is only available if the device has the appropriate group policy. If the group policy
+ // is not enabled, the device administrator must enable it. From Local Group Policy Editor, navigate to
+ // Computer Configuration\Administrative Templates\Windows Components\App Package Deployment,
+ // then change the setting "Allow a Windows app to share application data between users" to "Enabled."
+ //
+ // After the group policy is enabled, SharedLocalFolder can be accessed.
+ //
+ // @see https://learn.microsoft.com/uwp/api/windows.storage.applicationdata.sharedlocalfolder
+
+ return StorageFolderToPath(m_applicationData.SharedLocalFolder());
+ }
+ hstring ApplicationData::TemporaryPath()
+ {
+ if (!m_applicationData)
+ {
+ return winrt::hstring{};
+ }
+ return StorageFolderToPath(m_applicationData.TemporaryFolder());
+ }
+ winrt::Windows::Storage::StorageFolder ApplicationData::LocalCacheFolder()
+ {
+ if (!m_applicationData)
+ {
+ return nullptr;
+ }
+ return m_applicationData.LocalCacheFolder();
+ }
+ winrt::Windows::Storage::StorageFolder ApplicationData::LocalFolder()
+ {
+ if (!m_applicationData)
+ {
+ return nullptr;
+ }
+ return m_applicationData.LocalFolder();
+ }
+ winrt::Windows::Storage::StorageFolder ApplicationData::MachineFolder()
+ {
+ const auto path{ MachinePath() };
+ if (path.empty())
+ {
+ return nullptr;
+ }
+ return winrt::Windows::Storage::StorageFolder::GetFolderFromPathAsync(path).get();
+ }
+ winrt::Windows::Storage::StorageFolder ApplicationData::SharedLocalFolder()
+ {
+ if (!m_applicationData)
+ {
+ return nullptr;
+ }
+ return m_applicationData.SharedLocalFolder();
+ }
+ winrt::Windows::Storage::StorageFolder ApplicationData::TemporaryFolder()
+ {
+ if (!m_applicationData)
+ {
+ return nullptr;
+ }
+ return m_applicationData.TemporaryFolder();
+ }
+ winrt::Microsoft::Windows::Storage::ApplicationDataContainer ApplicationData::LocalSettings()
+ {
+ if (!m_applicationData)
+ {
+ return nullptr;
+ }
+ auto applicationDataContainer{ m_applicationData.LocalSettings() };
+ return winrt::make(applicationDataContainer);
+ }
+ winrt::Windows::Foundation::IAsyncAction ApplicationData::ClearAsync(winrt::Microsoft::Windows::Storage::ApplicationDataLocality locality)
+ {
+ if (!m_applicationData)
+ {
+ co_return;
+ }
+ if (locality == winrt::Microsoft::Windows::Storage::ApplicationDataLocality::Machine)
+ {
+ co_await ClearMachineFolderAsync();
+ }
+ else
+ {
+ co_await m_applicationData.ClearAsync(static_cast(locality));
+ }
+ }
+ winrt::Windows::Foundation::IAsyncAction ApplicationData::ClearPublisherCacheFolderAsync(hstring folderName)
+ {
+ if (!m_applicationData)
+ {
+ co_return;
+ }
+ co_await m_applicationData.ClearPublisherCacheFolderAsync(folderName);
+ }
+ void ApplicationData::Close()
+ {
+ if (m_applicationData)
+ {
+ m_applicationData.Close();
+ }
+ }
+ hstring ApplicationData::GetPublisherCachePath(hstring const& folderName)
+ {
+ auto folder{ GetPublisherCacheFolder(folderName) };
+ winrt::hstring path;
+ if (folder)
+ {
+ path = folder.Path();
+ }
+ return path;
+ }
+ winrt::Windows::Foundation::IAsyncAction ApplicationData::ClearMachineFolderAsync()
+ {
+ const auto path{ MachinePath() };
+
+ auto logTelemetry{ ApplicationDataTelemetry::ClearMachineFolderAsync::Start(path) };
+
+ auto strong{ get_strong() };
+
+ logTelemetry.IgnoreCurrentThread();
+ co_await winrt::resume_background();
+ auto logTelemetryContinuation{ logTelemetry.ContinueOnCurrentThread() };
+
+ const auto options{ wil::RemoveDirectoryOptions::KeepRootDirectory | wil::RemoveDirectoryOptions::RemoveReadOnly };
+ wil::RemoveDirectoryRecursive(path.c_str(), options);
+
+ logTelemetry.Stop();
+ }
+ winrt::Windows::Storage::StorageFolder ApplicationData::GetPublisherCacheFolder(hstring const& folderName)
+ {
+ if (!m_applicationData)
+ {
+ return nullptr;
+ }
+
+ try
+ {
+ return m_applicationData.GetPublisherCacheFolder(folderName);
+ }
+ catch (winrt::hresult_error& e)
+ {
+ // GetPublisherCacheFolder() throws HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) when it doesn't exist
+ if (e.code() == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
+ {
+ return nullptr;
+ }
+
+ // Nope! We have an actual error
+ throw;
+ }
+ }
+ std::filesystem::path ApplicationData::_MachinePath(hstring const& packageFamilyName)
+ {
+ // Path = HKLM\...apprepository...\ApplicationData\...pkgfamilyname...\Machine
+ // This is typically %ProgramData%\Microsoft\Windows\AppRepository\ApplicationData\...pkgfamilyname...\Machine
+ PCWSTR c_path{ L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Appx" };
+ PCWSTR c_valueName{ L"PackageRepositoryRoot" };
+ std::filesystem::path appRepository{ wil::reg::get_value_string(HKEY_LOCAL_MACHINE, c_path, c_valueName) };
+ auto path{ appRepository / L"ApplicationData" };
+ path /= packageFamilyName.c_str();
+ path /= "Machine";
+
+ // Does it exist?
+ if (_PathExists(path))
+ {
+ return path;
+ }
+ return std::filesystem::path{};
+ }
+
+ bool ApplicationData::_PathExists(std::filesystem::path const& path)
+ {
+ const std::filesystem::directory_entry directoryEntry{ path };
+ return directoryEntry.is_directory();
+ }
+ winrt::hstring ApplicationData::StorageFolderToPath(winrt::Windows::Storage::StorageFolder storageFolder)
+ {
+ winrt::hstring path;
+ if (storageFolder)
+ {
+ path = storageFolder.Path();
+ }
+ return path;
+ }
+}
diff --git a/dev/ApplicationData/M.W.S.ApplicationData.h b/dev/ApplicationData/M.W.S.ApplicationData.h
new file mode 100644
index 0000000000..8256e50701
--- /dev/null
+++ b/dev/ApplicationData/M.W.S.ApplicationData.h
@@ -0,0 +1,53 @@
+// Copyright (c) Microsoft Corporation and Contributors.
+// Licensed under the MIT License.
+
+#pragma once
+
+#include "Microsoft.Windows.Storage.ApplicationData.g.h"
+
+namespace winrt::Microsoft::Windows::Storage::implementation
+{
+ struct ApplicationData : ApplicationDataT
+ {
+ ApplicationData() = default;
+ ApplicationData(winrt::Windows::Storage::ApplicationData const& value, hstring const& packageFamilyName);
+
+ static winrt::Microsoft::Windows::Storage::ApplicationData GetDefault();
+ static winrt::Microsoft::Windows::Storage::ApplicationData GetForUser(winrt::Windows::System::User user);
+ static winrt::Microsoft::Windows::Storage::ApplicationData GetForPackageFamily(hstring const& packageFamilyName);
+ static winrt::Microsoft::Windows::Storage::ApplicationData GetForUnpackaged(hstring const& publisher, hstring const& product);
+ bool IsMachinePathSupported();
+ hstring LocalCachePath();
+ hstring LocalPath();
+ hstring MachinePath();
+ hstring SharedLocalPath();
+ hstring TemporaryPath();
+ winrt::Windows::Storage::StorageFolder LocalCacheFolder();
+ winrt::Windows::Storage::StorageFolder LocalFolder();
+ winrt::Windows::Storage::StorageFolder MachineFolder();
+ winrt::Windows::Storage::StorageFolder SharedLocalFolder();
+ winrt::Windows::Storage::StorageFolder TemporaryFolder();
+ winrt::Microsoft::Windows::Storage::ApplicationDataContainer LocalSettings();
+ winrt::Windows::Foundation::IAsyncAction ClearAsync(winrt::Microsoft::Windows::Storage::ApplicationDataLocality locality);
+ winrt::Windows::Foundation::IAsyncAction ClearPublisherCacheFolderAsync(hstring folderName);
+ void Close();
+ hstring GetPublisherCachePath(hstring const& folderName);
+ winrt::Windows::Storage::StorageFolder GetPublisherCacheFolder(hstring const& folderName);
+
+ private:
+ winrt::Windows::Foundation::IAsyncAction ClearMachineFolderAsync();
+ static std::filesystem::path _MachinePath(hstring const& packageFamilyName);
+ static bool _PathExists(std::filesystem::path const& path);
+ static hstring StorageFolderToPath(winrt::Windows::Storage::StorageFolder storageFolder);
+
+ private:
+ winrt::Windows::Storage::ApplicationData m_applicationData;
+ winrt::hstring m_packageFamilyName;
+ };
+}
+namespace winrt::Microsoft::Windows::Storage::factory_implementation
+{
+ struct ApplicationData : ApplicationDataT
+ {
+ };
+}
diff --git a/dev/ApplicationData/M.W.S.ApplicationDataContainer.cpp b/dev/ApplicationData/M.W.S.ApplicationDataContainer.cpp
new file mode 100644
index 0000000000..b5181a619f
--- /dev/null
+++ b/dev/ApplicationData/M.W.S.ApplicationDataContainer.cpp
@@ -0,0 +1,58 @@
+// Copyright (c) Microsoft Corporation and Contributors.
+// Licensed under the MIT License.
+
+#include "pch.h"
+
+#include "M.W.S.ApplicationDataContainer.h"
+#include "Microsoft.Windows.Storage.ApplicationDataContainer.g.cpp"
+
+namespace winrt::Microsoft::Windows::Storage::implementation
+{
+ ApplicationDataContainer::ApplicationDataContainer(winrt::Windows::Storage::ApplicationDataContainer const& value) :
+ m_applicationDataContainer(value)
+ {
+ }
+ winrt::Windows::Foundation::Collections::IMap ApplicationDataContainer::Containers()
+ {
+ winrt::Windows::Foundation::Collections::IMap map{ winrt::single_threaded_map() };
+ auto containers{ m_applicationDataContainer.Containers() };
+ for (auto container : containers)
+ {
+ auto value{ winrt::make(container.Value()) };
+ map.Insert(container.Key(), value);
+ }
+ return map;
+ }
+ hstring ApplicationDataContainer::Name()
+ {
+ return m_applicationDataContainer.Name();
+ }
+ winrt::Microsoft::Windows::Storage::ApplicationDataLocality ApplicationDataContainer::Locality()
+ {
+ static_assert(static_cast(winrt::Microsoft::Windows::Storage::ApplicationDataLocality::Local) == static_cast(winrt::Windows::Storage::ApplicationDataLocality::Local));
+ static_assert(static_cast(winrt::Microsoft::Windows::Storage::ApplicationDataLocality::LocalCache) == static_cast(winrt::Windows::Storage::ApplicationDataLocality::LocalCache));
+ static_assert(static_cast(winrt::Microsoft::Windows::Storage::ApplicationDataLocality::Temporary) == static_cast(winrt::Windows::Storage::ApplicationDataLocality::Temporary));
+
+ return static_cast(m_applicationDataContainer.Locality());
+ }
+ winrt::Windows::Foundation::Collections::IPropertySet ApplicationDataContainer::Values()
+ {
+ return m_applicationDataContainer.Values();
+ }
+ void ApplicationDataContainer::Close()
+ {
+ return m_applicationDataContainer.Close();
+ }
+ winrt::Microsoft::Windows::Storage::ApplicationDataContainer ApplicationDataContainer::CreateContainer(hstring const& name, winrt::Microsoft::Windows::Storage::ApplicationDataCreateDisposition const& disposition)
+ {
+ static_assert(static_cast(winrt::Microsoft::Windows::Storage::ApplicationDataCreateDisposition::Always) == static_cast(winrt::Windows::Storage::ApplicationDataCreateDisposition::Always));
+ static_assert(static_cast(winrt::Microsoft::Windows::Storage::ApplicationDataCreateDisposition::Existing) == static_cast(winrt::Windows::Storage::ApplicationDataCreateDisposition::Existing));
+
+ auto container{ m_applicationDataContainer.CreateContainer(name, static_cast(disposition)) };
+ return winrt::make(container);
+ }
+ void ApplicationDataContainer::DeleteContainer(hstring const& name)
+ {
+ m_applicationDataContainer.DeleteContainer(name);
+ }
+}
diff --git a/dev/ApplicationData/M.W.S.ApplicationDataContainer.h b/dev/ApplicationData/M.W.S.ApplicationDataContainer.h
new file mode 100644
index 0000000000..cb96cb97af
--- /dev/null
+++ b/dev/ApplicationData/M.W.S.ApplicationDataContainer.h
@@ -0,0 +1,26 @@
+// Copyright (c) Microsoft Corporation and Contributors.
+// Licensed under the MIT License.
+
+#pragma once
+
+#include "Microsoft.Windows.Storage.ApplicationDataContainer.g.h"
+
+namespace winrt::Microsoft::Windows::Storage::implementation
+{
+ struct ApplicationDataContainer : ApplicationDataContainerT
+ {
+ ApplicationDataContainer() = default;
+ ApplicationDataContainer(winrt::Windows::Storage::ApplicationDataContainer const& value);
+
+ winrt::Windows::Foundation::Collections::IMap Containers();
+ hstring Name();
+ winrt::Microsoft::Windows::Storage::ApplicationDataLocality Locality();
+ winrt::Windows::Foundation::Collections::IPropertySet Values();
+ void Close();
+ winrt::Microsoft::Windows::Storage::ApplicationDataContainer CreateContainer(hstring const& name, winrt::Microsoft::Windows::Storage::ApplicationDataCreateDisposition const& disposition);
+ void DeleteContainer(hstring const& name);
+
+ private:
+ winrt::Windows::Storage::ApplicationDataContainer m_applicationDataContainer;
+ };
+}
diff --git a/dev/ApplicationData/pch.h b/dev/ApplicationData/pch.h
new file mode 100644
index 0000000000..786111d0d5
--- /dev/null
+++ b/dev/ApplicationData/pch.h
@@ -0,0 +1,31 @@
+// Copyright (c) Microsoft Corporation and Contributors.
+// Licensed under the MIT License.
+
+#pragma once
+
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+#include
diff --git a/dev/Common/AppModel.Identity.h b/dev/Common/AppModel.Identity.h
index c1ef91ce6f..25392bc3fe 100644
--- a/dev/Common/AppModel.Identity.h
+++ b/dev/Common/AppModel.Identity.h
@@ -19,6 +19,33 @@ inline bool IsPackagedProcess()
return rc == ERROR_INSUFFICIENT_BUFFER;
}
+template
+inline Tstring GetCurrentPackageFullName()
+{
+ WCHAR packageFullName[PACKAGE_FULL_NAME_MAX_LENGTH + 1]{};
+ UINT32 n{ ARRAYSIZE(packageFullName) };
+ THROW_IF_WIN32_ERROR(::GetCurrentPackageFullName(&n, packageFullName));
+ return Tstring{ packageFullName };
+}
+
+template
+inline Tstring GetCurrentPackageFamilyName()
+{
+ WCHAR packageFamilyName[PACKAGE_FAMILY_NAME_MAX_LENGTH + 1]{};
+ UINT32 n{ ARRAYSIZE(packageFamilyName) };
+ THROW_IF_WIN32_ERROR(::GetCurrentPackageFamilyName(&n, packageFamilyName));
+ return Tstring{ packageFamilyName };
+}
+
+template
+inline Tstring GetCurrentApplicationUserModelId()
+{
+ WCHAR applicationUserModelId[APPLICATION_USER_MODEL_ID_MAX_LENGTH]{};
+ UINT32 n{ ARRAYSIZE(applicationUserModelId) };
+ THROW_IF_WIN32_ERROR(::GetCurrentApplicationUserModelId(&n, applicationUserModelId));
+ return Tstring{ applicationUserModelId };
+}
+
constexpr winrt::Windows::System::ProcessorArchitecture GetCurrentArchitecture()
{
#if defined(_M_X64)
diff --git a/dev/Common/NotificationTelemetryHelper.h b/dev/Common/NotificationTelemetryHelper.h
index d682c5fd77..2c97970a4e 100644
--- a/dev/Common/NotificationTelemetryHelper.h
+++ b/dev/Common/NotificationTelemetryHelper.h
@@ -31,7 +31,7 @@ class NotificationTelemetryHelper
wchar_t appUserModelId[APPLICATION_USER_MODEL_ID_MAX_LENGTH]{};
UINT32 appUserModelIdSize{ ARRAYSIZE(appUserModelId) };
- THROW_IF_WIN32_ERROR(GetCurrentApplicationUserModelId(&appUserModelIdSize, appUserModelId));
+ THROW_IF_WIN32_ERROR(::GetCurrentApplicationUserModelId(&appUserModelIdSize, appUserModelId));
return appUserModelId;
}
diff --git a/dev/Common/Security.IntegrityLevel.h b/dev/Common/Security.IntegrityLevel.h
index 90ee0759e0..43b4a4db99 100644
--- a/dev/Common/Security.IntegrityLevel.h
+++ b/dev/Common/Security.IntegrityLevel.h
@@ -1,4 +1,4 @@
-// Copyright (c) Microsoft Corporation and Contributors.
+// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.
#ifndef __SECURITY_INTEGRITYLEVEL_H
@@ -8,7 +8,7 @@ namespace Security::IntegrityLevel
{
inline DWORD GetIntegrityLevel(HANDLE token = nullptr)
{
- wistd::unique_ptr tokenMandatoryLabel{
+ auto tokenMandatoryLabel{
wil::get_token_information_failfast(
!token ? GetCurrentThreadEffectiveToken() : token) };
return *GetSidSubAuthority((*tokenMandatoryLabel).Label.Sid,
diff --git a/dev/Common/Security.User.h b/dev/Common/Security.User.h
index 9916be05b7..2ebaa8f1c6 100644
--- a/dev/Common/Security.User.h
+++ b/dev/Common/Security.User.h
@@ -1,4 +1,4 @@
-// Copyright (c) Microsoft Corporation and Contributors.
+// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.
#ifndef __SECURITY_USER_H
@@ -15,7 +15,7 @@ inline bool IsLocalSystem(HANDLE token = nullptr)
DWORD localSystemSidBufferSize{ ARRAYSIZE(localSystemSidBuffer) };
THROW_IF_WIN32_BOOL_FALSE(CreateWellKnownSid(WinLocalSystemSid, nullptr, localSystemSid, &localSystemSidBufferSize));
- wistd::unique_ptr user{ wil::get_token_information(!token ? GetCurrentThreadEffectiveToken() : token) };
+ const auto user{ wil::get_token_information(!token ? GetCurrentThreadEffectiveToken() : token) };
PSID userSid{ user->User.Sid };
return !!EqualSid(userSid, localSystemSid);
diff --git a/dev/Common/TerminalVelocityFeatures-ApplicationData.h b/dev/Common/TerminalVelocityFeatures-ApplicationData.h
new file mode 100644
index 0000000000..20908e82ca
--- /dev/null
+++ b/dev/Common/TerminalVelocityFeatures-ApplicationData.h
@@ -0,0 +1,32 @@
+// Copyright (c) Microsoft Corporation and Contributors.
+// Licensed under the MIT License.
+
+// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT IT
+
+// INPUT FILE: dev\Common\TerminalVelocityFeatures-ApplicationData.xml
+// OPTIONS: -Channel Experimental -Language C++ -Namespace Microsoft.Windows.Storage.ApplicationData -Path dev\Common\TerminalVelocityFeatures-ApplicationData.xml -Output dev\Common\TerminalVelocityFeatures-ApplicationData.h
+
+#if defined(__midlrt)
+namespace features
+{
+ feature_name Feature_ApplicationData = { DisabledByDefault, FALSE };
+}
+#endif // defined(__midlrt)
+
+// Feature constants
+#define WINDOWSAPPRUNTIME_MICROSOFT_WINDOWS_STORAGE_APPLICATIONDATA_FEATURE_APPLICATIONDATA_ENABLED 1
+
+#if defined(__cplusplus)
+
+namespace Microsoft::Windows::Storage::ApplicationData
+{
+
+__pragma(detect_mismatch("ODR_violation_WINDOWSAPPRUNTIME_MICROSOFT_WINDOWS_STORAGE_APPLICATIONDATA_FEATURE_APPLICATIONDATA_ENABLED_mismatch", "AlwaysEnabled"))
+struct Feature_ApplicationData
+{
+ static constexpr bool IsEnabled() { return WINDOWSAPPRUNTIME_MICROSOFT_WINDOWS_STORAGE_APPLICATIONDATA_FEATURE_APPLICATIONDATA_ENABLED == 1; }
+};
+
+} // namespace Microsoft.Windows.Storage.ApplicationData
+
+#endif // defined(__cplusplus)
diff --git a/dev/Common/TerminalVelocityFeatures-ApplicationData.xml b/dev/Common/TerminalVelocityFeatures-ApplicationData.xml
new file mode 100644
index 0000000000..0c3d063a4f
--- /dev/null
+++ b/dev/Common/TerminalVelocityFeatures-ApplicationData.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+ Feature_ApplicationData
+ ApplicationData APIs
+ AlwaysEnabled
+
+ Preview
+ Stable
+
+
+
diff --git a/dev/DeploymentAgent/packages.config b/dev/DeploymentAgent/packages.config
index 9ba3aa91dd..de426df9bc 100644
--- a/dev/DeploymentAgent/packages.config
+++ b/dev/DeploymentAgent/packages.config
@@ -1,5 +1,5 @@
-
+
diff --git a/dev/DynamicDependencyDataStore/DynamicDependency.DataStore/winmain.cpp b/dev/DynamicDependencyDataStore/DynamicDependency.DataStore/winmain.cpp
index c30697bd7c..e5f3b3a7b6 100644
--- a/dev/DynamicDependencyDataStore/DynamicDependency.DataStore/winmain.cpp
+++ b/dev/DynamicDependencyDataStore/DynamicDependency.DataStore/winmain.cpp
@@ -41,7 +41,7 @@ struct __declspec(uuid(PR_DYNDEP_DATASTORE_CLSID_STRING)) DynamicDependencyDataS
WCHAR fullName[PACKAGE_FULL_NAME_MAX_LENGTH + 1]{};
UINT32 fullNameLength = ARRAYSIZE(fullName);
- RETURN_IF_FAILED(GetCurrentPackageFullName(&fullNameLength, fullName));
+ RETURN_IF_FAILED(::GetCurrentPackageFullName(&fullNameLength, fullName));
auto fullNameCoTaskMem = wil::make_cotaskmem_string_nothrow(fullName);
RETURN_IF_NULL_ALLOC(fullNameCoTaskMem);
diff --git a/dev/DynamicDependencyLifetimeManager/DynamicDependencyLifetimeManager/winmain.cpp b/dev/DynamicDependencyLifetimeManager/DynamicDependencyLifetimeManager/winmain.cpp
index 93d49f8b39..0c56221b77 100644
--- a/dev/DynamicDependencyLifetimeManager/DynamicDependencyLifetimeManager/winmain.cpp
+++ b/dev/DynamicDependencyLifetimeManager/DynamicDependencyLifetimeManager/winmain.cpp
@@ -38,7 +38,7 @@ struct __declspec(uuid(PR_DYNDEP_LIFETIMEMANAGER_CLSID_STRING)) DynamicDependenc
WCHAR fullName[PACKAGE_FULL_NAME_MAX_LENGTH + 1]{};
UINT32 fullNameLength = ARRAYSIZE(fullName);
- RETURN_IF_FAILED(GetCurrentPackageFullName(&fullNameLength, fullName));
+ RETURN_IF_FAILED(::GetCurrentPackageFullName(&fullNameLength, fullName));
auto fullNameCoTaskMem = wil::make_cotaskmem_string_nothrow(fullName);
RETURN_IF_NULL_ALLOC(fullNameCoTaskMem);
diff --git a/dev/MRTCore/mrt/Core/src/packages.config b/dev/MRTCore/mrt/Core/src/packages.config
index e9fecf8c0b..1680d22b22 100644
--- a/dev/MRTCore/mrt/Core/src/packages.config
+++ b/dev/MRTCore/mrt/Core/src/packages.config
@@ -3,5 +3,5 @@
-
+
diff --git a/dev/MRTCore/mrt/mrm/UnitTests/packages.config b/dev/MRTCore/mrt/mrm/UnitTests/packages.config
index c493267598..70a3ef5f46 100644
--- a/dev/MRTCore/mrt/mrm/UnitTests/packages.config
+++ b/dev/MRTCore/mrt/mrm/UnitTests/packages.config
@@ -1,5 +1,5 @@
-
+
diff --git a/dev/MRTCore/mrt/mrm/mrmex/packages.config b/dev/MRTCore/mrt/mrm/mrmex/packages.config
index a63e6c97b3..de36c73465 100644
--- a/dev/MRTCore/mrt/mrm/mrmex/packages.config
+++ b/dev/MRTCore/mrt/mrm/mrmex/packages.config
@@ -1,4 +1,4 @@
-
+
diff --git a/dev/MRTCore/mrt/mrm/mrmmin/packages.config b/dev/MRTCore/mrt/mrm/mrmmin/packages.config
index a63e6c97b3..de36c73465 100644
--- a/dev/MRTCore/mrt/mrm/mrmmin/packages.config
+++ b/dev/MRTCore/mrt/mrm/mrmmin/packages.config
@@ -1,4 +1,4 @@
-
+
diff --git a/dev/Projections/CS/Microsoft.Windows.Storage.Projection/Microsoft.Windows.Storage.Projection.csproj b/dev/Projections/CS/Microsoft.Windows.Storage.Projection/Microsoft.Windows.Storage.Projection.csproj
new file mode 100644
index 0000000000..df2773f8b4
--- /dev/null
+++ b/dev/Projections/CS/Microsoft.Windows.Storage.Projection/Microsoft.Windows.Storage.Projection.csproj
@@ -0,0 +1,58 @@
+
+
+ net6.0-windows10.0.17763.0
+ 10.0.17763.0
+ x64;x86;arm64
+ AnyCPU
+ false
+
+
+
+ true
+ true
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+ Microsoft.Windows.Storage
+ 10.0.17763.0
+ false
+
+
+
+
+ pdbonly
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+ $(OutDir)..\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.ApplicationModel.DynamicDependency.winmd
+ true
+
+
+ $(OutDir)..\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Storage.winmd
+ true
+
+
+
+
diff --git a/dev/PushNotifications/PushNotificationUtility.h b/dev/PushNotifications/PushNotificationUtility.h
index da20bfae79..ae797af578 100644
--- a/dev/PushNotifications/PushNotificationUtility.h
+++ b/dev/PushNotifications/PushNotificationUtility.h
@@ -143,7 +143,7 @@ namespace winrt::Microsoft::Windows::PushNotifications::Helpers
{
WCHAR packageFullName[PACKAGE_FULL_NAME_MAX_LENGTH + 1]{};
UINT32 packageFullNameLength{ ARRAYSIZE(packageFullName) };
- THROW_IF_FAILED(GetCurrentPackageFullName(&packageFullNameLength, packageFullName));
+ THROW_IF_FAILED(::GetCurrentPackageFullName(&packageFullNameLength, packageFullName));
packagedFullName = wil::make_cotaskmem_string(packageFullName);
THROW_IF_NULL_ALLOC(packagedFullName);
diff --git a/dev/PushNotifications/PushNotificationsLongRunningTask.StartupTask/packages.config b/dev/PushNotifications/PushNotificationsLongRunningTask.StartupTask/packages.config
index d7178814bc..f0c66966db 100644
--- a/dev/PushNotifications/PushNotificationsLongRunningTask.StartupTask/packages.config
+++ b/dev/PushNotifications/PushNotificationsLongRunningTask.StartupTask/packages.config
@@ -1,7 +1,7 @@
-
+
-
\ No newline at end of file
+
diff --git a/dev/PushNotifications/PushNotificationsLongRunningTask/packages.config b/dev/PushNotifications/PushNotificationsLongRunningTask/packages.config
index cd05427e9c..c6c2f60267 100644
--- a/dev/PushNotifications/PushNotificationsLongRunningTask/packages.config
+++ b/dev/PushNotifications/PushNotificationsLongRunningTask/packages.config
@@ -4,5 +4,5 @@
-
+
diff --git a/dev/RestartAgent/packages.config b/dev/RestartAgent/packages.config
index 9ba3aa91dd..de426df9bc 100644
--- a/dev/RestartAgent/packages.config
+++ b/dev/RestartAgent/packages.config
@@ -1,5 +1,5 @@
-
+
diff --git a/dev/WindowsAppRuntime_BootstrapDLL/packages.config b/dev/WindowsAppRuntime_BootstrapDLL/packages.config
index e9fecf8c0b..1680d22b22 100644
--- a/dev/WindowsAppRuntime_BootstrapDLL/packages.config
+++ b/dev/WindowsAppRuntime_BootstrapDLL/packages.config
@@ -3,5 +3,5 @@
-
+
diff --git a/dev/WindowsAppRuntime_DLL/WindowsAppRuntime_DLL.vcxproj b/dev/WindowsAppRuntime_DLL/WindowsAppRuntime_DLL.vcxproj
index e16b44c2d6..32307249d1 100644
--- a/dev/WindowsAppRuntime_DLL/WindowsAppRuntime_DLL.vcxproj
+++ b/dev/WindowsAppRuntime_DLL/WindowsAppRuntime_DLL.vcxproj
@@ -85,6 +85,7 @@
+
diff --git a/dev/WindowsAppRuntime_DLL/packages.config b/dev/WindowsAppRuntime_DLL/packages.config
index 647f7eaa06..f0be714f65 100644
--- a/dev/WindowsAppRuntime_DLL/packages.config
+++ b/dev/WindowsAppRuntime_DLL/packages.config
@@ -4,6 +4,6 @@
-
+
diff --git a/dev/WindowsAppRuntime_DLL/pch.h b/dev/WindowsAppRuntime_DLL/pch.h
index 37ab34eedf..81ecbe2c0c 100644
--- a/dev/WindowsAppRuntime_DLL/pch.h
+++ b/dev/WindowsAppRuntime_DLL/pch.h
@@ -29,6 +29,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/eng/Version.Dependencies.xml b/eng/Version.Dependencies.xml
index 28fe3c0430..8b3f3ef238 100644
--- a/eng/Version.Dependencies.xml
+++ b/eng/Version.Dependencies.xml
@@ -32,6 +32,6 @@
-
+
diff --git a/installer/dev/packages.config b/installer/dev/packages.config
index 9ba3aa91dd..de426df9bc 100644
--- a/installer/dev/packages.config
+++ b/installer/dev/packages.config
@@ -1,5 +1,5 @@
-
+
diff --git a/installer/test/InstallerFunctionalTests/packages.config b/installer/test/InstallerFunctionalTests/packages.config
index dc444ff576..3555306520 100644
--- a/installer/test/InstallerFunctionalTests/packages.config
+++ b/installer/test/InstallerFunctionalTests/packages.config
@@ -2,5 +2,5 @@
-
+
diff --git a/specs/applicationdata/ApplicationData.md b/specs/applicationdata/ApplicationData.md
index 9dfcfdb280..20ad407f4c 100644
--- a/specs/applicationdata/ApplicationData.md
+++ b/specs/applicationdata/ApplicationData.md
@@ -270,7 +270,7 @@ If you need this functionality use the OS APIs in `Windows.Storage.ApplicationDa
```c# (but really MIDL3)
namespace Microsoft.Windows.Storage
{
- [contractversion(1)]
+ [contractversion(2)]
apicontract ApplicationDataContract{};
/// Specifies the type of data store.
@@ -350,6 +350,8 @@ namespace Microsoft.Windows.Storage
static ApplicationData GetForPackageFamily(String packageFamilyName);
/// Get an instance of ApplicationData for the specified unpackaged app for the current user.
+ [feature(Feature_ApplicationData)]
+ [contract(ApplicationDataContract, 2)]
static ApplicationData GetForUnpackaged(String publisher, String product);
/// Return true if the package family supports the machine data store.
diff --git a/test/AppLifecycle/packages.config b/test/AppLifecycle/packages.config
index dc444ff576..3555306520 100644
--- a/test/AppLifecycle/packages.config
+++ b/test/AppLifecycle/packages.config
@@ -2,5 +2,5 @@
-
+
diff --git a/test/AppNotificationBuilderTests/packages.config b/test/AppNotificationBuilderTests/packages.config
index dc444ff576..3555306520 100644
--- a/test/AppNotificationBuilderTests/packages.config
+++ b/test/AppNotificationBuilderTests/packages.config
@@ -2,5 +2,5 @@
-
+
diff --git a/test/AppNotificationTests/packages.config b/test/AppNotificationTests/packages.config
index dc444ff576..3555306520 100644
--- a/test/AppNotificationTests/packages.config
+++ b/test/AppNotificationTests/packages.config
@@ -2,5 +2,5 @@
-
+
diff --git a/test/ApplicationData/ApplicationDataTests.cpp b/test/ApplicationData/ApplicationDataTests.cpp
new file mode 100644
index 0000000000..b2abadb45e
--- /dev/null
+++ b/test/ApplicationData/ApplicationDataTests.cpp
@@ -0,0 +1,680 @@
+// Copyright (c) Microsoft Corporation and Contributors.
+// Licensed under the MIT License.
+
+#include "pch.h"
+
+#include
+
+namespace TB = ::Test::Bootstrap;
+namespace TP = ::Test::Packages;
+
+static const winrt::hstring null_hstring;
+
+namespace WEX::TestExecution
+{
+ // Teach TAEF how to format a winrt::hstring
+ template <>
+ class VerifyOutputTraits
+ {
+ public:
+ static WEX::Common::NoThrowString ToString(winrt::hstring const& value)
+ {
+ const auto s{ value.c_str() };
+ if (!s)
+ {
+ return WEX::Common::NoThrowString(L"nullptr");
+ }
+ else
+ {
+ return WEX::Common::NoThrowString().Format(L"\"%s\"", s);
+ }
+ }
+ };
+
+ // Teach TAEF how to compare a winrt::hstring
+ template <>
+ class VerifyCompareTraits
+ {
+ public:
+ static bool AreEqual(winrt::hstring const& expected, winrt::hstring const& actual)
+ {
+ return Compare(expected, actual) == 0;
+ }
+
+ static bool AreSame(winrt::hstring const& expected, winrt::hstring const& actual)
+ {
+ return &expected == &actual;
+ }
+
+ static bool IsLessThan(winrt::hstring const& expectedLess, winrt::hstring const& expectedGreater)
+ {
+ return Compare(expectedLess, expectedGreater) < 0;
+ }
+
+ static bool IsGreaterThan(winrt::hstring const& expectedGreater, winrt::hstring const& expectedLess)
+ {
+ return Compare(expectedGreater, expectedLess) > 0;
+ }
+
+ static bool IsNull(winrt::hstring const& object)
+ {
+ return object.c_str() == nullptr;
+ }
+ private:
+ static int Compare(winrt::hstring const& left, winrt::hstring const& right)
+ {
+ if (left == right)
+ {
+ return 0;
+ }
+ else if (left.c_str() == nullptr)
+ {
+ return -1;
+ }
+ else if (right.c_str() == nullptr)
+ {
+ return 1;
+ }
+ else
+ {
+ return CompareStringOrdinal(left .c_str(), -1, right.c_str(), -1, FALSE) - CSTR_EQUAL;
+ }
+ }
+ };
+}
+
+namespace Test::PackageManager::Tests
+{
+ const auto Main_PackageFamilyName{ ::TP::DynamicDependencyDataStore::c_PackageFamilyName };
+ const auto Framework_PackageFamilyName{ ::TP::WindowsAppRuntimeFramework::c_PackageFamilyName };
+
+ std::filesystem::path GetExpectedMachinePath(winrt::hstring const& packageFamilyName)
+ {
+ // Expected Path = HKLM\...apprepository...\ApplicationData\...pkgfamilyname...\Machine
+ // This is typically %ProgramData%\Microsoft\Windows\AppRepository\ApplicationData\...pkgfamilyname...\Machine
+ // and by 'typically' we mean 'all current Windows editions' so we'll assume it's true for ease of testing
+ // and use this test as a canary to detect if/when this is ever not true on any supported platform.
+ wil::unique_cotaskmem_string path;
+ THROW_IF_FAILED(::SHGetKnownFolderPath(FOLDERID_ProgramData, 0, nullptr, wil::out_param(path)));
+ const std::filesystem::path programData{ path.get() };
+ const auto packageRepositoryRoot{ programData / L"Microsoft\\Windows\\AppRepository\\ApplicationData" };
+ const auto packageFamilyRoot{ packageRepositoryRoot / packageFamilyName.c_str() };
+ const auto expectedMachinePath{ packageFamilyRoot / L"Machine" };
+ return expectedMachinePath;
+ }
+
+ class ApplicationDataTests
+ {
+ public:
+ BEGIN_TEST_CLASS(ApplicationDataTests)
+ TEST_CLASS_PROPERTY(L"ThreadingModel", L"MTA")
+ END_TEST_CLASS()
+
+ TEST_CLASS_SETUP(ClassSetup)
+ {
+ if (!::WindowsVersion::IsWindows11_21H2OrGreater())
+ {
+ WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped, L"PackageDeploymentManager requires Win11 >= 21H2 (SV1). Skipping tests");
+ return true;
+ }
+ ::TB::Setup();
+ return true;
+ }
+
+ TEST_CLASS_CLEANUP(ClassCleanup)
+ {
+ ::TB::Cleanup();
+ return true;
+ }
+
+ TEST_METHOD(GetDefault_Main)
+ {
+ //TODO
+ }
+
+ TEST_METHOD(GetDefault_Framework)
+ {
+ //TODO
+ }
+
+ TEST_METHOD(GetForPackageFamily_Main)
+ {
+ winrt::hstring packageFamilyName{ Main_PackageFamilyName };
+ auto applicationData{ winrt::Microsoft::Windows::Storage::ApplicationData::GetForPackageFamily(packageFamilyName) };
+ VERIFY_IS_NOT_NULL(applicationData);
+
+ auto systemApplicationData{ winrt::Windows::Management::Core::ApplicationDataManager::CreateForPackageFamily(packageFamilyName) };
+ VERIFY_IS_NOT_NULL(applicationData);
+ }
+
+ TEST_METHOD(GetForPackageFamily_Framework)
+ {
+ winrt::hstring packageFamilyName{ Framework_PackageFamilyName };
+ auto applicationData{ winrt::Microsoft::Windows::Storage::ApplicationData::GetForPackageFamily(packageFamilyName) };
+ VERIFY_IS_NOT_NULL(applicationData);
+
+ try
+ {
+ auto systemApplicationData{ winrt::Windows::Management::Core::ApplicationDataManager::CreateForPackageFamily(packageFamilyName) };
+ VERIFY_FAIL(L"Success is not expected");
+ }
+ catch (winrt::hresult_error& e)
+ {
+ VERIFY_ARE_EQUAL(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), e.code(), WEX::Common::String().Format(L"0x%X %s", e.code(), e.message().c_str()));
+ }
+ }
+
+ TEST_METHOD(GetForUser_Main)
+ {
+ //TODO
+ }
+
+ TEST_METHOD(GetForUser_Framework)
+ {
+ //TODO
+ }
+
+ TEST_METHOD(FolderAndPath_Main)
+ {
+ winrt::hstring packageFamilyName{ Main_PackageFamilyName };
+ auto applicationData{ winrt::Microsoft::Windows::Storage::ApplicationData::GetForPackageFamily(packageFamilyName) };
+ VERIFY_IS_NOT_NULL(applicationData);
+
+ auto systemApplicationData{ winrt::Windows::Management::Core::ApplicationDataManager::CreateForPackageFamily(packageFamilyName) };
+ VERIFY_IS_NOT_NULL(systemApplicationData);
+
+ const auto localCacheFolder{ applicationData.LocalCacheFolder() };
+ const auto localCachePath{ applicationData.LocalCachePath() };
+ VERIFY_ARE_EQUAL(localCacheFolder.Path(), localCachePath);
+ const auto expectedLocalCacheFolder{ systemApplicationData.LocalCacheFolder() };
+ const auto expectedLocalCachePath{ expectedLocalCacheFolder.Path() };
+ VERIFY_ARE_EQUAL(localCachePath, expectedLocalCachePath);
+
+ const auto localFolder{ applicationData.LocalFolder() };
+ const auto localPath{ applicationData.LocalPath() };
+ VERIFY_ARE_EQUAL(localFolder.Path(), localPath);
+ const auto expectedLocalFolder{ systemApplicationData.LocalFolder() };
+ const auto expectedLocalPath{ expectedLocalFolder.Path() };
+ VERIFY_ARE_EQUAL(localPath, expectedLocalPath);
+
+ // SharedLocalFolder is only available if the appropriate group policy is enabled
+ // If not enabled then SharedLocalFolder = SharedLocalPath = null
+ const auto sharedLocalFolder{ applicationData.SharedLocalFolder() };
+ const auto sharedLocalPath{ applicationData.SharedLocalPath() };
+ if (sharedLocalFolder)
+ {
+ VERIFY_ARE_EQUAL(sharedLocalFolder.Path(), sharedLocalPath);
+ }
+ else
+ {
+ VERIFY_IS_NULL(sharedLocalFolder);
+ VERIFY_ARE_EQUAL(sharedLocalPath, null_hstring);
+ }
+ const auto expectedSharedLocalFolder{ systemApplicationData.SharedLocalFolder() };
+ winrt::hstring expectedSharedLocalPath;
+ if (expectedSharedLocalFolder)
+ {
+ expectedSharedLocalPath = expectedSharedLocalFolder.Path();
+ };
+ VERIFY_ARE_EQUAL(sharedLocalPath, expectedSharedLocalPath);
+
+ const auto temporaryFolder{ applicationData.TemporaryFolder() };
+ const auto temporaryPath{ applicationData.TemporaryPath() };
+ VERIFY_ARE_EQUAL(temporaryFolder.Path(), temporaryPath);
+ const auto expectedTemporaryFolder{ systemApplicationData.TemporaryFolder() };
+ const auto expectedTemporaryPath{ expectedTemporaryFolder.Path() };
+ VERIFY_ARE_EQUAL(temporaryPath, expectedTemporaryPath);
+ }
+
+ TEST_METHOD(FolderAndPath_Framework)
+ {
+ winrt::hstring packageFamilyName{ Framework_PackageFamilyName };
+ auto applicationData{ winrt::Microsoft::Windows::Storage::ApplicationData::GetForPackageFamily(packageFamilyName) };
+ VERIFY_IS_NOT_NULL(applicationData);
+ const auto localCacheFolder{ applicationData.LocalCacheFolder() };
+ VERIFY_IS_NULL(localCacheFolder);
+ const auto localCachePath{ applicationData.LocalCachePath() };
+ VERIFY_ARE_EQUAL(localCachePath, null_hstring);
+ const auto localFolder{ applicationData.LocalFolder() };
+ VERIFY_IS_NULL(localFolder);
+ const auto localPath{ applicationData.LocalPath() };
+ VERIFY_ARE_EQUAL(localPath, null_hstring);
+ const auto sharedLocalFolder{ applicationData.SharedLocalFolder() };
+ VERIFY_IS_NULL(sharedLocalFolder);
+ const auto sharedLocalPath{ applicationData.SharedLocalPath() };
+ VERIFY_ARE_EQUAL(sharedLocalPath, null_hstring);
+ const auto temporaryFolder{ applicationData.TemporaryFolder() };
+ VERIFY_IS_NULL(temporaryFolder);
+ const auto temporaryPath{ applicationData.TemporaryPath() };
+ VERIFY_ARE_EQUAL(temporaryPath, null_hstring);
+
+ try
+ {
+ auto systemApplicationData{ winrt::Windows::Management::Core::ApplicationDataManager::CreateForPackageFamily(packageFamilyName) };
+ VERIFY_FAIL(L"Success is not expected");
+ }
+ catch (winrt::hresult_error& e)
+ {
+ VERIFY_ARE_EQUAL(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), e.code(), WEX::Common::String().Format(L"0x%X %s", e.code(), e.message().c_str()));
+ }
+ }
+
+ TEST_METHOD(PublisherCacheFolderAndPath_Main)
+ {
+ winrt::hstring packageFamilyName{ Main_PackageFamilyName };
+ winrt::hstring folderName{ L"Does.Not.Exist" };
+ auto applicationData{ winrt::Microsoft::Windows::Storage::ApplicationData::GetForPackageFamily(packageFamilyName) };
+ VERIFY_IS_NOT_NULL(applicationData);
+
+ auto systemApplicationData{ winrt::Windows::Management::Core::ApplicationDataManager::CreateForPackageFamily(packageFamilyName) };
+ VERIFY_IS_NOT_NULL(systemApplicationData);
+
+ const auto publisherCacheFolder{ applicationData.GetPublisherCacheFolder(folderName) };
+ const auto publisherCachePath{ applicationData.GetPublisherCachePath(folderName) };
+ if (publisherCacheFolder)
+ {
+ VERIFY_ARE_EQUAL(publisherCacheFolder.Path(), publisherCachePath);
+ }
+ else
+ {
+ VERIFY_IS_NULL(publisherCacheFolder);
+ VERIFY_ARE_EQUAL(publisherCachePath, null_hstring);
+ }
+ try
+ {
+ const auto expectedPublisherCacheFolder{ systemApplicationData.GetPublisherCacheFolder(folderName) };
+ VERIFY_FAIL(L"Success is not expected");
+ }
+ catch (winrt::hresult_error& e)
+ {
+ VERIFY_ARE_EQUAL(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), e.code(), WEX::Common::String().Format(L"0x%X %s", e.code(), e.message().c_str()));
+ }
+ const auto expectedPublisherCachePath{ null_hstring };
+ VERIFY_ARE_EQUAL(publisherCachePath, expectedPublisherCachePath);
+ }
+
+ TEST_METHOD(PublisherCacheFolderAndPath_Framework)
+ {
+ winrt::hstring packageFamilyName{ Framework_PackageFamilyName };
+ winrt::hstring folderName{ L"Does.Not.Exist" };
+ auto applicationData{ winrt::Microsoft::Windows::Storage::ApplicationData::GetForPackageFamily(packageFamilyName) };
+ VERIFY_IS_NOT_NULL(applicationData);
+
+ try
+ {
+ auto systemApplicationData{ winrt::Windows::Management::Core::ApplicationDataManager::CreateForPackageFamily(packageFamilyName) };
+ VERIFY_FAIL(L"Success is not expected");
+ }
+ catch (winrt::hresult_error& e)
+ {
+ VERIFY_ARE_EQUAL(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), e.code(), WEX::Common::String().Format(L"0x%X %s", e.code(), e.message().c_str()));
+ }
+
+ const auto publisherCacheFolder{ applicationData.GetPublisherCacheFolder(folderName) };
+ VERIFY_IS_NULL(publisherCacheFolder);
+ const auto publisherCachePath{ applicationData.GetPublisherCachePath(folderName) };
+ VERIFY_ARE_EQUAL(publisherCachePath, null_hstring);
+ }
+
+ TEST_METHOD(MachineFolderAndPath_Main_NotSupported)
+ {
+ winrt::hstring packageFamilyName{ Main_PackageFamilyName };
+ auto applicationData{ winrt::Microsoft::Windows::Storage::ApplicationData::GetForPackageFamily(packageFamilyName) };
+ VERIFY_IS_NOT_NULL(applicationData);
+
+ VERIFY_IS_FALSE(applicationData.IsMachinePathSupported());
+
+ const auto machineFolder{ applicationData.MachineFolder() };
+ VERIFY_IS_NULL(machineFolder);
+ const auto machinePath{ applicationData.MachinePath() };
+ VERIFY_ARE_EQUAL(machinePath, null_hstring);
+ }
+
+ TEST_METHOD(MachineFolderAndPath_Framework_NotSupported)
+ {
+ winrt::hstring packageFamilyName{ Framework_PackageFamilyName };
+ auto applicationData{ winrt::Microsoft::Windows::Storage::ApplicationData::GetForPackageFamily(packageFamilyName) };
+ VERIFY_IS_NOT_NULL(applicationData);
+
+ VERIFY_IS_FALSE(applicationData.IsMachinePathSupported());
+
+ const auto machineFolder{ applicationData.MachineFolder() };
+ VERIFY_IS_NULL(machineFolder);
+ const auto machinePath{ applicationData.MachinePath() };
+ VERIFY_ARE_EQUAL(machinePath, null_hstring);
+ }
+
+ TEST_METHOD(LocalSettings_Main)
+ {
+ winrt::hstring packageFamilyName{ Main_PackageFamilyName };
+ auto applicationData{ winrt::Microsoft::Windows::Storage::ApplicationData::GetForPackageFamily(packageFamilyName) };
+ VERIFY_IS_NOT_NULL(applicationData);
+
+ auto systemApplicationData{ winrt::Windows::Management::Core::ApplicationDataManager::CreateForPackageFamily(packageFamilyName) };
+ VERIFY_IS_NOT_NULL(systemApplicationData);
+
+ const auto localSettings{ applicationData.LocalSettings() };
+ const auto systemLocalSettings{ systemApplicationData.LocalSettings() };
+ VERIFY_ARE_EQUAL(static_cast(localSettings.Locality()), static_cast(systemLocalSettings.Locality()));
+
+ auto containers{ localSettings.Containers() };
+ VERIFY_ARE_EQUAL(0u, containers.Size());
+ auto systemContainers{ systemLocalSettings.Containers() };
+ VERIFY_ARE_EQUAL(0u, systemContainers.Size());
+ VERIFY_ARE_EQUAL(containers.Size(), systemContainers.Size());
+
+ const winrt::hstring foodAndStuff{ L"FoodAndStuff" };
+ VERIFY_IS_FALSE(containers.HasKey(foodAndStuff));
+ VERIFY_IS_FALSE(systemContainers.HasKey(foodAndStuff));
+
+ auto container{ localSettings.CreateContainer(foodAndStuff, winrt::Microsoft::Windows::Storage::ApplicationDataCreateDisposition::Always) };
+ VERIFY_ARE_EQUAL(foodAndStuff, container.Name());
+ //
+ VERIFY_ARE_EQUAL(0u, containers.Size());
+ VERIFY_IS_FALSE(containers.HasKey(foodAndStuff));
+ containers = localSettings.Containers();
+ VERIFY_ARE_EQUAL(1u, containers.Size());
+ VERIFY_IS_TRUE(containers.HasKey(foodAndStuff));
+ container = containers.Lookup(foodAndStuff);
+ VERIFY_IS_NOT_NULL(container);
+ VERIFY_ARE_EQUAL(foodAndStuff, container.Name());
+ //
+ VERIFY_ARE_EQUAL(0u, systemContainers.Size());
+ VERIFY_IS_FALSE(systemContainers.HasKey(foodAndStuff));
+ systemContainers = systemLocalSettings.Containers();
+ VERIFY_ARE_EQUAL(1u, systemContainers.Size());
+ VERIFY_IS_TRUE(systemContainers.HasKey(foodAndStuff));
+ auto systemContainer{ systemContainers.Lookup(foodAndStuff) };
+ VERIFY_IS_NOT_NULL(systemContainer);
+ VERIFY_ARE_EQUAL(foodAndStuff, systemContainer.Name());
+
+ const winrt::hstring keyMeat{ L"Meat" };
+ const winrt::hstring rawValueSteak{ L"Steak" };
+ auto valueSteak{ winrt::Windows::Foundation::PropertyValue::CreateString(rawValueSteak) };
+ auto values{ container.Values() };
+ VERIFY_ARE_EQUAL(0u, values.Size());
+ values.Insert(keyMeat, valueSteak);
+ VERIFY_ARE_EQUAL(1u, values.Size());
+ auto steak{ values.Lookup(keyMeat) };
+ VERIFY_IS_NOT_NULL(steak);
+ auto steakLookupAsReferenceString{ steak.try_as>() };
+ VERIFY_IS_NOT_NULL(steakLookupAsReferenceString);
+ auto steakString{ steakLookupAsReferenceString.GetString() };
+ VERIFY_ARE_EQUAL(rawValueSteak, steakString);
+ //
+ auto systemValues{ systemContainer.Values() };
+ VERIFY_ARE_EQUAL(1u, systemValues.Size());
+ auto systemSteak{ systemValues.Lookup(keyMeat) };
+ VERIFY_IS_NOT_NULL(systemSteak);
+ auto systemSteakLookupAsReferenceString{ systemSteak.try_as>() };
+ VERIFY_IS_NOT_NULL(systemSteakLookupAsReferenceString);
+ auto systemSteakString{ systemSteakLookupAsReferenceString.GetString() };
+ VERIFY_ARE_EQUAL(rawValueSteak, systemSteakString);
+
+ const winrt::hstring keyDrink{ L"Drink" };
+ const winrt::hstring rawValueWhiskey{ L"Whiskey" };
+ auto valueWhiskey{ winrt::Windows::Foundation::PropertyValue::CreateString(rawValueWhiskey) };
+ VERIFY_ARE_EQUAL(1u, systemValues.Size());
+ systemValues.Insert(keyDrink, valueWhiskey);
+ VERIFY_ARE_EQUAL(2u, systemValues.Size());
+ auto systemWhiskey{ systemValues.Lookup(keyDrink) };
+ VERIFY_IS_NOT_NULL(systemWhiskey);
+ auto systemWhiskeyLookupAsReferenceString{ systemWhiskey.try_as>() };
+ VERIFY_IS_NOT_NULL(systemWhiskeyLookupAsReferenceString);
+ auto systemWhiskeyString{ systemWhiskeyLookupAsReferenceString.GetString() };
+ VERIFY_ARE_EQUAL(rawValueWhiskey, systemWhiskeyString);
+ //
+ VERIFY_ARE_EQUAL(2u, values.Size());
+ auto whiskey{ values.Lookup(keyDrink) };
+ VERIFY_IS_NOT_NULL(whiskey);
+ auto whiskeyLookupAsReferenceString{ whiskey.try_as>() };
+ VERIFY_IS_NOT_NULL(whiskeyLookupAsReferenceString);
+ auto whiskeyString{ whiskeyLookupAsReferenceString.GetString() };
+ VERIFY_ARE_EQUAL(rawValueWhiskey, whiskeyString);
+
+ VERIFY_ARE_EQUAL(winrt::Microsoft::Windows::Storage::ApplicationDataLocality::Local, container.Locality());
+ container.Close();
+ try
+ {
+ auto locality{ container.Locality() };
+ VERIFY_FAIL(L"Success is not expected");
+ }
+ catch (winrt::hresult_error& e)
+ {
+ VERIFY_ARE_EQUAL(RO_E_CLOSED, e.code(), WEX::Common::String().Format(L"0x%X %s", e.code(), e.message().c_str()));
+ }
+ VERIFY_ARE_EQUAL(winrt::Windows::Storage::ApplicationDataLocality::Local, systemContainer.Locality());
+ systemContainer.Close();
+ try
+ {
+ auto locality{ systemContainer.Locality() };
+ VERIFY_FAIL(L"Success is not expected");
+ }
+ catch (winrt::hresult_error& e)
+ {
+ VERIFY_ARE_EQUAL(RO_E_CLOSED, e.code(), WEX::Common::String().Format(L"0x%X %s", e.code(), e.message().c_str()));
+ }
+
+ VERIFY_ARE_EQUAL(1u, localSettings.Containers().Size());
+ VERIFY_ARE_EQUAL(1u, systemLocalSettings.Containers().Size());
+ localSettings.DeleteContainer(foodAndStuff);
+ VERIFY_ARE_EQUAL(0u, localSettings.Containers().Size());
+ VERIFY_ARE_EQUAL(0u, systemLocalSettings.Containers().Size());
+
+ VERIFY_ARE_EQUAL(winrt::Microsoft::Windows::Storage::ApplicationDataLocality::Local, localSettings.Locality());
+ localSettings.Close();
+ try
+ {
+ auto locality{ localSettings.Locality() };
+ VERIFY_FAIL(L"Success is not expected");
+ }
+ catch (winrt::hresult_error& e)
+ {
+ VERIFY_ARE_EQUAL(RO_E_CLOSED, e.code(), WEX::Common::String().Format(L"0x%X %s", e.code(), e.message().c_str()));
+ }
+ VERIFY_ARE_EQUAL(winrt::Windows::Storage::ApplicationDataLocality::Local, systemLocalSettings.Locality());
+ systemLocalSettings.Close();
+ try
+ {
+ auto locality{ systemLocalSettings.Locality() };
+ VERIFY_FAIL(L"Success is not expected");
+ }
+ catch (winrt::hresult_error& e)
+ {
+ VERIFY_ARE_EQUAL(RO_E_CLOSED, e.code(), WEX::Common::String().Format(L"0x%X %s", e.code(), e.message().c_str()));
+ }
+ }
+
+ TEST_METHOD(LocalSettings_Framework)
+ {
+ winrt::hstring packageFamilyName{ Framework_PackageFamilyName };
+ auto applicationData{ winrt::Microsoft::Windows::Storage::ApplicationData::GetForPackageFamily(packageFamilyName) };
+ VERIFY_IS_NOT_NULL(applicationData);
+ const auto localSettings{ applicationData.LocalSettings() };
+ VERIFY_IS_NULL(localSettings);
+
+ try
+ {
+ auto systemApplicationData{ winrt::Windows::Management::Core::ApplicationDataManager::CreateForPackageFamily(packageFamilyName) };
+ VERIFY_FAIL(L"Success is not expected");
+ }
+ catch (winrt::hresult_error& e)
+ {
+ VERIFY_ARE_EQUAL(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), e.code(), WEX::Common::String().Format(L"0x%X %s", e.code(), e.message().c_str()));
+ }
+ }
+
+ TEST_METHOD(ClearAsync_Main)
+ {
+ //TODO
+ }
+
+ TEST_METHOD(ClearAsync_Framework)
+ {
+ //TODO
+ }
+
+ TEST_METHOD(ClearFolderAsync_Machine_Main)
+ {
+ //TODO
+ }
+
+ TEST_METHOD(ClearFolderAsync_Machine_Framework)
+ {
+ //TODO
+ }
+
+ TEST_METHOD(ClearPublisherCacheFolderAsync_Main)
+ {
+ //TODO
+ }
+
+ TEST_METHOD(ClearPublisherCacheFolderAsync_Framework)
+ {
+ //TODO
+ }
+ };
+
+
+ class ApplicationDataTests_Elevated
+ {
+ public:
+ BEGIN_TEST_CLASS(ApplicationDataTests_Elevated)
+ TEST_CLASS_PROPERTY(L"ThreadingModel", L"MTA")
+ TEST_CLASS_PROPERTY(L"RunAs", L"RestrictedUser")
+ TEST_CLASS_PROPERTY(L"RunFixtureAs", L"RestrictedUser")
+ END_TEST_CLASS()
+
+ TEST_CLASS_SETUP(ClassSetup)
+ {
+ if (!::WindowsVersion::IsWindows11_21H2OrGreater())
+ {
+ WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped, L"PackageDeploymentManager requires Win11 >= 21H2 (SV1). Skipping tests");
+ return true;
+ }
+ ::TB::Setup();
+ return true;
+ }
+
+ TEST_CLASS_CLEANUP(ClassCleanup)
+ {
+ ::TB::Cleanup();
+ return true;
+ }
+
+ static void CreateMachinePathIfNecessary(PCWSTR packageFamilyName)
+ {
+ const auto expectedMachinePath{ GetExpectedMachinePath(packageFamilyName) };
+ const std::filesystem::path path{ expectedMachinePath.c_str() };
+ VERIFY_ARE_EQUAL(path.filename(), L"Machine");
+ if (std::filesystem::exists(path))
+ {
+ WEX::Logging::Log::Comment(WEX::Common::String().Format(L"MachinePath exists: %s", path.c_str()));
+ }
+ else
+ {
+ WEX::Logging::Log::Comment(WEX::Common::String().Format(L"Creating MachinePath: %s", path.c_str()));
+ wil::CreateDirectoryDeep(path.c_str());
+ }
+ }
+
+ static void RemoveMachinePathIfNecessary(PCWSTR packageFamilyName)
+ {
+ const auto expectedMachinePath{ GetExpectedMachinePath(packageFamilyName) };
+ const std::filesystem::path path{ expectedMachinePath.c_str() };
+ VERIFY_ARE_EQUAL(path.filename(), L"Machine");
+ const auto packageFamilyPath{ path.parent_path() };
+ if (std::filesystem::exists(packageFamilyPath))
+ {
+ WEX::Logging::Log::Comment(WEX::Common::String().Format(L"Removing MachinePath's PackageFamily: %s", packageFamilyPath.c_str()));
+ wil::RemoveDirectoryRecursive(packageFamilyPath.c_str(), wil::RemoveDirectoryOptions::RemoveReadOnly);
+ }
+ else
+ {
+ WEX::Logging::Log::Comment(WEX::Common::String().Format(L"MachinePath's PackageFamily does not exist: %s", packageFamilyPath.c_str()));
+ }
+ }
+
+ TEST_METHOD(CreateMachinePathIfNecessary_Framework)
+ {
+ BEGIN_TEST_METHOD_PROPERTIES()
+ TEST_METHOD_PROPERTY(L"RunAs", L"System")
+ END_TEST_METHOD_PROPERTIES()
+
+ const auto packageFamilyName{ Framework_PackageFamilyName };
+ CreateMachinePathIfNecessary(packageFamilyName);
+ }
+
+ TEST_METHOD(CreateMachinePathIfNecessary_Main)
+ {
+ BEGIN_TEST_METHOD_PROPERTIES()
+ TEST_METHOD_PROPERTY(L"RunAs", L"System")
+ END_TEST_METHOD_PROPERTIES()
+
+ const auto packageFamilyName{ Main_PackageFamilyName };
+ CreateMachinePathIfNecessary(packageFamilyName);
+ }
+
+ TEST_METHOD(MachineFolderAndPath_Main_Supported)
+ {
+ BEGIN_TEST_METHOD_PROPERTIES()
+ TEST_METHOD_PROPERTY(L"RunAs", L"RestrictedUser")
+ END_TEST_METHOD_PROPERTIES()
+
+ winrt::hstring packageFamilyName{ Main_PackageFamilyName };
+ auto applicationData{ winrt::Microsoft::Windows::Storage::ApplicationData::GetForPackageFamily(packageFamilyName) };
+ VERIFY_IS_NOT_NULL(applicationData);
+
+ VERIFY_IS_TRUE(applicationData.IsMachinePathSupported());
+
+ const auto machineFolder{ applicationData.MachineFolder() };
+ VERIFY_IS_NOT_NULL(machineFolder);
+ const auto machinePath{ applicationData.MachinePath() };
+ VERIFY_ARE_EQUAL(machineFolder.Path(), machinePath);
+
+ const auto expectedMachinePath{ GetExpectedMachinePath(packageFamilyName) };
+ VERIFY_ARE_EQUAL(machinePath, winrt::hstring(expectedMachinePath.c_str()));
+ }
+
+ TEST_METHOD(MachineFolderAndPath_Framework_Supported)
+ {
+ BEGIN_TEST_METHOD_PROPERTIES()
+ TEST_METHOD_PROPERTY(L"RunAs", L"RestrictedUser")
+ END_TEST_METHOD_PROPERTIES()
+
+ winrt::hstring packageFamilyName{ Framework_PackageFamilyName };
+ auto applicationData{ winrt::Microsoft::Windows::Storage::ApplicationData::GetForPackageFamily(packageFamilyName) };
+ VERIFY_IS_NOT_NULL(applicationData);
+
+ VERIFY_IS_TRUE(applicationData.IsMachinePathSupported());
+
+ const auto machineFolder{ applicationData.MachineFolder() };
+ VERIFY_IS_NOT_NULL(machineFolder);
+ const auto machinePath{ applicationData.MachinePath() };
+ VERIFY_ARE_EQUAL(machineFolder.Path(), machinePath);
+
+ const auto expectedMachinePath{ GetExpectedMachinePath(packageFamilyName) };
+ VERIFY_ARE_EQUAL(machinePath, winrt::hstring(expectedMachinePath.c_str()));
+ }
+
+ TEST_METHOD(RemoveMachinePathIfNecessary_Main)
+ {
+ BEGIN_TEST_METHOD_PROPERTIES()
+ TEST_METHOD_PROPERTY(L"RunAs", L"System")
+ END_TEST_METHOD_PROPERTIES()
+
+ const auto packageFamilyName{ Main_PackageFamilyName };
+ RemoveMachinePathIfNecessary(packageFamilyName);
+ }
+
+ TEST_METHOD(RemoveMachinePathIfNecessary_Framework)
+ {
+ BEGIN_TEST_METHOD_PROPERTIES()
+ TEST_METHOD_PROPERTY(L"RunAs", L"System")
+ END_TEST_METHOD_PROPERTIES()
+
+ const auto packageFamilyName{ Framework_PackageFamilyName };
+ RemoveMachinePathIfNecessary(packageFamilyName);
+ }
+ };
+}
diff --git a/test/ApplicationData/ApplicationDataTests.vcxproj b/test/ApplicationData/ApplicationDataTests.vcxproj
new file mode 100644
index 0000000000..25bf3cba4a
--- /dev/null
+++ b/test/ApplicationData/ApplicationDataTests.vcxproj
@@ -0,0 +1,164 @@
+
+
+
+
+
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+ Debug
+ ARM64
+
+
+ Release
+ ARM64
+
+
+
+ 16.0
+ {f4cbbb7a-5575-45b7-b586-2c99d2be81a3}
+ Win32Proj
+ ApplicationDataTests
+ 10.0
+ NativeUnitTestProject
+ ApplicationDataTests
+
+
+ DynamicLibrary
+ false
+ v143
+ Unicode
+
+
+ true
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Use
+ true
+ pch.h
+ $(RepoRoot)\test\inc;$(RepoRoot)\dev\common;$(VCInstallDir)UnitTest\include;$(OutDir)\..\WindowsAppRuntime_DLL;$(OutDir)\..\WindowsAppRuntime_BootstrapDLL;%(AdditionalIncludeDirectories)
+ $(RepoRoot);%(AdditionalIncludeDirectories)
+
+
+ Windows
+ onecore.lib;onecoreuap.lib;Microsoft.WindowsAppRuntime.lib;wex.common.lib;wex.logger.lib;te.common.lib;%(AdditionalDependencies)
+ $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(OutDir)\..\WindowsAppRuntime_DLL
+ Microsoft.WindowsAppRuntime.Bootstrap.dll;%(DelayLoadDLLs)
+
+
+
+
+ _DEBUG;%(PreprocessorDefinitions)
+
+
+
+
+ NDEBUG;%(PreprocessorDefinitions)
+
+
+
+
+ WIN32;%(PreprocessorDefinitions)
+
+
+
+
+ Create
+
+
+
+
+
+
+
+
+
+
+
+ $(OutDir)\..\WindowsAppRuntime_DLL\Microsoft.Windows.Storage.winmd
+ true
+
+
+
+
+ $(OutDir)\..\WindowsAppRuntime_DLL\Microsoft.Windows.ApplicationModel.WindowsAppRuntime.winmd
+ true
+
+
+
+
+
+
+
+ {f76b776e-86f5-48c5-8fc7-d2795ecc9746}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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}.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/ApplicationData/ApplicationDataTests.vcxproj.filters b/test/ApplicationData/ApplicationDataTests.vcxproj.filters
new file mode 100644
index 0000000000..889fd37b8a
--- /dev/null
+++ b/test/ApplicationData/ApplicationDataTests.vcxproj.filters
@@ -0,0 +1,33 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+
+
+ Header Files
+
+
+
+
+
+
diff --git a/test/ApplicationData/Test.testdef b/test/ApplicationData/Test.testdef
new file mode 100644
index 0000000000..1f79b62547
--- /dev/null
+++ b/test/ApplicationData/Test.testdef
@@ -0,0 +1,11 @@
+{
+ "Tests": [
+ {
+ "Description": "ApplicationDataTests tests for feature ApplicationData (arm64 not currently enabled)",
+ "Filename": "ApplicationDataTests.dll",
+ "Parameters": "",
+ "Architectures": ["x86", "x64"],
+ "Status": "Enabled"
+ }
+ ]
+}
diff --git a/test/ApplicationData/packages.config b/test/ApplicationData/packages.config
new file mode 100644
index 0000000000..550cd4a61f
--- /dev/null
+++ b/test/ApplicationData/packages.config
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/test/ApplicationData/pch.cpp b/test/ApplicationData/pch.cpp
new file mode 100644
index 0000000000..f59e66e263
--- /dev/null
+++ b/test/ApplicationData/pch.cpp
@@ -0,0 +1,6 @@
+// Copyright (c) Microsoft Corporation and Contributors.
+// Licensed under the MIT License.
+
+// pch.cpp: source file corresponding to the pre-compiled header
+
+#include "pch.h"
diff --git a/test/ApplicationData/pch.h b/test/ApplicationData/pch.h
new file mode 100644
index 0000000000..2635f15b87
--- /dev/null
+++ b/test/ApplicationData/pch.h
@@ -0,0 +1,33 @@
+// Copyright (c) Microsoft Corporation and Contributors.
+// Licensed under the MIT License.
+
+#ifndef PCH_H
+#define PCH_H
+
+#include
+
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+
+#include
+
+#include
+
+#include
+#include
+#include
+
+#endif //PCH_H
diff --git a/test/Common/packages.config b/test/Common/packages.config
index dc444ff576..3555306520 100644
--- a/test/Common/packages.config
+++ b/test/Common/packages.config
@@ -2,5 +2,5 @@
-
+
diff --git a/test/Deployment/API/packages.config b/test/Deployment/API/packages.config
index dc444ff576..3555306520 100644
--- a/test/Deployment/API/packages.config
+++ b/test/Deployment/API/packages.config
@@ -2,5 +2,5 @@
-
+
diff --git a/test/Deployment/Test_DeploymentManagerAutoInitialize/CPP/Test_DeploymentManagerAutoInitialize_CPP_Default/packages.config b/test/Deployment/Test_DeploymentManagerAutoInitialize/CPP/Test_DeploymentManagerAutoInitialize_CPP_Default/packages.config
index 9ba3aa91dd..de426df9bc 100644
--- a/test/Deployment/Test_DeploymentManagerAutoInitialize/CPP/Test_DeploymentManagerAutoInitialize_CPP_Default/packages.config
+++ b/test/Deployment/Test_DeploymentManagerAutoInitialize/CPP/Test_DeploymentManagerAutoInitialize_CPP_Default/packages.config
@@ -1,5 +1,5 @@
-
+
diff --git a/test/Deployment/Test_DeploymentManagerAutoInitialize/CPP/Test_DeploymentManagerAutoInitialize_CPP_Options_Default/packages.config b/test/Deployment/Test_DeploymentManagerAutoInitialize/CPP/Test_DeploymentManagerAutoInitialize_CPP_Options_Default/packages.config
index 9ba3aa91dd..de426df9bc 100644
--- a/test/Deployment/Test_DeploymentManagerAutoInitialize/CPP/Test_DeploymentManagerAutoInitialize_CPP_Options_Default/packages.config
+++ b/test/Deployment/Test_DeploymentManagerAutoInitialize/CPP/Test_DeploymentManagerAutoInitialize_CPP_Options_Default/packages.config
@@ -1,5 +1,5 @@
-
+
diff --git a/test/Deployment/Test_DeploymentManagerAutoInitialize/CPP/Test_DeploymentManagerAutoInitialize_CPP_Options_Defined/packages.config b/test/Deployment/Test_DeploymentManagerAutoInitialize/CPP/Test_DeploymentManagerAutoInitialize_CPP_Options_Defined/packages.config
index 9ba3aa91dd..de426df9bc 100644
--- a/test/Deployment/Test_DeploymentManagerAutoInitialize/CPP/Test_DeploymentManagerAutoInitialize_CPP_Options_Defined/packages.config
+++ b/test/Deployment/Test_DeploymentManagerAutoInitialize/CPP/Test_DeploymentManagerAutoInitialize_CPP_Options_Defined/packages.config
@@ -1,5 +1,5 @@
-
+
diff --git a/test/Deployment/Test_DeploymentManagerAutoInitialize/CPP/Test_DeploymentManagerAutoInitialize_CPP_Options_None/packages.config b/test/Deployment/Test_DeploymentManagerAutoInitialize/CPP/Test_DeploymentManagerAutoInitialize_CPP_Options_None/packages.config
index 9ba3aa91dd..de426df9bc 100644
--- a/test/Deployment/Test_DeploymentManagerAutoInitialize/CPP/Test_DeploymentManagerAutoInitialize_CPP_Options_None/packages.config
+++ b/test/Deployment/Test_DeploymentManagerAutoInitialize/CPP/Test_DeploymentManagerAutoInitialize_CPP_Options_None/packages.config
@@ -1,5 +1,5 @@
-
+
diff --git a/test/DynamicDependency/Test_BootstrapAutoInitialize/CPP/Test_BootstrapAutoInitialize_CPP_Default/packages.config b/test/DynamicDependency/Test_BootstrapAutoInitialize/CPP/Test_BootstrapAutoInitialize_CPP_Default/packages.config
index 3d9798ef5e..de36c73465 100644
--- a/test/DynamicDependency/Test_BootstrapAutoInitialize/CPP/Test_BootstrapAutoInitialize_CPP_Default/packages.config
+++ b/test/DynamicDependency/Test_BootstrapAutoInitialize/CPP/Test_BootstrapAutoInitialize_CPP_Default/packages.config
@@ -1,4 +1,4 @@
-
-
\ No newline at end of file
+
+
diff --git a/test/DynamicDependency/Test_BootstrapAutoInitialize/CPP/Test_BootstrapAutoInitialize_CPP_Options_Default/packages.config b/test/DynamicDependency/Test_BootstrapAutoInitialize/CPP/Test_BootstrapAutoInitialize_CPP_Options_Default/packages.config
index 3d9798ef5e..de36c73465 100644
--- a/test/DynamicDependency/Test_BootstrapAutoInitialize/CPP/Test_BootstrapAutoInitialize_CPP_Options_Default/packages.config
+++ b/test/DynamicDependency/Test_BootstrapAutoInitialize/CPP/Test_BootstrapAutoInitialize_CPP_Options_Default/packages.config
@@ -1,4 +1,4 @@
-
-
\ No newline at end of file
+
+
diff --git a/test/DynamicDependency/Test_BootstrapAutoInitialize/CPP/Test_BootstrapAutoInitialize_CPP_Options_Defined/packages.config b/test/DynamicDependency/Test_BootstrapAutoInitialize/CPP/Test_BootstrapAutoInitialize_CPP_Options_Defined/packages.config
index 3d9798ef5e..de36c73465 100644
--- a/test/DynamicDependency/Test_BootstrapAutoInitialize/CPP/Test_BootstrapAutoInitialize_CPP_Options_Defined/packages.config
+++ b/test/DynamicDependency/Test_BootstrapAutoInitialize/CPP/Test_BootstrapAutoInitialize_CPP_Options_Defined/packages.config
@@ -1,4 +1,4 @@
-
-
\ No newline at end of file
+
+
diff --git a/test/DynamicDependency/Test_BootstrapAutoInitialize/CPP/Test_BootstrapAutoInitialize_CPP_Options_None/packages.config b/test/DynamicDependency/Test_BootstrapAutoInitialize/CPP/Test_BootstrapAutoInitialize_CPP_Options_None/packages.config
index 3d9798ef5e..de36c73465 100644
--- a/test/DynamicDependency/Test_BootstrapAutoInitialize/CPP/Test_BootstrapAutoInitialize_CPP_Options_None/packages.config
+++ b/test/DynamicDependency/Test_BootstrapAutoInitialize/CPP/Test_BootstrapAutoInitialize_CPP_Options_None/packages.config
@@ -1,4 +1,4 @@
-
-
\ No newline at end of file
+
+
diff --git a/test/DynamicDependency/data/Framework.Widgets/packages.config b/test/DynamicDependency/data/Framework.Widgets/packages.config
index 9ba3aa91dd..de426df9bc 100644
--- a/test/DynamicDependency/data/Framework.Widgets/packages.config
+++ b/test/DynamicDependency/data/Framework.Widgets/packages.config
@@ -1,5 +1,5 @@
-
+
diff --git a/test/DynamicDependency/data/Microsoft.WindowsAppRuntime.Framework/appxmanifest.xml b/test/DynamicDependency/data/Microsoft.WindowsAppRuntime.Framework/appxmanifest.xml
index 78bcc7dfa4..b187052d45 100644
--- a/test/DynamicDependency/data/Microsoft.WindowsAppRuntime.Framework/appxmanifest.xml
+++ b/test/DynamicDependency/data/Microsoft.WindowsAppRuntime.Framework/appxmanifest.xml
@@ -123,6 +123,13 @@
+
+
+ Microsoft.WindowsAppRuntime.dll
+
+
+
+
Microsoft.WindowsAppRuntime.dll
diff --git a/test/EnvironmentManagerTests/packages.config b/test/EnvironmentManagerTests/packages.config
index dc444ff576..3555306520 100644
--- a/test/EnvironmentManagerTests/packages.config
+++ b/test/EnvironmentManagerTests/packages.config
@@ -2,5 +2,5 @@
-
+
diff --git a/test/LRPTests/packages.config b/test/LRPTests/packages.config
index dc444ff576..3555306520 100644
--- a/test/LRPTests/packages.config
+++ b/test/LRPTests/packages.config
@@ -2,5 +2,5 @@
-
+
diff --git a/test/PackageManager/API/packages.config b/test/PackageManager/API/packages.config
index 3a42804723..73a8c1e82e 100644
--- a/test/PackageManager/API/packages.config
+++ b/test/PackageManager/API/packages.config
@@ -5,6 +5,6 @@
-
+
diff --git a/test/PowerNotifications/packages.config b/test/PowerNotifications/packages.config
index dc444ff576..3555306520 100644
--- a/test/PowerNotifications/packages.config
+++ b/test/PowerNotifications/packages.config
@@ -2,5 +2,5 @@
-
+
diff --git a/test/PushNotificationTests/packages.config b/test/PushNotificationTests/packages.config
index dc444ff576..3555306520 100644
--- a/test/PushNotificationTests/packages.config
+++ b/test/PushNotificationTests/packages.config
@@ -2,5 +2,5 @@
-
+
diff --git a/test/TestApps/AccessControlTestApp/packages.config b/test/TestApps/AccessControlTestApp/packages.config
index dc444ff576..3555306520 100644
--- a/test/TestApps/AccessControlTestApp/packages.config
+++ b/test/TestApps/AccessControlTestApp/packages.config
@@ -2,5 +2,5 @@
-
+
diff --git a/test/TestApps/AppLifecycleTestApp/packages.config b/test/TestApps/AppLifecycleTestApp/packages.config
index dc444ff576..3555306520 100644
--- a/test/TestApps/AppLifecycleTestApp/packages.config
+++ b/test/TestApps/AppLifecycleTestApp/packages.config
@@ -2,5 +2,5 @@
-
+
diff --git a/test/TestApps/ManualTestApp/packages.config b/test/TestApps/ManualTestApp/packages.config
index dc444ff576..3555306520 100644
--- a/test/TestApps/ManualTestApp/packages.config
+++ b/test/TestApps/ManualTestApp/packages.config
@@ -2,5 +2,5 @@
-
+
diff --git a/test/TestApps/PushNotificationsDemoApp/packages.config b/test/TestApps/PushNotificationsDemoApp/packages.config
index dc444ff576..3555306520 100644
--- a/test/TestApps/PushNotificationsDemoApp/packages.config
+++ b/test/TestApps/PushNotificationsDemoApp/packages.config
@@ -2,5 +2,5 @@
-
+
diff --git a/test/TestApps/PushNotificationsTestApp/packages.config b/test/TestApps/PushNotificationsTestApp/packages.config
index dc444ff576..3555306520 100644
--- a/test/TestApps/PushNotificationsTestApp/packages.config
+++ b/test/TestApps/PushNotificationsTestApp/packages.config
@@ -2,5 +2,5 @@
-
+
diff --git a/test/TestApps/ToastNotificationsDemoApp/packages.config b/test/TestApps/ToastNotificationsDemoApp/packages.config
index dc444ff576..3555306520 100644
--- a/test/TestApps/ToastNotificationsDemoApp/packages.config
+++ b/test/TestApps/ToastNotificationsDemoApp/packages.config
@@ -2,5 +2,5 @@
-
+
diff --git a/test/TestApps/ToastNotificationsTestApp/packages.config b/test/TestApps/ToastNotificationsTestApp/packages.config
index dc444ff576..3555306520 100644
--- a/test/TestApps/ToastNotificationsTestApp/packages.config
+++ b/test/TestApps/ToastNotificationsTestApp/packages.config
@@ -2,5 +2,5 @@
-
+
diff --git a/test/VersionInfo/packages.config b/test/VersionInfo/packages.config
index dc444ff576..3555306520 100644
--- a/test/VersionInfo/packages.config
+++ b/test/VersionInfo/packages.config
@@ -2,5 +2,5 @@
-
+
diff --git a/test/inc/WindowsAppRuntime.Test.Diagnostics.h b/test/inc/WindowsAppRuntime.Test.Diagnostics.h
index d9097663c4..9d546c3510 100644
--- a/test/inc/WindowsAppRuntime.Test.Diagnostics.h
+++ b/test/inc/WindowsAppRuntime.Test.Diagnostics.h
@@ -13,6 +13,8 @@
#include
#include
+#include
+
namespace Test::Diagnostics
{
inline PCWSTR IntegrityLevelToString(DWORD integrityLevel)
@@ -38,9 +40,7 @@ inline void DumpUser(PCWSTR context, _In_ HANDLE token, PSID userSid)
VERIFY_WIN32_BOOL_SUCCEEDED(ConvertSidToStringSidW(userSid, &userSidAsString));
WEX::Logging::Log::Comment(WEX::Common::String().Format(L"UserSid:%s %s", context, userSidAsString.get()));
- wistd::unique_ptr tokenMandatoryLabel;
- VERIFY_SUCCEEDED(wil::get_token_information_nothrow(tokenMandatoryLabel, token));
- const DWORD integrityLevel{ *GetSidSubAuthority((*tokenMandatoryLabel).Label.Sid, static_cast(static_cast(*GetSidSubAuthorityCount((*tokenMandatoryLabel).Label.Sid) - 1))) };
+ const DWORD integrityLevel{ ::Security::IntegrityLevel::GetIntegrityLevel(token) };
WEX::Logging::Log::Comment(WEX::Common::String().Format(L"IntegrityLevel: 0x%08X (%s)", integrityLevel, IntegrityLevelToString(integrityLevel)));
}
else
diff --git a/tools/ProjectTemplates/dev.cpp.dll.winrt-client-server/packages.config b/tools/ProjectTemplates/dev.cpp.dll.winrt-client-server/packages.config
index cd05427e9c..c6c2f60267 100644
--- a/tools/ProjectTemplates/dev.cpp.dll.winrt-client-server/packages.config
+++ b/tools/ProjectTemplates/dev.cpp.dll.winrt-client-server/packages.config
@@ -4,5 +4,5 @@
-
+
diff --git a/tools/ProjectTemplates/dev.cpp.dll.winrt-client/packages.config b/tools/ProjectTemplates/dev.cpp.dll.winrt-client/packages.config
index cd05427e9c..c6c2f60267 100644
--- a/tools/ProjectTemplates/dev.cpp.dll.winrt-client/packages.config
+++ b/tools/ProjectTemplates/dev.cpp.dll.winrt-client/packages.config
@@ -4,5 +4,5 @@
-
+
diff --git a/tools/ProjectTemplates/dev.cpp.exe+dll.com-oopserver/PurojekutoTenpuret/packages.config b/tools/ProjectTemplates/dev.cpp.exe+dll.com-oopserver/PurojekutoTenpuret/packages.config
index cd05427e9c..c6c2f60267 100644
--- a/tools/ProjectTemplates/dev.cpp.exe+dll.com-oopserver/PurojekutoTenpuret/packages.config
+++ b/tools/ProjectTemplates/dev.cpp.exe+dll.com-oopserver/PurojekutoTenpuret/packages.config
@@ -4,5 +4,5 @@
-
+
diff --git a/tools/ProjectTemplates/dev.cpp.exe.com-oopserver-main/packages.config b/tools/ProjectTemplates/dev.cpp.exe.com-oopserver-main/packages.config
index cd05427e9c..c6c2f60267 100644
--- a/tools/ProjectTemplates/dev.cpp.exe.com-oopserver-main/packages.config
+++ b/tools/ProjectTemplates/dev.cpp.exe.com-oopserver-main/packages.config
@@ -4,5 +4,5 @@
-
+
diff --git a/tools/ProjectTemplates/dev.cpp.exe.console-winrt-client/packages.config b/tools/ProjectTemplates/dev.cpp.exe.console-winrt-client/packages.config
index cd05427e9c..c6c2f60267 100644
--- a/tools/ProjectTemplates/dev.cpp.exe.console-winrt-client/packages.config
+++ b/tools/ProjectTemplates/dev.cpp.exe.console-winrt-client/packages.config
@@ -4,5 +4,5 @@
-
+
diff --git a/tools/ProjectTemplates/dev.cpp.exe.winmain-winrt-client/packages.config b/tools/ProjectTemplates/dev.cpp.exe.winmain-winrt-client/packages.config
index cd05427e9c..c6c2f60267 100644
--- a/tools/ProjectTemplates/dev.cpp.exe.winmain-winrt-client/packages.config
+++ b/tools/ProjectTemplates/dev.cpp.exe.winmain-winrt-client/packages.config
@@ -4,5 +4,5 @@
-
+
diff --git a/tools/ProjectTemplates/test.cpp.dll.taef/packages.config b/tools/ProjectTemplates/test.cpp.dll.taef/packages.config
index 3a041cbe69..79b264f0f7 100644
--- a/tools/ProjectTemplates/test.cpp.dll.taef/packages.config
+++ b/tools/ProjectTemplates/test.cpp.dll.taef/packages.config
@@ -5,5 +5,5 @@
-
+