diff --git a/PowerToys.sln b/PowerToys.sln index 4cd3e110c6..0eeb6aac6f 100644 --- a/PowerToys.sln +++ b/PowerToys.sln @@ -568,6 +568,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FileLocksmithContextMenu", EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FileLocksmithLib", "src\modules\FileLocksmith\FileLocksmithLib\FileLocksmithLib.vcxproj", "{9D52FD25-EF90-4F9A-A015-91EFC5DAF54F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HostsPackageConsumer", "src\modules\Hosts\HostsPackageConsumer\HostsPackageConsumer.csproj", "{02DD46D3-F761-47D9-8894-2D6DA0124650}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM64 = Debug|ARM64 @@ -2494,6 +2496,18 @@ Global {9D52FD25-EF90-4F9A-A015-91EFC5DAF54F}.Release|x64.Build.0 = Release|x64 {9D52FD25-EF90-4F9A-A015-91EFC5DAF54F}.Release|x86.ActiveCfg = Release|x64 {9D52FD25-EF90-4F9A-A015-91EFC5DAF54F}.Release|x86.Build.0 = Release|x64 + {02DD46D3-F761-47D9-8894-2D6DA0124650}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {02DD46D3-F761-47D9-8894-2D6DA0124650}.Debug|ARM64.Build.0 = Debug|ARM64 + {02DD46D3-F761-47D9-8894-2D6DA0124650}.Debug|x64.ActiveCfg = Debug|x64 + {02DD46D3-F761-47D9-8894-2D6DA0124650}.Debug|x64.Build.0 = Debug|x64 + {02DD46D3-F761-47D9-8894-2D6DA0124650}.Debug|x86.ActiveCfg = Debug|x64 + {02DD46D3-F761-47D9-8894-2D6DA0124650}.Debug|x86.Build.0 = Debug|x64 + {02DD46D3-F761-47D9-8894-2D6DA0124650}.Release|ARM64.ActiveCfg = Release|ARM64 + {02DD46D3-F761-47D9-8894-2D6DA0124650}.Release|ARM64.Build.0 = Release|ARM64 + {02DD46D3-F761-47D9-8894-2D6DA0124650}.Release|x64.ActiveCfg = Release|x64 + {02DD46D3-F761-47D9-8894-2D6DA0124650}.Release|x64.Build.0 = Release|x64 + {02DD46D3-F761-47D9-8894-2D6DA0124650}.Release|x86.ActiveCfg = Release|x64 + {02DD46D3-F761-47D9-8894-2D6DA0124650}.Release|x86.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2703,6 +2717,7 @@ Global {0014D652-901F-4456-8D65-06FC5F997FB0} = {4C0D0746-BE5B-49EE-BD5D-A7811628AE8B} {799A50D8-DE89-4ED1-8FF8-AD5A9ED8C0CA} = {AB82E5DD-C32D-4F28-9746-2C780846188E} {9D52FD25-EF90-4F9A-A015-91EFC5DAF54F} = {AB82E5DD-C32D-4F28-9746-2C780846188E} + {02DD46D3-F761-47D9-8894-2D6DA0124650} = {F05E590D-AD46-42BE-9C25-6A63ADD2E3EA} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0} diff --git a/src/modules/Hosts/Hosts.sln b/src/modules/Hosts/Hosts.sln deleted file mode 100644 index 3d0c5ceb81..0000000000 --- a/src/modules/Hosts/Hosts.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.5.002.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hosts", "Hosts\Hosts.csproj", "{7F7A8443-E3D9-42D9-9C3D-2FA433D5510E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hosts.Tests", "Hosts.Tests\Hosts.Tests.csproj", "{8486EE8B-C604-464C-A52D-7D7C9F3CEBCE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7F7A8443-E3D9-42D9-9C3D-2FA433D5510E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7F7A8443-E3D9-42D9-9C3D-2FA433D5510E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7F7A8443-E3D9-42D9-9C3D-2FA433D5510E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7F7A8443-E3D9-42D9-9C3D-2FA433D5510E}.Release|Any CPU.Build.0 = Release|Any CPU - {8486EE8B-C604-464C-A52D-7D7C9F3CEBCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8486EE8B-C604-464C-A52D-7D7C9F3CEBCE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8486EE8B-C604-464C-A52D-7D7C9F3CEBCE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8486EE8B-C604-464C-A52D-7D7C9F3CEBCE}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {A6A11D66-5DBB-403B-92D6-17E1EB7479AA} - EndGlobalSection -EndGlobal diff --git a/src/modules/Hosts/HostsPackageConsumer/Assets/LockScreenLogo.scale-200.png b/src/modules/Hosts/HostsPackageConsumer/Assets/LockScreenLogo.scale-200.png new file mode 100644 index 0000000000..7440f0d4bf Binary files /dev/null and b/src/modules/Hosts/HostsPackageConsumer/Assets/LockScreenLogo.scale-200.png differ diff --git a/src/modules/Hosts/HostsPackageConsumer/Assets/SplashScreen.scale-200.png b/src/modules/Hosts/HostsPackageConsumer/Assets/SplashScreen.scale-200.png new file mode 100644 index 0000000000..32f486a867 Binary files /dev/null and b/src/modules/Hosts/HostsPackageConsumer/Assets/SplashScreen.scale-200.png differ diff --git a/src/modules/Hosts/HostsPackageConsumer/Assets/Square150x150Logo.scale-200.png b/src/modules/Hosts/HostsPackageConsumer/Assets/Square150x150Logo.scale-200.png new file mode 100644 index 0000000000..53ee3777ea Binary files /dev/null and b/src/modules/Hosts/HostsPackageConsumer/Assets/Square150x150Logo.scale-200.png differ diff --git a/src/modules/Hosts/HostsPackageConsumer/Assets/Square44x44Logo.scale-200.png b/src/modules/Hosts/HostsPackageConsumer/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 0000000000..f713bba67f Binary files /dev/null and b/src/modules/Hosts/HostsPackageConsumer/Assets/Square44x44Logo.scale-200.png differ diff --git a/src/modules/Hosts/HostsPackageConsumer/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/src/modules/Hosts/HostsPackageConsumer/Assets/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 0000000000..dc9f5bea0c Binary files /dev/null and b/src/modules/Hosts/HostsPackageConsumer/Assets/Square44x44Logo.targetsize-24_altform-unplated.png differ diff --git a/src/modules/Hosts/HostsPackageConsumer/Assets/StoreLogo.png b/src/modules/Hosts/HostsPackageConsumer/Assets/StoreLogo.png new file mode 100644 index 0000000000..a4586f26bd Binary files /dev/null and b/src/modules/Hosts/HostsPackageConsumer/Assets/StoreLogo.png differ diff --git a/src/modules/Hosts/HostsPackageConsumer/Assets/Wide310x150Logo.scale-200.png b/src/modules/Hosts/HostsPackageConsumer/Assets/Wide310x150Logo.scale-200.png new file mode 100644 index 0000000000..8b4a5d0dd5 Binary files /dev/null and b/src/modules/Hosts/HostsPackageConsumer/Assets/Wide310x150Logo.scale-200.png differ diff --git a/src/modules/Hosts/HostsPackageConsumer/HostsPackageConsumer - Backup.csproj b/src/modules/Hosts/HostsPackageConsumer/HostsPackageConsumer - Backup.csproj new file mode 100644 index 0000000000..42e78bb072 --- /dev/null +++ b/src/modules/Hosts/HostsPackageConsumer/HostsPackageConsumer - Backup.csproj @@ -0,0 +1,72 @@ + + + WinExe + net8.0-windows10.0.20348.0 + 10.0.19041.0 + 10.0.19041.0 + HostsPackageConsumer + app.manifest + win-x64;win-arm64 + true + true + None + false + false + true + ..\..\..\..\$(Platform)\$(Configuration)\WinUI3Apps + PowerToys.HostsPackageConsumer + DISABLE_XAML_GENERATED_MAIN,TRACE + true + + PowerToys.HostsPackageConsumer.pri + + + + + + + + + + + + win-x64 + + + win-arm64 + + + + + + + + + + + + + + + + + + + + + + + + + + true + + diff --git a/src/modules/Hosts/HostsPackageConsumer/HostsPackageConsumer.csproj b/src/modules/Hosts/HostsPackageConsumer/HostsPackageConsumer.csproj new file mode 100644 index 0000000000..c691e66a80 --- /dev/null +++ b/src/modules/Hosts/HostsPackageConsumer/HostsPackageConsumer.csproj @@ -0,0 +1,71 @@ + + + WinExe + net8.0-windows10.0.20348.0 + 10.0.19041.0 + 10.0.19041.0 + HostsPackageConsumer + app.manifest + win-x64;win-arm64 + true + true + None + false + false + true + ..\..\..\..\$(Platform)\$(Configuration)\WinUI3Apps + PowerToys.HostsPackageConsumer + DISABLE_XAML_GENERATED_MAIN,TRACE + true + + PowerToys.HostsPackageConsumer.pri + + + + + + + + + + + + win-x64 + + + win-arm64 + + + + + + + + + + + + + + + + + + + + + + + + + true + + diff --git a/src/modules/Hosts/HostsPackageConsumer/HostsPackageConsumerXAML/App.xaml b/src/modules/Hosts/HostsPackageConsumer/HostsPackageConsumerXAML/App.xaml new file mode 100644 index 0000000000..630e274c84 --- /dev/null +++ b/src/modules/Hosts/HostsPackageConsumer/HostsPackageConsumerXAML/App.xaml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/src/modules/Hosts/HostsPackageConsumer/HostsPackageConsumerXAML/App.xaml.cs b/src/modules/Hosts/HostsPackageConsumer/HostsPackageConsumerXAML/App.xaml.cs new file mode 100644 index 0000000000..78e2a21c48 --- /dev/null +++ b/src/modules/Hosts/HostsPackageConsumer/HostsPackageConsumerXAML/App.xaml.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.UI.Xaml; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. +namespace HostsPackageConsumer +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + public partial class App : Application + { + /// + /// Initializes a new instance of the class. + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + public App() + { + this.InitializeComponent(); + } + + /// + /// Invoked when the application is launched. + /// + /// Details about the launch request and process. + protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args) + { + window = new MainWindow(); + window.Activate(); + } + + private Window window; + } +} diff --git a/src/modules/Hosts/HostsPackageConsumer/HostsPackageConsumerXAML/MainWindow.xaml b/src/modules/Hosts/HostsPackageConsumer/HostsPackageConsumerXAML/MainWindow.xaml new file mode 100644 index 0000000000..203af153a7 --- /dev/null +++ b/src/modules/Hosts/HostsPackageConsumer/HostsPackageConsumerXAML/MainWindow.xaml @@ -0,0 +1,17 @@ + + + + + + + diff --git a/src/modules/Hosts/HostsPackageConsumer/HostsPackageConsumerXAML/MainWindow.xaml.cs b/src/modules/Hosts/HostsPackageConsumer/HostsPackageConsumerXAML/MainWindow.xaml.cs new file mode 100644 index 0000000000..403894e81a --- /dev/null +++ b/src/modules/Hosts/HostsPackageConsumer/HostsPackageConsumerXAML/MainWindow.xaml.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.UI.Xaml; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. +namespace HostsPackageConsumer +{ + /// + /// An empty window that can be used on its own or navigated to within a Frame. + /// + public sealed partial class MainWindow : Window + { + public MainWindow() + { + this.InitializeComponent(); + } + + private void MyButton_Click(object sender, RoutedEventArgs e) + { + myButton.Content = "Clicked"; + } + } +} diff --git a/src/modules/Hosts/HostsPackageConsumer/Program.cs b/src/modules/Hosts/HostsPackageConsumer/Program.cs new file mode 100644 index 0000000000..a224498219 --- /dev/null +++ b/src/modules/Hosts/HostsPackageConsumer/Program.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Threading; +using Microsoft.UI.Dispatching; +using Microsoft.Windows.AppLifecycle; + +namespace HostsPackageConsumer +{ + public static class Program + { + [STAThread] + public static void Main(string[] args) + { + // Logger.InitializeLogger("\\Hosts\\Logs"); + WinRT.ComWrappersSupport.InitializeComWrappers(); + +// Removed GPO dep +/* + if (PowerToys.GPOWrapper.GPOWrapper.GetConfiguredHostsFileEditorEnabledValue() == PowerToys.GPOWrapper.GpoRuleConfigured.Disabled) + { + Logger.LogWarning("Tried to start with a GPO policy setting the utility to always be disabled. Please contact your systems administrator."); + return; + } +*/ + + var instanceKey = AppInstance.FindOrRegisterForKey("PowerToys_HostsPackageConsumer_Instance"); + + if (instanceKey.IsCurrent) + { + Microsoft.UI.Xaml.Application.Start((p) => + { + var context = new DispatcherQueueSynchronizationContext(DispatcherQueue.GetForCurrentThread()); + SynchronizationContext.SetSynchronizationContext(context); + _ = new App(); + }); + } + else + { + // Logger.LogWarning("Another instance of Hosts running. Exiting Hosts"); + } + + return; + } + } +} diff --git a/src/modules/Hosts/HostsPackageConsumer/app.manifest b/src/modules/Hosts/HostsPackageConsumer/app.manifest new file mode 100644 index 0000000000..cb4bd21238 --- /dev/null +++ b/src/modules/Hosts/HostsPackageConsumer/app.manifest @@ -0,0 +1,22 @@ + + + + + + + + true/PM + PerMonitorV2, PerMonitor + + + + + + + + + \ No newline at end of file