Skip to content

Commit

Permalink
Microsoft.Windows.Storage.ApplicationData (#4057)
Browse files Browse the repository at this point in the history
* Added AddPackageSetOptions. Added tests for AddPackageSetAsync. Fixed bugs

* Fixed typos. Added missing AddPackageAsync in .idl

* Remove dead code

* Update Transport package's manifested inproc servers

* Added new directory

* Added ApplicationData project. Expanded docs. Added missing ApplicationDataCreateDisposition. Added TerminalVelocity support

* Added stub implementations

* Initial implementation

* Implemented ApplicationData

* Tweaked to be smarter about Windows.Storage.ApplicationData's weird limitations

* Fixed ApplicationData.MachinePath to use the right path. Bumped WIL to 1.0.231216.1 (to get access to wil::reg APIs)

* Implemented IsMachinePathSupported()

* Added tests (mostly)

* Fixed machine path test infra (AppDataPaths doesn't work in our scenario)

* Removed method overload per feedback. Added more doc-comments

* More fixes and optimizations

* More test coverage

* Updated MachinePath/etc to only be accessible if a package in the family is registered to the user OR running as SYSTEM

* Removed ClearAllAsync() and ClearMachineAsync(). Use ClearAsync(locality)

* Updated per API Review

* Fixed build error

* Fixed bad merge. Added ApplicationData Projection
  • Loading branch information
DrusTheAxe authored Jun 30, 2024
1 parent 3aebe89 commit f753170
Show file tree
Hide file tree
Showing 84 changed files with 1,971 additions and 66 deletions.
55 changes: 55 additions & 0 deletions WindowsAppRuntime.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions build/CopyFilesToStagingDir.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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\
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
#
Expand Down
4 changes: 4 additions & 0 deletions build/NuSpecs/AppxManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@
<!-- AccessControl -->
<ActivatableClass ActivatableClassId="Microsoft.Windows.Security.AccessControl.SecurityDescriptorHelpers" ThreadingModel="both" />

<!-- ApplicationData -->
<ActivatableClass ActivatableClassId="Microsoft.Windows.Storage.ApplicationData" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Windows.Storage.ApplicationDataContainer" ThreadingModel="both" />

<!-- Environment Manager -->
<ActivatableClass ActivatableClassId="Microsoft.Windows.System.EnvironmentManager" ThreadingModel="both" />

Expand Down
7 changes: 6 additions & 1 deletion build/NuSpecs/WindowsAppSDK-Nuget-Native.WinRt.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
<Implementation Condition="'$(WindowsAppSDKFrameworkPackage)' != 'true'">$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(_WindowsAppSDKFoundationPlatform)\native\Microsoft.WindowsAppRuntime.dll</Implementation>
<IsWinMDFile>true</IsWinMDFile>
</Reference>
<Reference Include="Microsoft.Windows.Storage.winmd">
<HintPath>$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.Storage.winmd</HintPath>
<Implementation Condition="'$(WindowsAppSDKFrameworkPackage)' != 'true'">$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(_WindowsAppSDKFoundationPlatform)\native\Microsoft.WindowsAppRuntime.dll</Implementation>
<IsWinMDFile>true</IsWinMDFile>
</Reference>
<Reference Include="Microsoft.Windows.System.Power.winmd">
<HintPath>$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.System.Power.winmd</HintPath>
<Implementation Condition="'$(WindowsAppSDKFrameworkPackage)' != 'true'">$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(_WindowsAppSDKFoundationPlatform)\native\Microsoft.WindowsAppRuntime.dll</Implementation>
Expand All @@ -36,7 +41,7 @@
<IsWinMDFile>true</IsWinMDFile>
</Reference>
<!-- conditionally include experimental metadata -->
<Reference Include="Microsoft.Windows.System.winmd"
<Reference Include="Microsoft.Windows.System.winmd"
Condition="Exists('$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.System.winmd')">
<HintPath>$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.System.winmd</HintPath>
<Implementation Condition="'$(WindowsAppSDKFrameworkPackage)' != 'true'">$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(_WindowsAppSDKFoundationPlatform)\native\Microsoft.WindowsAppRuntime.dll</Implementation>
Expand Down
7 changes: 7 additions & 0 deletions build/NuSpecs/WindowsAppSDK-Nuget-Native.targets
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
</Reference>
</ItemGroup>

<ItemGroup>
<Reference Include="$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.Storage.winmd">
<Private>false</Private>
<Implementation>Microsoft.WindowsAppRuntime.dll</Implementation>
</Reference>
</ItemGroup>

<ItemGroup>
<Reference Include="$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.System.Power.winmd">
<Private>false</Private>
Expand Down
2 changes: 1 addition & 1 deletion dev/AppNotifications/AppNotificationUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit f753170

Please sign in to comment.