diff --git a/Files.sln b/Files.sln
index 87aeb70599c3c..a5b85f20f1b2d 100644
--- a/Files.sln
+++ b/Files.sln
@@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
+# 17
VisualStudioVersion = 17.1.32421.90
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A74DCE98-A744-4D71-A2B1-7EE4FED0936B}"
@@ -49,7 +49,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Files.App.UITests", "tests\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Files.App.Controls", "src\Files.App.Controls\Files.App.Controls.csproj", "{83FF8729-CC76-43E2-976F-47F0A187FC7E}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Files.App.CsWin32", "src\Files.App.CsWin32\Files.App.CsWin32.csproj", "{4803E2CB-3E27-447D-94FC-45B5F96E4F7A}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Files.App.CsWin32", "src\Files.App.CsWin32\Files.App.CsWin32.csproj", "{4803E2CB-3E27-447D-94FC-45B5F96E4F7A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -367,10 +367,10 @@ Global
{6FA07816-DE0A-4D49-84E8-38E953A33C87}.Debug|x64.Build.0 = Debug|Any CPU
{6FA07816-DE0A-4D49-84E8-38E953A33C87}.Debug|x86.ActiveCfg = Debug|Any CPU
{6FA07816-DE0A-4D49-84E8-38E953A33C87}.Debug|x86.Build.0 = Debug|Any CPU
- {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Preview|arm64.ActiveCfg = Preview|Any CPU
- {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Preview|arm64.Build.0 = Preview|Any CPU
- {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Preview|x64.ActiveCfg = Preview|Any CPU
- {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Preview|x64.Build.0 = Preview|Any CPU
+ {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Preview|arm64.ActiveCfg = Release|Any CPU
+ {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Preview|arm64.Build.0 = Release|Any CPU
+ {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Preview|x64.ActiveCfg = Release|Any CPU
+ {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Preview|x64.Build.0 = Release|Any CPU
{6FA07816-DE0A-4D49-84E8-38E953A33C87}.Preview|x86.ActiveCfg = Preview|Any CPU
{6FA07816-DE0A-4D49-84E8-38E953A33C87}.Preview|x86.Build.0 = Preview|Any CPU
{6FA07816-DE0A-4D49-84E8-38E953A33C87}.Release|arm64.ActiveCfg = Release|Any CPU
@@ -379,18 +379,18 @@ Global
{6FA07816-DE0A-4D49-84E8-38E953A33C87}.Release|x64.Build.0 = Release|Any CPU
{6FA07816-DE0A-4D49-84E8-38E953A33C87}.Release|x86.ActiveCfg = Release|Any CPU
{6FA07816-DE0A-4D49-84E8-38E953A33C87}.Release|x86.Build.0 = Release|Any CPU
- {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Stable|arm64.ActiveCfg = Stable|Any CPU
- {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Stable|arm64.Build.0 = Stable|Any CPU
- {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Stable|x64.ActiveCfg = Stable|Any CPU
- {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Stable|x64.Build.0 = Stable|Any CPU
- {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Stable|x86.ActiveCfg = Stable|Any CPU
- {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Stable|x86.Build.0 = Stable|Any CPU
- {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Store|arm64.ActiveCfg = Store|Any CPU
- {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Store|arm64.Build.0 = Store|Any CPU
- {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Store|x64.ActiveCfg = Store|Any CPU
- {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Store|x64.Build.0 = Store|Any CPU
- {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Store|x86.ActiveCfg = Store|Any CPU
- {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Store|x86.Build.0 = Store|Any CPU
+ {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Stable|arm64.ActiveCfg = Release|Any CPU
+ {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Stable|arm64.Build.0 = Release|Any CPU
+ {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Stable|x64.ActiveCfg = Release|Any CPU
+ {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Stable|x64.Build.0 = Release|Any CPU
+ {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Stable|x86.ActiveCfg = Release|Any CPU
+ {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Stable|x86.Build.0 = Release|Any CPU
+ {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Store|arm64.ActiveCfg = Release|Any CPU
+ {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Store|arm64.Build.0 = Release|Any CPU
+ {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Store|x64.ActiveCfg = Release|Any CPU
+ {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Store|x64.Build.0 = Release|Any CPU
+ {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Store|x86.ActiveCfg = Release|Any CPU
+ {6FA07816-DE0A-4D49-84E8-38E953A33C87}.Store|x86.Build.0 = Release|Any CPU
{1EE996D6-885E-4403-A461-26C7A4E14D26}.Debug|arm64.ActiveCfg = Debug|arm64
{1EE996D6-885E-4403-A461-26C7A4E14D26}.Debug|arm64.Build.0 = Debug|arm64
{1EE996D6-885E-4403-A461-26C7A4E14D26}.Debug|arm64.Deploy.0 = Debug|arm64
@@ -457,56 +457,66 @@ Global
{EBFA367F-CBDB-4CD0-B838-D6B95F61D1F6}.Store|x64.Build.0 = Store|x64
{EBFA367F-CBDB-4CD0-B838-D6B95F61D1F6}.Store|x86.ActiveCfg = Store|Win32
{EBFA367F-CBDB-4CD0-B838-D6B95F61D1F6}.Store|x86.Build.0 = Store|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Debug|arm64.ActiveCfg = Debug|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Debug|arm64.Build.0 = Debug|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Debug|x64.ActiveCfg = Debug|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Debug|x64.Build.0 = Debug|Win32
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Debug|arm64.ActiveCfg = Debug|arm64
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Debug|arm64.Build.0 = Debug|arm64
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Debug|x64.ActiveCfg = Debug|x64
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Debug|x64.Build.0 = Debug|x64
{7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Debug|x86.ActiveCfg = Debug|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Preview|arm64.ActiveCfg = Preview|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Preview|arm64.Build.0 = Preview|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Preview|x64.ActiveCfg = Preview|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Preview|x64.Build.0 = Preview|Win32
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Debug|x86.Build.0 = Debug|Win32
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Preview|arm64.ActiveCfg = Preview|arm64
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Preview|arm64.Build.0 = Preview|arm64
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Preview|x64.ActiveCfg = Preview|x64
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Preview|x64.Build.0 = Preview|x64
{7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Preview|x86.ActiveCfg = Preview|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Release|arm64.ActiveCfg = Release|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Release|arm64.Build.0 = Release|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Release|x64.ActiveCfg = Release|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Release|x64.Build.0 = Release|Win32
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Preview|x86.Build.0 = Preview|Win32
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Release|arm64.ActiveCfg = Release|arm64
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Release|arm64.Build.0 = Release|arm64
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Release|x64.ActiveCfg = Release|x64
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Release|x64.Build.0 = Release|x64
{7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Release|x86.ActiveCfg = Release|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Stable|arm64.ActiveCfg = Stable|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Stable|arm64.Build.0 = Stable|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Stable|x64.ActiveCfg = Stable|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Stable|x64.Build.0 = Stable|Win32
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Release|x86.Build.0 = Release|Win32
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Stable|arm64.ActiveCfg = Stable|arm64
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Stable|arm64.Build.0 = Stable|arm64
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Stable|x64.ActiveCfg = Stable|x64
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Stable|x64.Build.0 = Stable|x64
{7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Stable|x86.ActiveCfg = Stable|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Store|arm64.ActiveCfg = Store|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Store|arm64.Build.0 = Store|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Store|x64.ActiveCfg = Store|Win32
- {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Store|x64.Build.0 = Store|Win32
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Stable|x86.Build.0 = Stable|Win32
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Store|arm64.ActiveCfg = Store|arm64
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Store|arm64.Build.0 = Store|arm64
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Store|x64.ActiveCfg = Store|x64
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Store|x64.Build.0 = Store|x64
{7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Store|x86.ActiveCfg = Store|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Debug|arm64.ActiveCfg = Debug|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Debug|arm64.Build.0 = Debug|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Debug|x64.ActiveCfg = Debug|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Debug|x64.Build.0 = Debug|Win32
+ {7756A1A4-17B5-4E6B-9B12-F19AA868A225}.Store|x86.Build.0 = Store|Win32
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Debug|arm64.ActiveCfg = Debug|arm64
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Debug|arm64.Build.0 = Debug|arm64
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Debug|x64.ActiveCfg = Debug|x64
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Debug|x64.Build.0 = Debug|x64
{B3FE3F3B-CECC-4918-B72B-5488C3774125}.Debug|x86.ActiveCfg = Debug|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Preview|arm64.ActiveCfg = Preview|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Preview|arm64.Build.0 = Preview|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Preview|x64.ActiveCfg = Preview|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Preview|x64.Build.0 = Preview|Win32
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Debug|x86.Build.0 = Debug|Win32
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Preview|arm64.ActiveCfg = Preview|arm64
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Preview|arm64.Build.0 = Preview|arm64
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Preview|x64.ActiveCfg = Preview|x64
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Preview|x64.Build.0 = Preview|x64
{B3FE3F3B-CECC-4918-B72B-5488C3774125}.Preview|x86.ActiveCfg = Preview|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Release|arm64.ActiveCfg = Release|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Release|arm64.Build.0 = Release|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Release|x64.ActiveCfg = Release|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Release|x64.Build.0 = Release|Win32
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Preview|x86.Build.0 = Preview|Win32
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Release|arm64.ActiveCfg = Release|arm64
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Release|arm64.Build.0 = Release|arm64
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Release|x64.ActiveCfg = Release|x64
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Release|x64.Build.0 = Release|x64
{B3FE3F3B-CECC-4918-B72B-5488C3774125}.Release|x86.ActiveCfg = Release|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Stable|arm64.ActiveCfg = Stable|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Stable|arm64.Build.0 = Stable|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Stable|x64.ActiveCfg = Stable|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Stable|x64.Build.0 = Stable|Win32
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Release|x86.Build.0 = Release|Win32
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Stable|arm64.ActiveCfg = Stable|arm64
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Stable|arm64.Build.0 = Stable|arm64
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Stable|x64.ActiveCfg = Stable|x64
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Stable|x64.Build.0 = Stable|x64
{B3FE3F3B-CECC-4918-B72B-5488C3774125}.Stable|x86.ActiveCfg = Stable|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Store|arm64.ActiveCfg = Store|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Store|arm64.Build.0 = Store|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Store|x64.ActiveCfg = Store|Win32
- {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Store|x64.Build.0 = Store|Win32
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Stable|x86.Build.0 = Stable|Win32
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Store|arm64.ActiveCfg = Store|arm64
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Store|arm64.Build.0 = Store|arm64
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Store|x64.ActiveCfg = Store|x64
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Store|x64.Build.0 = Store|x64
{B3FE3F3B-CECC-4918-B72B-5488C3774125}.Store|x86.ActiveCfg = Store|Win32
+ {B3FE3F3B-CECC-4918-B72B-5488C3774125}.Store|x86.Build.0 = Store|Win32
{6F5B1C76-6FA1-49C0-9AF5-672BEDF6900B}.Debug|arm64.ActiveCfg = Debug|arm64
{6F5B1C76-6FA1-49C0-9AF5-672BEDF6900B}.Debug|arm64.Build.0 = Debug|arm64
{6F5B1C76-6FA1-49C0-9AF5-672BEDF6900B}.Debug|arm64.Deploy.0 = Debug|arm64
@@ -553,21 +563,35 @@ Global
{6F5B1C76-6FA1-49C0-9AF5-672BEDF6900B}.Store|x86.Build.0 = Store|x86
{6F5B1C76-6FA1-49C0-9AF5-672BEDF6900B}.Store|x86.Deploy.0 = Store|x86
{83FF8729-CC76-43E2-976F-47F0A187FC7E}.Debug|arm64.ActiveCfg = Debug|arm64
+ {83FF8729-CC76-43E2-976F-47F0A187FC7E}.Debug|arm64.Build.0 = Debug|arm64
{83FF8729-CC76-43E2-976F-47F0A187FC7E}.Debug|x64.ActiveCfg = Debug|x64
{83FF8729-CC76-43E2-976F-47F0A187FC7E}.Debug|x64.Build.0 = Debug|x64
{83FF8729-CC76-43E2-976F-47F0A187FC7E}.Debug|x86.ActiveCfg = Debug|x86
+ {83FF8729-CC76-43E2-976F-47F0A187FC7E}.Debug|x86.Build.0 = Debug|x86
{83FF8729-CC76-43E2-976F-47F0A187FC7E}.Preview|arm64.ActiveCfg = Preview|arm64
+ {83FF8729-CC76-43E2-976F-47F0A187FC7E}.Preview|arm64.Build.0 = Preview|arm64
{83FF8729-CC76-43E2-976F-47F0A187FC7E}.Preview|x64.ActiveCfg = Preview|x64
+ {83FF8729-CC76-43E2-976F-47F0A187FC7E}.Preview|x64.Build.0 = Preview|x64
{83FF8729-CC76-43E2-976F-47F0A187FC7E}.Preview|x86.ActiveCfg = Preview|x86
+ {83FF8729-CC76-43E2-976F-47F0A187FC7E}.Preview|x86.Build.0 = Preview|x86
{83FF8729-CC76-43E2-976F-47F0A187FC7E}.Release|arm64.ActiveCfg = Release|arm64
+ {83FF8729-CC76-43E2-976F-47F0A187FC7E}.Release|arm64.Build.0 = Release|arm64
{83FF8729-CC76-43E2-976F-47F0A187FC7E}.Release|x64.ActiveCfg = Release|x64
+ {83FF8729-CC76-43E2-976F-47F0A187FC7E}.Release|x64.Build.0 = Release|x64
{83FF8729-CC76-43E2-976F-47F0A187FC7E}.Release|x86.ActiveCfg = Release|x86
+ {83FF8729-CC76-43E2-976F-47F0A187FC7E}.Release|x86.Build.0 = Release|x86
{83FF8729-CC76-43E2-976F-47F0A187FC7E}.Stable|arm64.ActiveCfg = Stable|arm64
+ {83FF8729-CC76-43E2-976F-47F0A187FC7E}.Stable|arm64.Build.0 = Stable|arm64
{83FF8729-CC76-43E2-976F-47F0A187FC7E}.Stable|x64.ActiveCfg = Stable|x64
+ {83FF8729-CC76-43E2-976F-47F0A187FC7E}.Stable|x64.Build.0 = Stable|x64
{83FF8729-CC76-43E2-976F-47F0A187FC7E}.Stable|x86.ActiveCfg = Stable|x86
+ {83FF8729-CC76-43E2-976F-47F0A187FC7E}.Stable|x86.Build.0 = Stable|x86
{83FF8729-CC76-43E2-976F-47F0A187FC7E}.Store|arm64.ActiveCfg = Store|arm64
+ {83FF8729-CC76-43E2-976F-47F0A187FC7E}.Store|arm64.Build.0 = Store|arm64
{83FF8729-CC76-43E2-976F-47F0A187FC7E}.Store|x64.ActiveCfg = Store|x64
+ {83FF8729-CC76-43E2-976F-47F0A187FC7E}.Store|x64.Build.0 = Store|x64
{83FF8729-CC76-43E2-976F-47F0A187FC7E}.Store|x86.ActiveCfg = Store|x86
+ {83FF8729-CC76-43E2-976F-47F0A187FC7E}.Store|x86.Build.0 = Store|x86
{4803E2CB-3E27-447D-94FC-45B5F96E4F7A}.Debug|arm64.ActiveCfg = Debug|arm64
{4803E2CB-3E27-447D-94FC-45B5F96E4F7A}.Debug|arm64.Build.0 = Debug|arm64
{4803E2CB-3E27-447D-94FC-45B5F96E4F7A}.Debug|x64.ActiveCfg = Debug|x64
@@ -626,4 +650,4 @@ Global
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0E62043C-A7A1-4982-9EC9-4CDB2939B776}
EndGlobalSection
-EndGlobal
\ No newline at end of file
+EndGlobal
diff --git a/global.json b/global.json
index 62a1920fd79de..d0c27abb4cf8d 100644
--- a/global.json
+++ b/global.json
@@ -1,5 +1,7 @@
{
"sdk": {
- "version": "8.0.303"
+ "version": "8.0.303",
+ "rollForward": "latestMajor",
+ "allowPrerelease": true
}
}
diff --git a/src/Files.App.Controls/Files.App.Controls.csproj b/src/Files.App.Controls/Files.App.Controls.csproj
index 239f3590a373d..f70c1894aa685 100644
--- a/src/Files.App.Controls/Files.App.Controls.csproj
+++ b/src/Files.App.Controls/Files.App.Controls.csproj
@@ -20,6 +20,7 @@
+
diff --git a/src/Files.App.CsWin32/Files.App.CsWin32.csproj b/src/Files.App.CsWin32/Files.App.CsWin32.csproj
index 096cca9f71505..a7ca80f9a1db5 100644
--- a/src/Files.App.CsWin32/Files.App.CsWin32.csproj
+++ b/src/Files.App.CsWin32/Files.App.CsWin32.csproj
@@ -4,6 +4,7 @@
net8.0-windows10.0.22621.0
10.0.19041.0
+ 10.0.22621.42
enable
true
Debug;Release;Stable;Preview;Store
diff --git a/src/Files.App.Server/Files.App.Server.csproj b/src/Files.App.Server/Files.App.Server.csproj
index 9dcb2fb377478..ba70ca2c0410d 100644
--- a/src/Files.App.Server/Files.App.Server.csproj
+++ b/src/Files.App.Server/Files.App.Server.csproj
@@ -7,6 +7,7 @@
Language=en-US;af;ar;be-BY;bg;ca;cs-CZ;da;de-DE;el;en-GB;es-ES;es-419;fa-IR;fi-FI;fil-PH;fr-FR;he-IL;hi-IN;hr-HR;hu-HU;id-ID;it-IT;ja-JP;ka;km-KH;ko-KR;lt-LT;lv-LV;ms-MY;nb-NO;nl-NL;pl-PL;pt-BR;pt-PT;ro-RO;ru-RU;sk-SK;sq-AL;sr-Cyrl;sv-SE;ta;th-TH;tr-TR;uk-UA;vi;zh-Hans;zh-Hant
net8.0-windows10.0.22621.0
10.0.19041.0
+ 10.0.22621.42
enable
enable
Debug;Release;Stable;Preview;Store
diff --git a/src/Files.App.Storage/Files.App.Storage.csproj b/src/Files.App.Storage/Files.App.Storage.csproj
index c08d08cbe3f06..ba0695bc4df8e 100644
--- a/src/Files.App.Storage/Files.App.Storage.csproj
+++ b/src/Files.App.Storage/Files.App.Storage.csproj
@@ -9,6 +9,7 @@
Debug;Release;Stable;Preview;Store
x86;x64;arm64
win-x86;win-x64;win-arm64
+ 10.0.22621.42
@@ -23,6 +24,10 @@
true
+
+
+
+
diff --git a/src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs b/src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs
index 092e07a69af46..d2b417786bce1 100644
--- a/src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs
+++ b/src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs
@@ -465,7 +465,7 @@ public static partial bool IsElevationRequired(
[MarshalAs(UnmanagedType.LPWStr)] string pszPath);
[DllImport("shlwapi.dll", CallingConvention = CallingConvention.StdCall, PreserveSig = true, CharSet = CharSet.Unicode)]
- public static extern HRESULT SHCreateStreamOnFileEx(
+ public static extern int SHCreateStreamOnFileEx(
string pszFile,
STGM grfMode,
uint dwAttributes,
@@ -475,7 +475,7 @@ out IntPtr ppstm
);
[DllImport("shell32.dll", CallingConvention = CallingConvention.StdCall, PreserveSig = true, CharSet = CharSet.Unicode)]
- public static extern HRESULT SHCreateItemFromParsingName(
+ public static extern int SHCreateItemFromParsingName(
string pszPath,
IntPtr pbc,
ref Guid riid,
@@ -483,7 +483,7 @@ out IntPtr ppv
);
[DllImport("ole32.dll", CallingConvention = CallingConvention.StdCall)]
- public static extern HRESULT CoCreateInstance(
+ public static extern int CoCreateInstance(
ref Guid rclsid,
IntPtr pUnkOuter,
ClassContext dwClsContext,
diff --git a/src/Files.App/Utils/Shell/PreviewHandler.cs b/src/Files.App/Utils/Shell/PreviewHandler.cs
index 6cb5f40017981..c0b054cb51755 100644
--- a/src/Files.App/Utils/Shell/PreviewHandler.cs
+++ b/src/Files.App/Utils/Shell/PreviewHandler.cs
@@ -1,7 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Runtime.InteropServices.ComTypes;
+using System.Runtime.InteropServices;
+using System.Runtime.InteropServices.Marshalling;
using Vanara.PInvoke;
using Windows.UI;
@@ -10,8 +8,22 @@ namespace Files.App.Utils.Shell
///
/// Credits: https://github.com/GeeLaw/PreviewHost/
///
- public sealed class PreviewHandler : IDisposable
+ public sealed partial class PreviewHandler : IDisposable
{
+ const int S_OK = 0;
+ const int S_FALSE = 1;
+ const int E_FAIL = unchecked((int)0x80004005);
+ const int E_SERVER_EXEC_FAILURE = unchecked((int)0x80080005);
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct RECT(int left, int top, int right, int bottom)
+ {
+ public int Left = left;
+ public int Top = top;
+ public int Right = right;
+ public int Bottom = bottom;
+ }
+
#region IPreviewHandlerFrame support
[StructLayout(LayoutKind.Sequential)]
@@ -21,16 +33,17 @@ public struct PreviewHandlerFrameInfo
public uint AcceleratorEntryCount;
}
- [ComImport, Guid("fec87aaf-35f9-447a-adb7-20234491401a"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- public interface IPreviewHandlerFrame
+ [GeneratedComInterface, Guid("fec87aaf-35f9-447a-adb7-20234491401a"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public partial interface IPreviewHandlerFrame
{
[PreserveSig]
- HRESULT GetWindowContext(out PreviewHandlerFrameInfo pinfo);
+ int GetWindowContext(out PreviewHandlerFrameInfo pinfo);
[PreserveSig]
- HRESULT TranslateAccelerator(ref MSG pmsg);
+ int TranslateAccelerator(nint pmsg);
}
- public sealed class PreviewHandlerFrame : IPreviewHandlerFrame, IDisposable
+ [GeneratedComClass]
+ public sealed partial class PreviewHandlerFrame : IPreviewHandlerFrame, IDisposable
{
bool disposed;
nint hwnd;
@@ -47,20 +60,20 @@ public void Dispose()
disposed = true;
}
- public HRESULT GetWindowContext(out PreviewHandlerFrameInfo pinfo)
+ public int GetWindowContext(out PreviewHandlerFrameInfo pinfo)
{
pinfo.AcceleratorTableHandle = IntPtr.Zero;
pinfo.AcceleratorEntryCount = 0;
if (disposed)
- return HRESULT.E_FAIL;
- return HRESULT.S_OK;
+ return E_FAIL;
+ return S_OK;
}
- public HRESULT TranslateAccelerator(ref MSG pmsg)
+ public int TranslateAccelerator(nint pmsg)
{
if (disposed)
- return HRESULT.E_FAIL;
- return HRESULT.S_FALSE;
+ return E_FAIL;
+ return S_FALSE;
}
}
@@ -68,33 +81,33 @@ public HRESULT TranslateAccelerator(ref MSG pmsg)
#region IPreviewHandler major interfaces
- [ComImport, Guid("8895b1c6-b41f-4c1c-a562-0d564250836f"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- interface IPreviewHandler
+ [GeneratedComInterface, Guid("8895b1c6-b41f-4c1c-a562-0d564250836f"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal partial interface IPreviewHandler
{
[PreserveSig]
- HRESULT SetWindow(IntPtr hwnd, ref RECT prc);
+ int SetWindow(nint hwnd, in RECT prc);
[PreserveSig]
- HRESULT SetRect(ref RECT prc);
+ int SetRect(in RECT prc);
[PreserveSig]
- HRESULT DoPreview();
+ int DoPreview();
[PreserveSig]
- HRESULT Unload();
+ int Unload();
[PreserveSig]
- HRESULT SetFocus();
+ int SetFocus();
[PreserveSig]
- HRESULT QueryFocus(out IntPtr phwnd);
+ int QueryFocus(out nint phwnd);
// TranslateAccelerator is not used here.
}
- [ComImport, Guid("196bf9a5-b346-4ef0-aa1e-5dcdb76768b1"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- interface IPreviewHandlerVisuals
+ [GeneratedComInterface, Guid("196bf9a5-b346-4ef0-aa1e-5dcdb76768b1"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal partial interface IPreviewHandlerVisuals
{
[PreserveSig]
- HRESULT SetBackgroundColor(uint color);
+ int SetBackgroundColor(uint color);
[PreserveSig]
- HRESULT SetFont(ref LOGFONT plf);
+ int SetFont(nint plf);
[PreserveSig]
- HRESULT SetTextColor(uint color);
+ int SetTextColor(uint color);
}
static uint ColorRefFromColor(Color color)
@@ -102,11 +115,11 @@ static uint ColorRefFromColor(Color color)
return (((uint)color.B) << 16) | (((uint)color.G) << 8) | ((uint)color.R);
}
- [ComImport, Guid("fc4801a3-2ba9-11cf-a229-00aa003d7352"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- interface IObjectWithSite
+ [GeneratedComInterface, Guid("fc4801a3-2ba9-11cf-a229-00aa003d7352"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal partial interface IObjectWithSite
{
[PreserveSig]
- HRESULT SetSite([In, MarshalAs(UnmanagedType.IUnknown)] object pUnkSite);
+ int SetSite(nint pUnkSite);
// GetSite is not used.
}
@@ -115,11 +128,11 @@ interface IObjectWithSite
bool disposed;
bool init;
bool shown;
- PreviewHandlerFrame comSite;
+ PreviewHandlerFrame? comSite;
nint hwnd;
- IPreviewHandler previewHandler;
- IPreviewHandlerVisuals visuals;
- IntPtr pPreviewHandler;
+ IPreviewHandler? previewHandler;
+ IPreviewHandlerVisuals? visuals;
+ readonly ComWrappers comWrappers = new StrategyBasedComWrappers();
public PreviewHandler(Guid clsid, nint frame)
{
@@ -135,12 +148,7 @@ public PreviewHandler(Guid clsid, nint frame)
}
catch
{
- if (previewHandler != null)
- Marshal.ReleaseComObject(previewHandler);
previewHandler = null;
- if (pPreviewHandler != IntPtr.Zero)
- Marshal.Release(pPreviewHandler);
- pPreviewHandler = IntPtr.Zero;
comSite.Dispose();
comSite = null;
throw;
@@ -160,65 +168,80 @@ void SetupHandler(Guid clsid)
// If we use Activator.CreateInstance(Type.GetTypeFromCLSID(...)),
// CLR will allow in-process server, which defeats isolation and
// creates strange bugs.
- HRESULT hr = Win32PInvoke.CoCreateInstance(ref clsid, IntPtr.Zero, Win32PInvoke.ClassContext.LocalServer, ref iid, out pph);
+ int hr = Win32PInvoke.CoCreateInstance(ref clsid, IntPtr.Zero, Win32PInvoke.ClassContext.LocalServer, ref iid, out pph);
// See https://blogs.msdn.microsoft.com/adioltean/2005/06/24/when-cocreateinstance-returns-0x80080005-co_e_server_exec_failure/
// CO_E_SERVER_EXEC_FAILURE also tends to happen when debugging in Visual Studio.
// Moreover, to create the instance in a server at low integrity level, we need
// to use another thread with low mandatory label. We keep it simple by creating
// a same-integrity object.
- //if (hr == HRESULT.CO_E_SERVER_EXEC_FAILURE)
- // hr = CoCreateInstance(ref clsid, IntPtr.Zero, ClassContext.LocalServer, ref iid, out pph);
- if ((int)hr < 0)
- throw new COMException(cannotCreate, (int)hr);
- pPreviewHandler = pph;
- var previewHandlerObject = Marshal.GetUniqueObjectForIUnknown(pph);
+ if (hr == E_SERVER_EXEC_FAILURE)
+ hr = Win32PInvoke.CoCreateInstance(ref clsid, IntPtr.Zero, Win32PInvoke.ClassContext.LocalServer, ref iid, out pph);
+ if (hr < 0)
+ throw new COMException(cannotCreate, hr);
+ var previewHandlerObject = comWrappers.GetOrCreateObjectForComInstance(pph, CreateObjectFlags.UniqueInstance);
previewHandler = previewHandlerObject as IPreviewHandler;
+
if (previewHandler == null)
{
- Marshal.ReleaseComObject(previewHandlerObject);
throw new COMException(cannotCreate);
}
var objectWithSite = previewHandlerObject as IObjectWithSite;
if (objectWithSite == null)
throw new COMException(cannotCast);
- hr = objectWithSite.SetSite(comSite);
- if ((int)hr < 0)
- throw new COMException(cannotSetSite, (int)hr);
+ hr = objectWithSite.SetSite(comWrappers.GetOrCreateComInterfaceForObject(comSite, CreateComInterfaceFlags.None));
+ if (hr < 0)
+ throw new COMException(cannotSetSite, hr);
visuals = previewHandlerObject as IPreviewHandlerVisuals;
}
#region Initialization interfaces
+ [GeneratedComInterface, Guid("0000000c-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public partial interface IStream
+ {
+ // ISequentialStream portion
+ void Read([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1), Out] byte[] pv, int cb, nint pcbRead);
+ void Write([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] byte[] pv, int cb, nint pcbWritten);
- [ComImport, Guid("b824b49d-22ac-4161-ac8a-9916e8fa3f7f"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- interface IInitializeWithStream
+ // IStream portion
+ void Seek(long dlibMove, int dwOrigin, nint plibNewPosition);
+ void SetSize(long libNewSize);
+ void CopyTo(IStream pstm, long cb, nint pcbRead, nint pcbWritten);
+ void Commit(int grfCommitFlags);
+ void Revert();
+ void LockRegion(long libOffset, long cb, int dwLockType);
+ void UnlockRegion(long libOffset, long cb, int dwLockType);
+ }
+
+ [GeneratedComInterface, Guid("b824b49d-22ac-4161-ac8a-9916e8fa3f7f"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal partial interface IInitializeWithStream
{
[PreserveSig]
- HRESULT Initialize(IStream psi, STGM grfMode);
+ int Initialize(IStream psi, STGM grfMode);
}
- [ComImport, Guid("b824b49d-22ac-4161-ac8a-9916e8fa3f7f"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- interface IInitializeWithStreamNative
+ [GeneratedComInterface, Guid("b824b49d-22ac-4161-ac8a-9916e8fa3f7f"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal partial interface IInitializeWithStreamNative
{
[PreserveSig]
- HRESULT Initialize(IntPtr psi, STGM grfMode);
+ int Initialize(IntPtr psi, STGM grfMode);
}
static readonly Guid IInitializeWithStreamIid = Guid.ParseExact("b824b49d-22ac-4161-ac8a-9916e8fa3f7f", "d");
- [ComImport, Guid("b7d14566-0509-4cce-a71f-0a554233bd9b"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- interface IInitializeWithFile
+ [GeneratedComInterface, Guid("b7d14566-0509-4cce-a71f-0a554233bd9b"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal partial interface IInitializeWithFile
{
[PreserveSig]
- HRESULT Initialize([MarshalAs(UnmanagedType.LPWStr)] string pszFilePath, STGM grfMode);
+ int Initialize([MarshalAs(UnmanagedType.LPWStr)] string pszFilePath, STGM grfMode);
}
static readonly Guid IInitializeWithFileIid = Guid.ParseExact("b7d14566-0509-4cce-a71f-0a554233bd9b", "d");
- [ComImport, Guid("7f73be3f-fb79-493c-a6c7-7ee14e245841"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- interface IInitializeWithItem
+ [GeneratedComInterface, Guid("7f73be3f-fb79-493c-a6c7-7ee14e245841"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal partial interface IInitializeWithItem
{
[PreserveSig]
- HRESULT Initialize(IntPtr psi, STGM grfMode);
+ int Initialize(IntPtr psi, STGM grfMode);
}
static readonly Guid IInitializeWithItemIid = Guid.ParseExact("7f73be3f-fb79-493c-a6c7-7ee14e245841", "d");
@@ -243,8 +266,8 @@ public bool InitWithStream(IStream stream, STGM mode)
var hr = iws.Initialize(stream, mode);
if (hr == HRESULT.E_NOTIMPL)
return false;
- if ((int)hr < 0)
- throw new COMException("IInitializeWithStream.Initialize failed.", (int)hr);
+ if (hr < 0)
+ throw new COMException("IInitializeWithStream.Initialize failed.", hr);
init = true;
return true;
}
@@ -269,8 +292,8 @@ public bool InitWithStream(IntPtr pStream, STGM mode)
var hr = iws.Initialize(pStream, mode);
if (hr == HRESULT.E_NOTIMPL)
return false;
- if ((int)hr < 0)
- throw new COMException("IInitializeWithStream.Initialize failed.", (int)hr);
+ if (hr < 0)
+ throw new COMException("IInitializeWithStream.Initialize failed.", hr);
init = true;
return true;
}
@@ -295,8 +318,8 @@ public bool InitWithItem(IntPtr psi, STGM mode)
var hr = iwi.Initialize(psi, mode);
if (hr == HRESULT.E_NOTIMPL)
return false;
- if ((int)hr < 0)
- throw new COMException("IInitializeWithItem.Initialize failed.", (int)hr);
+ if (hr < 0)
+ throw new COMException("IInitializeWithItem.Initialize failed.", hr);
init = true;
return true;
}
@@ -321,8 +344,8 @@ public bool InitWithFile(string path, STGM mode)
var hr = iwf.Initialize(path, mode);
if (hr == HRESULT.E_NOTIMPL)
return false;
- if ((int)hr < 0)
- throw new COMException("IInitializeWithFile.Initialize failed.", (int)hr);
+ if (hr < 0)
+ throw new COMException("IInitializeWithFile.Initialize failed.", hr);
init = true;
return true;
}
@@ -401,7 +424,7 @@ public bool ResetWindow()
if (!init)
return false;
var hr = previewHandler.SetWindow(hwnd, new());
- return (int)hr >= 0;
+ return hr >= 0;
}
///
@@ -414,7 +437,7 @@ public bool ResetBounds(RECT previewerBounds)
if (!init)
return false;
var hr = previewHandler.SetRect(previewerBounds);
- return (int)hr >= 0;
+ return hr >= 0;
}
///
@@ -425,7 +448,7 @@ public bool ResetBounds(RECT previewerBounds)
public bool SetBackground(Color color)
{
var hr = visuals?.SetBackgroundColor(ColorRefFromColor(color));
- return hr.HasValue && (int)hr.Value >= 0;
+ return hr.HasValue && hr.Value >= 0;
}
///
@@ -436,7 +459,7 @@ public bool SetBackground(Color color)
public bool SetForeground(Color color)
{
var hr = visuals?.SetTextColor(ColorRefFromColor(color));
- return hr.HasValue && (int)hr.Value >= 0;
+ return hr.HasValue && hr.Value >= 0;
}
///
@@ -444,10 +467,10 @@ public bool SetForeground(Color color)
///
/// The LogFontW reference.
/// Whether the call succeeds.
- public bool SetFont(ref LOGFONT font)
+ public bool SetFont(nint font)
{
- var hr = visuals?.SetFont(ref font);
- return hr.HasValue && (int)hr.Value >= 0;
+ var hr = visuals?.SetFont(font);
+ return hr.HasValue && hr.Value >= 0;
}
///
@@ -461,7 +484,7 @@ public void DoPreview()
return;
EnsureNotShown();
ResetWindow();
- previewHandler.DoPreview();
+ previewHandler?.DoPreview();
shown = true;
}
@@ -475,35 +498,27 @@ public void Focus()
if (!init)
return;
EnsureShown();
- previewHandler.SetFocus();
+ previewHandler?.SetFocus();
}
///
/// Tells the preview handler to query focus.
///
/// The focused window.
- public IntPtr QueryFocus()
+ public nint QueryFocus()
{
EnsureNotDisposed();
//EnsureInitialized();
if (!init)
return IntPtr.Zero;
EnsureShown();
- IntPtr result;
+ nint result;
var hr = previewHandler.QueryFocus(out result);
- if ((int)hr < 0)
+ if (hr < 0)
return IntPtr.Zero;
return result;
}
- ///
- /// Unloads the preview and disposes the object. This method is idempotent.
- ///
- public void UnloadPreview()
- {
- Dispose(true);
- }
-
void EnsureNotDisposed()
{
if (disposed)
@@ -536,40 +551,21 @@ void EnsureNotShown()
#region IDisposable pattern
- void Dispose(bool disposing)
+ ~PreviewHandler()
+ {
+ Dispose();
+ }
+
+ public void Dispose()
{
if (disposed)
return;
disposed = true;
init = false;
- if (disposing)
- {
- previewHandler.Unload();
- comSite.Dispose();
- Marshal.ReleaseComObject(previewHandler);
- }
- else
- {
- // We're in the finalizer.
- // Field previewHandler might have been finalized at this point.
- // Get a new RCW.
- var phObject = Marshal.GetUniqueObjectForIUnknown(pPreviewHandler);
- var ph = phObject as IPreviewHandler;
- if (ph != null)
- ph.Unload();
- Marshal.ReleaseComObject(phObject);
- }
- Marshal.Release(pPreviewHandler);
- }
- ~PreviewHandler()
- {
- Dispose(false);
- }
+ previewHandler?.Unload();
+ comSite?.Dispose();
- void IDisposable.Dispose()
- {
- Dispose(true);
GC.SuppressFinalize(this);
}
diff --git a/src/Files.App/ViewModels/UserControls/Previews/ShellPreviewViewModel.cs b/src/Files.App/ViewModels/UserControls/Previews/ShellPreviewViewModel.cs
index 1dd27cb8ad031..be665ee3108af 100644
--- a/src/Files.App/ViewModels/UserControls/Previews/ShellPreviewViewModel.cs
+++ b/src/Files.App/ViewModels/UserControls/Previews/ShellPreviewViewModel.cs
@@ -18,12 +18,14 @@
using WinRT;
using static Vanara.PInvoke.ShlwApi;
using static Vanara.PInvoke.User32;
+using System.Runtime.InteropServices.Marshalling;
+
#pragma warning disable CS8305 // Type is for evaluation purposes only and is subject to change or removal in future updates.
namespace Files.App.ViewModels.Previews
{
- public sealed class ShellPreviewViewModel : BasePreviewModel
+ public sealed partial class ShellPreviewViewModel : BasePreviewModel
{
private const string IPreviewHandlerIid = "{8895b1c6-b41f-4c1c-a562-0d564250836f}";
private static readonly Guid QueryAssociationsClsid = new Guid(0xa07034fd, 0x6caa, 0x4954, 0xac, 0x3f, 0x97, 0xa2, 0x72, 0x16, 0xf9, 0x8a);
@@ -35,6 +37,13 @@ public sealed class ShellPreviewViewModel : BasePreviewModel
HWND hwnd = HWND.NULL;
bool isOfficePreview = false;
+ [GeneratedComInterface, Guid("EACDD04C-117E-4E17-88F4-D1B12B0E3D89"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public partial interface IDCompositionTarget
+ {
+ [PreserveSig]
+ int SetRoot(nint visual);
+ }
+
public ShellPreviewViewModel(ListedItem item) : base(item)
{
}
@@ -115,7 +124,7 @@ private nint WndProc(HWND hwnd, uint msg, nint wParam, nint lParam)
{
if (currentHandler is not null)
{
- currentHandler.UnloadPreview();
+ currentHandler.Dispose();
currentHandler = null;
}
}
@@ -192,8 +201,8 @@ private unsafe bool ChildWindowToXaml(nint parent, UIElement presenter)
var compositor = ElementCompositionPreview.GetElementVisual(presenter).Compositor;
outputLink = ContentExternalOutputLink.Create(compositor);
- var target = outputLink.As();
- target.SetRoot(pChildVisual);
+ var target = outputLink.As();
+ target.SetRoot((nint)pChildVisual);
outputLink.PlacementVisual.Size = new(0, 0);
outputLink.PlacementVisual.Scale = new(1/(float)presenter.XamlRoot.RasterizationScale);
@@ -201,8 +210,6 @@ private unsafe bool ChildWindowToXaml(nint parent, UIElement presenter)
pDCompositionDevice->Commit();
- Marshal.ReleaseComObject(target);
- pChildVisual->Release();
pControlSurface->Release();
pDCompositionDevice->Release();
pDXGIDevice->Release();
@@ -225,7 +232,7 @@ public void UnloadPreview()
if (hwnd != HWND.NULL)
DestroyWindow(hwnd);
- //outputLink?.Dispose();
+ outputLink?.Dispose();
outputLink = null;
if (wCls is not null)
diff --git a/src/Files.App/nupkgs/Microsoft.UI.winmd b/src/Files.App/nupkgs/Microsoft.UI.winmd
index 82e094e3e8c40..ce9ff6630baac 100644
Binary files a/src/Files.App/nupkgs/Microsoft.UI.winmd and b/src/Files.App/nupkgs/Microsoft.UI.winmd differ
diff --git a/tests/Files.App.UITests/Files.App.UITests.csproj b/tests/Files.App.UITests/Files.App.UITests.csproj
index 33442132df88f..221b27ab8d588 100644
--- a/tests/Files.App.UITests/Files.App.UITests.csproj
+++ b/tests/Files.App.UITests/Files.App.UITests.csproj
@@ -30,6 +30,7 @@
+