From 212ea2de30d69dbbfebf86c9d3604008d2272346 Mon Sep 17 00:00:00 2001 From: Andrey Nekrasov Date: Tue, 15 Dec 2020 15:16:09 +0300 Subject: [PATCH] common: refactor common library pt2 (#8588) - remove common lib - split settings, remove common-md - move ipc interop/kb_layout to interop - rename core -> settings, settings -> old_settings - os-detect header-only; interop -> PowerToysInterop - split notifications, move single-use headers where they're used - winstore lib - rename com utils - rename Updating and Telemetry projects - rename core -> settings-ui and remove examples folder - rename settings-ui folder + consisent common/version include --- .github/actions/spell-check/expect.txt | 46 +- src/Cpp.Build.props => Cpp.Build.props | 0 ...ctory.Build.props => Directory.Build.props | 0 PowerToys.sln | 230 ++-- doc/devdocs/guidance.md | 2 - .../PowerToysBootstrapper.sln | 34 +- .../bootstrapper}/RcResource.cpp | 0 .../bootstrapper}/RcResource.h | 0 .../bootstrapper/bootstrapper.base.rc | 2 +- .../bootstrapper/bootstrapper.cpp | 15 +- .../bootstrapper/bootstrapper.vcxproj | 4 +- .../bootstrapper/progressbar_window.cpp | 3 +- installer/PowerToysSetup/Product.wxs | 30 +- installer/PowerToysSetup/publish.cmd | 4 +- .../PowerToysSetupCustomActions.vcxproj | 16 +- src/action_runner/action_runner.base.rc | 2 +- src/action_runner/action_runner.cpp | 7 +- src/action_runner/action_runner.vcxproj | 10 +- .../{comUtils.cpp => COMUtils/COMUtils.cpp} | 26 +- .../{comUtils.h => COMUtils/COMUtils.h} | 0 src/common/COMUtils/COMUtils.vcxproj | 47 + .../packages.config | 0 src/common/Display/Display.vcxproj | 44 + src/common/{ => Display}/dpi_aware.cpp | 4 +- src/common/{ => Display}/dpi_aware.h | 4 +- src/common/{ => Display}/monitors.cpp | 5 +- src/common/{ => Display}/monitors.h | 0 src/common/ManagedCommon/ManagedCommon.csproj | 2 +- ...lemetry.csproj => ManagedTelemetry.csproj} | 80 +- src/common/SettingsAPI/SetttingsAPI.vcxproj | 54 + src/common/SettingsAPI/pch.cpp | 1 + src/common/SettingsAPI/pch.h | 11 + .../{ => SettingsAPI}/settings_helpers.cpp | 2 - .../{ => SettingsAPI}/settings_helpers.h | 2 +- .../{ => SettingsAPI}/settings_objects.cpp | 1 - .../{ => SettingsAPI}/settings_objects.h | 2 +- src/common/Themes/Themes.vcxproj | 57 + src/common/{ => Themes}/icon_helpers.cpp | 180 +-- src/common/{ => Themes}/icon_helpers.h | 10 +- .../packages.config | 0 src/common/{ => Themes}/windows_colors.cpp | 1 - src/common/{ => Themes}/windows_colors.h | 2 + .../UnitTests-CommonLib/Settings.Tests.cpp | 4 +- .../UnitTests-CommonLib.rc | 2 +- .../UnitTests-CommonLib.vcxproj | 13 +- .../UnitTests-CommonLib.vcxproj.filters | 3 - .../UnitTests-CommonLib/UnitTestsCommon.cpp | 57 - .../UnitTestsVersionHelper.cpp | 2 +- src/common/WinStore/Winstore.vcxproj | 55 + src/common/{ => WinStore}/packages.config | 1 - src/common/{ => WinStore}/winstore.cpp | 4 +- src/common/{ => WinStore}/winstore.h | 2 + .../common-md-flag.vcxproj.filters | 60 - src/common/common.cpp | 638 ---------- src/common/common.h | 99 -- src/common/common.vcxproj | 140 --- src/common/common.vcxproj.filters | 217 ---- .../{ => hooks}/LowlevelKeyboardEvent.h | 0 src/common/{ => hooks}/WinHookEvent.h | 0 src/common/interop/KeyboardHook.cpp | 6 +- ...terop.vcxproj => PowerToysInterop.vcxproj} | 233 ++-- ...lters => PowerToysInterop.vcxproj.filters} | 116 +- .../{ => interop}/async_message_queue.h | 0 .../interop-tests/InteropTests.cs | 0 .../Microsoft.Interop.Tests.csproj | 8 +- src/common/interop/interop.h | 29 +- src/common/interop/interop.rc | 2 +- src/common/{ => interop}/keyboard_layout.cpp | 0 src/common/{ => interop}/keyboard_layout.h | 40 +- .../{ => interop}/keyboard_layout_impl.h | 0 src/common/{ => interop}/shared_constants.h | 9 +- .../two_way_pipe_message_ipc.cpp | 3 +- .../{ => interop}/two_way_pipe_message_ipc.h | 4 +- .../two_way_pipe_message_ipc_impl.h | 0 src/common/json.cpp | 32 - src/common/logger/logger.vcxproj | 5 +- .../BackgroundActivator.vcxproj} | 12 +- .../BackgroundActivator.vcxproj.filters} | 0 .../BackgroundHandler.cpp | 2 +- .../BackgroundActivator}/BackgroundHandler.h | 4 +- .../BackgroundHandler.idl | 2 +- .../handler_functions.cpp | 0 .../BackgroundActivator}/handler_functions.h | 0 .../BackgroundActivator/packages.config | 4 + .../BackgroundActivator}/pch.cpp | 0 .../BackgroundActivator}/pch.h | 0 .../BackgroundActivator.def} | 0 .../BackgroundActivator.rc} | 2 +- .../BackgroundActivator.vcxproj.filters} | 0 .../BackgroundActivatorDLL.vcxproj} | 18 +- .../{ => BackgroundActivatorDLL}/cpp.hint | 0 .../{ => BackgroundActivatorDLL}/dllmain.cpp | 0 .../{ => BackgroundActivatorDLL}/framework.h | 0 .../BackgroundActivatorDLL/packages.config | 4 + .../BackgroundActivatorDLL}/pch.cpp | 0 .../BackgroundActivatorDLL/pch.h | 8 + .../{ => BackgroundActivatorDLL}/resource.h | 2 +- .../dont_show_again.cpp} | 2 +- .../dont_show_again.h} | 2 +- .../{ => notifications}/notifications.cpp | 23 +- .../{ => notifications}/notifications.h | 0 .../notifications.vcxproj} | 135 +- src/common/notifications/packages.config | 1 + src/common/notifications/pch.cpp | 6 +- src/common/notifications/pch.h | 10 +- src/common/os-detect.h | 3 - src/common/pch.cpp | 1 - src/common/pch.h | 21 - src/common/updating/dotnet_installation.cpp | 7 +- src/common/updating/installer.cpp | 15 +- src/common/updating/installer.h | 2 +- src/common/updating/notifications.cpp | 6 +- src/common/updating/packages.config | 1 + src/common/updating/pch.h | 12 +- src/common/updating/updating.cpp | 18 +- src/common/updating/updating.h | 2 +- src/common/updating/updating.vcxproj | 25 +- src/common/updating/updating.vcxproj.filters | 3 + src/common/{ => utils}/appMutex.h | 0 src/common/{ => utils}/com_object_factory.h | 1 + src/common/utils/elevation.h | 271 +++++ src/common/utils/exec.h | 100 ++ src/common/{ => utils}/json.h | 26 +- .../{os-detect.cpp => utils/os-detect.h} | 21 +- src/common/{ => utils}/processApi.h | 0 src/common/utils/process_path.h | 101 ++ src/common/utils/resources.h | 23 + src/common/{ => utils}/string_utils.h | 0 src/common/{ => utils}/timeutil.h | 0 src/common/utils/winapi_error.h | 44 + src/common/utils/window.h | 59 + .../{VersionHelper.cpp => version/helper.cpp} | 5 +- .../{VersionHelper.h => version/helper.h} | 0 src/common/{ => version}/version.cpp | 3 +- src/common/{ => version}/version.h | 13 +- src/common/version/version.vcxproj | 47 + src/common/window_helpers.cpp | 60 - src/common/window_helpers.h | 7 - src/logging/logging.vcxproj | 4 +- .../ColorPicker/ColorPicker.base.rc | 2 +- .../ColorPicker/ColorPicker.vcxproj | 8 +- .../ColorPicker/ColorPicker.vcxproj.filters | 3 + .../colorPicker/ColorPicker/dllmain.cpp | 10 +- src/modules/colorPicker/ColorPicker/pch.h | 1 - .../ColorPickerUI/ColorPickerUI.csproj | 4 +- .../UnitTest-ColorPickerUI.csproj | 2 +- .../fancyzones/dll/FancyZonesModule.vcxproj | 6 +- .../dll/FancyZonesModule.vcxproj.filters | 4 +- src/modules/fancyzones/dll/dllmain.cpp | 11 +- src/modules/fancyzones/lib/FancyZones.cpp | 23 +- src/modules/fancyzones/lib/FancyZones.h | 2 +- src/modules/fancyzones/lib/FancyZonesData.cpp | 4 +- src/modules/fancyzones/lib/FancyZonesData.h | 4 +- .../fancyzones/lib/FancyZonesDataTypes.h | 2 +- .../fancyzones/lib/FancyZonesLib.vcxproj | 9 +- .../lib/FancyZonesLib.vcxproj.filters | 3 + src/modules/fancyzones/lib/JsonHelpers.h | 2 +- .../fancyzones/lib/OnThreadExecutor.cpp} | 0 src/modules/fancyzones/lib/Settings.cpp | 53 +- src/modules/fancyzones/lib/Settings.h | 4 +- .../fancyzones/lib/WindowMoveHandler.cpp | 12 +- src/modules/fancyzones/lib/Zone.cpp | 4 +- src/modules/fancyzones/lib/ZoneSet.cpp | 2 +- src/modules/fancyzones/lib/ZoneSet.h | 2 +- src/modules/fancyzones/lib/ZoneWindow.cpp | 6 +- src/modules/fancyzones/lib/fancyzones.base.rc | 2 +- .../fancyzones/lib}/on_thread_executor.h | 0 src/modules/fancyzones/lib/util.cpp | 57 +- src/modules/fancyzones/lib/util.h | 52 +- .../UnitTests/FancyZonesSettings.Spec.cpp | 2 +- .../tests/UnitTests/UnitTests-FancyZones.rc | 2 +- .../tests/UnitTests/UnitTests.vcxproj | 5 +- .../tests/UnitTests/ZoneSet.Spec.cpp | 2 +- .../tests/UnitTests/ZoneWindow.Spec.cpp | 1081 +++++++++-------- .../imageresizer/dll/ContextMenuHandler.cpp | 5 +- .../imageresizer/dll/ImageResizerExt.base.rc | 2 +- .../imageresizer/dll/ImageResizerExt.vcxproj | 9 +- .../dll/ImageResizerExt.vcxproj.filters | 3 + src/modules/imageresizer/dll/Settings.cpp | 4 +- src/modules/imageresizer/dll/dllmain.cpp | 6 +- .../imageresizer/ui/ImageResizerUI.csproj | 2 +- .../keyboardmanager/common/Helpers.cpp | 13 +- src/modules/keyboardmanager/common/KeyDelay.h | 2 +- .../common/KeyboardManagerCommon.vcxproj | 13 +- .../KeyboardManagerCommon.vcxproj.filters | 3 + .../common/KeyboardManagerConstants.h | 3 +- .../common/KeyboardManagerState.cpp | 2 +- .../common/KeyboardManagerState.h | 4 +- .../keyboardmanager/common/Shortcut.cpp | 4 +- .../dll/KeyboardEventHandlers.cpp | 2 +- .../dll/KeyboardEventHandlers.h | 2 +- .../dll/KeyboardManager.base.rc | 2 +- .../dll/KeyboardManager.vcxproj | 4 +- src/modules/keyboardmanager/dll/dllmain.cpp | 9 +- .../AppSpecificShortcutRemappingTests.cpp | 4 +- .../test/BufferValidationTests.cpp | 4 +- .../test/KeyboardManagerHelperTests.cpp | 2 +- .../test/KeyboardManagerTest.rc | 2 +- .../test/KeyboardManagerTest.vcxproj | 3 + .../test/LoadingAndSavingRemappingTests.cpp | 2 +- .../keyboardmanager/test/MockedInput.h | 2 +- .../test/OSLevelShortcutRemappingTests.cpp | 2 +- .../keyboardmanager/test/ShortcutTests.cpp | 2 +- .../test/SingleKeyRemappingTests.cpp | 2 +- src/modules/keyboardmanager/test/pch.cpp | 4 - src/modules/keyboardmanager/test/pch.h | 2 +- .../ui/BufferValidationHelpers.cpp | 2 +- src/modules/keyboardmanager/ui/Dialog.cpp | 3 +- .../keyboardmanager/ui/EditKeyboardWindow.cpp | 8 +- .../ui/EditShortcutsWindow.cpp | 6 +- .../keyboardmanager/ui/KeyDropDownControl.cpp | 10 +- .../ui/KeyboardManagerUI.vcxproj | 4 +- .../ui/LoadingAndSavingRemappingHelper.cpp | 2 +- .../keyboardmanager/ui/ShortcutControl.cpp | 14 +- .../ui/SingleKeyRemapControl.cpp | 8 +- src/modules/keyboardmanager/ui/Styles.cpp | 2 +- .../Microsoft.Launcher.base.rc | 2 +- .../Microsoft.Launcher.vcxproj | 10 +- .../launcher/Microsoft.Launcher/dllmain.cpp | 17 +- src/modules/launcher/Microsoft.Launcher/pch.h | 1 - .../Microsoft.Plugin.Folder.csproj | 2 +- .../Microsoft.Plugin.Indexer.csproj | 2 +- .../PowerLauncher.Telemetry.csproj | 2 +- .../PowerLauncher/PowerLauncher.csproj | 4 +- .../launcher/Wox.Plugin/Wox.Plugin.csproj | 2 +- .../powerrename/UWPui/PowerRenameUWPUI.cpp | 6 +- .../powerrename/UWPui/PowerRenameUWPUI.rc | 2 +- .../UWPui/PowerRenameUWPUI.vcxproj | 11 +- .../powerrename/dll/PowerRenameExt.base.rc | 2 +- .../powerrename/dll/PowerRenameExt.cpp | 6 +- .../powerrename/dll/PowerRenameExt.vcxproj | 16 +- src/modules/powerrename/dll/dllmain.cpp | 6 +- src/modules/powerrename/lib/Helpers.h | 1 - .../powerrename/lib/PowerRenameItem.cpp | 14 +- .../powerrename/lib/PowerRenameLib.vcxproj | 9 +- .../powerrename/lib/PowerRenameManager.cpp | 62 +- src/modules/powerrename/lib/Settings.cpp | 67 +- src/modules/powerrename/lib/Settings.h | 2 +- .../powerrename/testapp/PowerRenameTest.cpp | 1 - .../powerrename/testapp/PowerRenameTest.rc | 2 +- .../testapp/PowerRenameTest.vcxproj | 13 +- src/modules/powerrename/ui/PowerRenameUI.cpp | 20 +- .../powerrename/ui/PowerRenameUI.vcxproj | 9 +- .../unittests/PowerRenameLibUnitTests.vcxproj | 11 +- .../unittests/PowerRenameUnitTests.rc | 2 +- .../MarkdownPreviewHandler.csproj | 2 +- .../SvgPreviewHandler.csproj | 2 +- .../SvgThumbnailProvider.csproj | 2 +- src/modules/previewpane/powerpreview/pch.h | 2 +- .../powerpreview/powerpreview.base.rc | 2 +- .../previewpane/powerpreview/powerpreview.cpp | 12 +- .../previewpane/powerpreview/powerpreview.h | 7 +- .../powerpreview/powerpreview.vcxproj | 17 +- .../powerpreview/powerpreview.vcxproj.filters | 1 + .../previewpane/powerpreview/settings.cpp | 3 - .../previewpane/powerpreview/settings.h | 3 +- .../FileExplorerPreviewSettingsTest.cpp | 6 +- .../powerpreviewTest/powerpreviewTest.rc | 2 +- .../powerpreviewTest/powerpreviewTest.vcxproj | 7 +- .../shortcut_guide}/animation.cpp | 0 .../shortcut_guide}/animation.h | 0 src/modules/shortcut_guide/d2d_window.cpp | 2 +- src/modules/shortcut_guide/overlay_window.cpp | 94 +- src/modules/shortcut_guide/overlay_window.h | 9 +- src/modules/shortcut_guide/pch.h | 1 + .../shortcut_guide/shortcut_guide.base.rc | 2 +- src/modules/shortcut_guide/shortcut_guide.cpp | 16 +- src/modules/shortcut_guide/shortcut_guide.h | 2 +- .../shortcut_guide/shortcut_guide.vcxproj | 12 +- .../shortcut_guide.vcxproj.filters | 15 + .../shortcut_guide}/start_visible.cpp | 0 .../shortcut_guide}/start_visible.h | 0 src/modules/shortcut_guide/target_state.cpp | 8 +- .../shortcut_guide}/tasklist_positions.cpp | 0 .../shortcut_guide}/tasklist_positions.h | 0 src/{common => runner}/RestartManagement.cpp | 2 +- src/{common => runner}/RestartManagement.h | 0 src/runner/action_runner_utils.cpp | 4 +- src/runner/centralized_kb_hook.cpp | 5 +- src/runner/general_settings.cpp | 12 +- src/runner/general_settings.h | 2 +- src/runner/main.cpp | 25 +- src/runner/pch.h | 2 +- src/runner/powertoy_module.h | 2 +- src/runner/restart_elevated.cpp | 3 +- src/runner/runner.base.rc | 2 +- src/runner/runner.vcxproj | 19 +- src/runner/runner.vcxproj.filters | 8 +- src/runner/settings_window.cpp | 18 +- src/runner/tray_icon.cpp | 4 +- src/runner/update_state.cpp | 6 +- src/runner/update_utils.cpp | 7 +- .../Directory.Build.targets | 0 .../AppSpecificKeysDataModel.cs | 0 .../BasePTModuleSettings.cs | 0 .../BoolProperty.cs | 0 .../BoolPropertyJsonConverter.cs | 0 .../ColorFormatModel.cs | 0 .../ColorPickerProperties.cs | 0 .../ColorPickerSettings.cs | 0 .../ConfigDefaults.cs | 0 .../CustomAction/CustomActionDataModel.cs | 0 .../CustomAction/CustomNamePolicy.cs | 0 .../CustomAction/ModuleCustomAction.cs | 0 .../CustomAction/SendCustomAction.cs | 0 .../DoubleProperty.cs | 0 .../EnabledModules.cs | 0 .../ColorPickerActivationAction.cs | 0 .../Enumerations/ColorRepresentationType.cs | 0 .../FZConfigProperties.cs | 0 .../FancyZonesSettings.cs | 0 .../FancyZonesSettingsIPCMessage.cs | 0 .../GeneralSettings.cs | 0 .../GeneralSettingsCustomAction.cs | 0 .../GenericProperty`1.cs | 0 .../Helpers/Observable.cs | 0 .../HotkeySettings.cs | 0 .../HotkeySettingsControlHook.cs | 0 .../ISettingsPath.cs | 0 .../ISettingsUtils.cs | 0 .../ImageResizerProperties.cs | 0 .../ImageResizerSettings.cs | 0 .../ImageSize.cs | 0 .../ImagerResizerKeepDateModified.cs | 0 .../ImageresizerCustomSizeProperty.cs | 0 .../ImageresizerFallbackEncoder.cs | 0 .../ImageresizerSizes.cs | 0 .../IntProperty.cs | 0 .../Interfaces/ISettingsConfig.cs | 0 .../Interfaces/ISettingsRepository`1.cs | 0 .../KeyBoardKeysProperty.cs | 0 .../KeyboardManagerProfile.cs | 0 .../KeyboardManagerProperties.cs | 0 .../KeyboardManagerSettings.cs | 0 .../KeysDataModel.cs | 0 ...osoft.PowerToys.Settings.UI.Library.csproj | 4 +- .../OutGoingGeneralSettings.cs | 0 .../PowerLauncherProperties.cs | 0 .../PowerLauncherSettings.cs | 0 .../PowerPreviewProperties.cs | 0 .../PowerPreviewSettings.cs | 0 .../PowerRenameLocalProperties.cs | 0 .../PowerRenameProperties.cs | 0 .../PowerRenameSettings.cs | 0 .../PowerRenameSettingsIPCMessage.cs | 0 .../RemapKeysDataModel.cs | 0 .../SettingPath.cs | 0 .../SettingsRepository`1.cs | 0 .../SettingsUtils.cs | 0 .../ShortcutGuideProperties.cs | 0 .../ShortcutGuideSettings.cs | 0 .../ShortcutGuideSettingsIPCMessage.cs | 0 .../ShortcutsKeyDataModel.cs | 0 .../SndFancyZonesSettings.cs | 0 .../SndImageResizerSettings.cs | 0 .../SndKeyboardManagerSettings.cs | 0 .../SndModuleSettings`1.cs | 0 .../SndPowerPreviewSettings.cs | 0 .../SndPowerRenameSettings.cs | 0 .../SndShortcutGuideSettings.cs | 0 .../StringProperty.cs | 0 .../Telemetry/Events/SettingsBootEvent.cs | 0 .../Telemetry/Events/SettingsEnabledEvent.cs | 0 .../Utilities/Helper.cs | 0 .../Utilities/IIOProvider.cs | 0 .../Utilities/Logger.cs | 0 .../Utilities/NativeMethods.cs | 0 .../Utilities/SystemIOProvider.cs | 0 .../ViewModels/ColorPickerViewModel.cs | 0 .../ViewModels/Commands/ButtonClickCommand.cs | 0 .../ViewModels/Commands/RelayCommand.cs | 0 .../ViewModels/Commands/RelayCommand`1.cs | 0 .../ViewModels/FancyZonesViewModel.cs | 0 .../ViewModels/GeneralViewModel.cs | 0 .../ViewModels/ImageResizerViewModel.cs | 0 .../ViewModels/KeyboardManagerViewModel.cs | 0 .../ViewModels/PowerLauncherViewModel.cs | 0 .../ViewModels/PowerPreviewViewModel.cs | 0 .../ViewModels/PowerRenameViewModel.cs | 0 .../ViewModels/ShortcutGuideViewModel.cs | 0 .../App.xaml | 0 .../App.xaml.cs | 0 .../MainWindow.xaml | 0 .../MainWindow.xaml.cs | 0 ...rosoft.PowerToys.Settings.UI.Runner.csproj | 4 +- .../Program.cs | 0 .../app.manifest | 0 .../icon.ico | Bin .../BackCompatTestProperties.cs | 2 +- .../Microsoft/PowerToys/settings.json | Bin .../PowerToys/ColorPicker/settings.json | 0 .../FancyZones/app-zone-history.json | 0 .../PowerToys/FancyZones/settings.json | 0 .../PowerToys/FancyZones/zones-settings.json | 0 .../PowerToys/File Explorer/settings.json | 0 .../ImageResizer/image-resizer-settings.json | 0 .../PowerToys/ImageResizer/settings.json | 0 .../PowerToys/ImageResizer/sizes.json | 0 .../PowerToys/Keyboard Manager/default.json | 0 .../PowerToys/Keyboard Manager/settings.json | 0 .../PowerRename/power-rename-settings.json | 0 .../PowerRename/power-rename-ui-flags | 0 .../PowerToys/PowerToys Run/settings.json | 0 .../PowerToys/Shortcut Guide/settings.json | 0 .../V0.21.1/Microsoft/PowerToys/settings.json | 0 .../Microsoft/PowerToys/update_state.json | 0 .../PowerToys/ColorPicker/settings.json | 0 .../FancyZones/app-zone-history.json | 0 .../PowerToys/FancyZones/settings.json | 0 .../PowerToys/FancyZones/zones-settings.json | 0 .../PowerToys/File Explorer/settings.json | 0 .../ImageResizer/image-resizer-settings.json | 0 .../PowerToys/ImageResizer/settings.json | 0 .../PowerToys/ImageResizer/sizes.json | 0 .../PowerToys/Keyboard Manager/default.json | 0 .../PowerToys/Keyboard Manager/settings.json | 0 .../PowerRename/power-rename-settings.json | 0 .../PowerRename/power-rename-ui-flags | 0 .../PowerToys/PowerToys Run/settings.json | 0 .../PowerToys/Shortcut Guide/settings.json | 0 .../v0.18.2/Microsoft/PowerToys/settings.json | 0 .../Microsoft/PowerToys/update_state.json | 0 .../FancyZones/app-zone-history.json | 0 .../PowerToys/FancyZones/settings.json | 0 .../PowerToys/FancyZones/zones-settings.json | 0 .../PowerToys/File Explorer/settings.json | 0 .../ImageResizer/image-resizer-settings.json | 0 .../PowerToys/ImageResizer/settings.json | 0 .../PowerToys/ImageResizer/sizes.json | 0 .../PowerToys/Keyboard Manager/default.json | 0 .../PowerToys/Keyboard Manager/settings.json | 0 .../PowerRename/power-rename-settings.json | 0 .../PowerRename/power-rename-ui-flags | 0 .../PowerToys/PowerToys Run/settings.json | 0 .../PowerToys/Shortcut Guide/settings.json | 0 .../v0.19.2/Microsoft/PowerToys/settings.json | 0 .../Microsoft/PowerToys/update_state.json | 0 .../PowerToys/ColorPicker/settings.json | 0 .../FancyZones/app-zone-history.json | 0 .../PowerToys/FancyZones/settings.json | 0 .../PowerToys/FancyZones/zones-settings.json | 0 .../PowerToys/File Explorer/settings.json | 0 .../ImageResizer/image-resizer-settings.json | 0 .../PowerToys/ImageResizer/settings.json | 0 .../PowerToys/ImageResizer/sizes.json | 0 .../PowerToys/Keyboard Manager/default.json | 0 .../PowerToys/Keyboard Manager/settings.json | 0 .../PowerRename/power-rename-settings.json | 0 .../PowerRename/power-rename-ui-flags | 0 .../PowerToys/PowerToys Run/settings.json | 0 .../PowerToys/Shortcut Guide/settings.json | 0 .../v0.20.1/Microsoft/PowerToys/settings.json | 0 .../Microsoft/PowerToys/update_state.json | 0 .../PowerToys/ColorPicker/settings.json | 0 .../FancyZones/app-zone-history.json | 0 .../PowerToys/FancyZones/settings.json | 0 .../PowerToys/FancyZones/zones-settings.json | 0 .../PowerToys/File Explorer/settings.json | 0 .../ImageResizer/image-resizer-settings.json | 0 .../PowerToys/ImageResizer/settings.json | 0 .../PowerToys/ImageResizer/sizes.json | 0 .../PowerToys/Keyboard Manager/default.json | 0 .../PowerToys/Keyboard Manager/settings.json | 0 .../PowerRename/power-rename-settings.json | 0 .../PowerRename/power-rename-ui-flags | 0 .../PowerToys/PowerToys Run/settings.json | 0 .../PowerToys/Shortcut Guide/settings.json | 0 .../PowerToys/Video Conference/settings.json | 0 .../v0.22.0/Microsoft/PowerToys/settings.json | 0 .../Microsoft/PowerToys/update_state.json | 0 ...oft.PowerToys.Settings.UI.UnitTests.csproj | 0 .../Mocks/IIOProviderMocks.cs | 0 .../Mocks/ISettingsUtilsMocks.cs | 0 .../ModelsTests/BasePTModuleSettingsTest.cs | 0 .../ModelsTests/BasePTSettingsTest.cs | 0 .../ModelsTests/HelperTest.cs | 0 .../ModelsTests/SettingsRepositoryTest.cs | 0 .../ModelsTests/SettingsUtilsTests.cs | 0 .../ViewModelTests/ColorPicker.cs | 0 .../ViewModelTests/FancyZones.cs | 0 .../ViewModelTests/General.cs | 0 .../ViewModelTests/ImageResizer.cs | 0 .../ViewModelTests/KeyboardManager.cs | 0 .../PowerLauncherViewModelTest.cs | 0 .../ViewModelTests/PowerPreview.cs | 0 .../ViewModelTests/PowerRename.cs | 0 .../ViewModelTests/ShortcutGuide.cs | 0 .../Activation/ActivationHandler.cs | 0 .../Activation/DefaultActivationHandler.cs | 0 .../Microsoft.PowerToys.Settings.UI/App.xaml | 0 .../App.xaml.cs | 0 .../Assets/LockScreenLogo.scale-200.png | Bin .../Assets/Logo.scale-200.png | Bin .../Assets/Modules/ColorPicker.png | Bin .../Assets/Modules/FancyZones.png | Bin .../Assets/Modules/ImageResizer.png | Bin .../Assets/Modules/KBM.png | Bin .../Assets/Modules/PT.png | Bin .../Assets/Modules/PowerLauncher.png | Bin .../Assets/Modules/PowerPreview.png | Bin .../Assets/Modules/PowerRename.png | Bin .../Assets/Modules/ShortcutGuide.png | Bin .../Assets/SplashScreen.png | Bin .../Assets/SplashScreen.scale-200.png | Bin .../Assets/Square150x150Logo.scale-200.png | Bin .../Assets/Square44x44Logo.scale-200.png | Bin ...x44Logo.targetsize-24_altform-unplated.png | Bin .../Assets/StoreLogo.png | Bin .../Assets/StoreLogo.scale-100.png | Bin .../Assets/Wide310x150Logo.scale-200.png | Bin .../Assets/logo.png | Bin .../Assets/logo150.png | Bin .../Assets/logo44.png | Bin .../Behaviors/NavigationViewHeaderBehavior.cs | 0 .../Behaviors/NavigationViewHeaderMode.cs | 0 .../Controls/HotkeySettingsControl.xaml | 58 +- .../Controls/HotkeySettingsControl.xaml.cs | 0 .../ModuleEnabledToForegroundConverter.cs | 0 .../Helpers/NativeKeyboardHelper.cs | 0 .../Helpers/NativeMethods.cs | 0 .../Helpers/NavHelper.cs | 0 .../Helpers/Observable.cs | 0 .../Helpers/RelayCommand.cs | 0 .../Helpers/ResourceExtensions.cs | 0 .../ICoreWindowInterop.cs | 0 .../Interop.cs | 0 .../LocProject.json | 0 .../Microsoft.PowerToys.Settings.UI.csproj | 4 +- .../Package.appxmanifest | 0 .../Properties/Default.rd.xml | 0 .../Services/ActivationService.cs | 0 .../Services/NavigationService.cs | 0 .../Strings/en-us/Resources.resw | 2 +- .../Styles/Button.xaml | 0 .../Styles/Page.xaml | 0 .../Styles/TextBlock.xaml | 0 .../Styles/_Colors.xaml | 0 .../Styles/_FontSizes.xaml | 0 .../Styles/_Sizes.xaml | 0 .../Styles/_Thickness.xaml | 0 .../ViewModels/Commands/ButtonClickCommand.cs | 0 .../ViewModels/ShellViewModel.cs | 0 .../Views/ColorPickerPage.xaml | 0 .../Views/ColorPickerPage.xaml.cs | 0 .../Views/FancyZonesPage.xaml | 0 .../Views/FancyZonesPage.xaml.cs | 0 .../Views/GeneralPage.xaml | 0 .../Views/GeneralPage.xaml.cs | 0 .../Views/ImageResizerPage.xaml | 0 .../Views/ImageResizerPage.xaml.cs | 0 .../Views/KeyboardManagerPage.xaml | 0 .../Views/KeyboardManagerPage.xaml.cs | 0 .../Views/PowerLauncherPage.xaml | 448 +++---- .../Views/PowerLauncherPage.xaml.cs | 0 .../Views/PowerPreviewPage.xaml | 0 .../Views/PowerPreviewPage.xaml.cs | 0 .../Views/PowerRenamePage.xaml | 0 .../Views/PowerRenamePage.xaml.cs | 0 .../Views/ShellPage.xaml | 0 .../Views/ShellPage.xaml.cs | 0 .../Views/ShortcutGuidePage.xaml | 0 .../Views/ShortcutGuidePage.xaml.cs | 0 .../Views/VisibleIfNotEmpty.cs | 0 .../Strings/en-us/Resources.resw.lcl | 0 .../Strings/en-us/Resources.resw.lcl | 0 .../Strings/en-us/Resources.resw.lcl | 0 .../Strings/en-us/Resources.resw.lcl | 0 .../Strings/en-us/Resources.resw.lcl | 0 .../Strings/en-us/Resources.resw.lcl | 0 .../Strings/en-us/Resources.resw.lcl | 0 .../Strings/en-us/Resources.resw.lcl | 0 .../Strings/en-us/Resources.resw.lcl | 0 .../Strings/en-us/Resources.resw.lcl | 0 .../Strings/en-us/Resources.resw.lcl | 0 .../Strings/en-us/Resources.resw.lcl | 0 .../Strings/en-us/Resources.resw.lcl | 0 .../Strings/en-us/Resources.resw.lcl | 0 .../Strings/en-us/Resources.resw.lcl | 0 .../Strings/en-us/Resources.resw.lcl | 0 .../Strings/en-us/Resources.resw.lcl | 0 src/settings/main.cpp | 8 +- ...ttings.vcxproj => old-settings-ui.vcxproj} | 13 +- ...ilters => old-settings-ui.vcxproj.filters} | 3 + src/settings/settings.rc | 2 +- .../ModuleTemplate/ModuleTemplate.vcxproj | 3 - .../ModuleTemplateCompileTest.vcxproj | 4 +- .../ModuleTemplate/dllmain.cpp | 2 +- tools/project_template/ModuleTemplate/pch.h | 3 +- 588 files changed, 3311 insertions(+), 3335 deletions(-) rename src/Cpp.Build.props => Cpp.Build.props (100%) rename src/Directory.Build.props => Directory.Build.props (100%) rename {src/common => installer/PowerToysBootstrapper/bootstrapper}/RcResource.cpp (100%) rename {src/common => installer/PowerToysBootstrapper/bootstrapper}/RcResource.h (100%) rename src/common/{comUtils.cpp => COMUtils/COMUtils.cpp} (78%) rename src/common/{comUtils.h => COMUtils/COMUtils.h} (100%) create mode 100644 src/common/COMUtils/COMUtils.vcxproj rename src/common/{common-md-flag => COMUtils}/packages.config (100%) create mode 100644 src/common/Display/Display.vcxproj rename src/common/{ => Display}/dpi_aware.cpp (98%) rename src/common/{ => Display}/dpi_aware.h (92%) rename src/common/{ => Display}/monitors.cpp (98%) rename src/common/{ => Display}/monitors.h (100%) rename src/common/ManagedTelemetry/Telemetry/{Telemetry.csproj => ManagedTelemetry.csproj} (97%) create mode 100644 src/common/SettingsAPI/SetttingsAPI.vcxproj create mode 100644 src/common/SettingsAPI/pch.cpp create mode 100644 src/common/SettingsAPI/pch.h rename src/common/{ => SettingsAPI}/settings_helpers.cpp (98%) rename src/common/{ => SettingsAPI}/settings_helpers.h (95%) rename src/common/{ => SettingsAPI}/settings_objects.cpp (99%) rename src/common/{ => SettingsAPI}/settings_objects.h (99%) create mode 100644 src/common/Themes/Themes.vcxproj rename src/common/{ => Themes}/icon_helpers.cpp (96%) rename src/common/{ => Themes}/icon_helpers.h (78%) rename src/common/{notifications_winrt => Themes}/packages.config (100%) rename src/common/{ => Themes}/windows_colors.cpp (99%) rename src/common/{ => Themes}/windows_colors.h (94%) delete mode 100644 src/common/UnitTests-CommonLib/UnitTestsCommon.cpp create mode 100644 src/common/WinStore/Winstore.vcxproj rename src/common/{ => WinStore}/packages.config (59%) rename src/common/{ => WinStore}/winstore.cpp (96%) rename src/common/{ => WinStore}/winstore.h (82%) delete mode 100644 src/common/common-md-flag/common-md-flag.vcxproj.filters delete mode 100644 src/common/common.cpp delete mode 100644 src/common/common.h delete mode 100644 src/common/common.vcxproj delete mode 100644 src/common/common.vcxproj.filters rename src/common/{ => hooks}/LowlevelKeyboardEvent.h (100%) rename src/common/{ => hooks}/WinHookEvent.h (100%) rename src/common/interop/{interop.vcxproj => PowerToysInterop.vcxproj} (87%) rename src/common/interop/{interop.vcxproj.filters => PowerToysInterop.vcxproj.filters} (88%) rename src/common/{ => interop}/async_message_queue.h (100%) rename src/common/{ => interop}/interop-tests/InteropTests.cs (100%) rename src/common/{ => interop}/interop-tests/Microsoft.Interop.Tests.csproj (92%) rename src/common/{ => interop}/keyboard_layout.cpp (100%) rename src/common/{ => interop}/keyboard_layout.h (95%) rename src/common/{ => interop}/keyboard_layout_impl.h (100%) rename src/common/{ => interop}/shared_constants.h (71%) rename src/common/{ => interop}/two_way_pipe_message_ipc.cpp (99%) rename src/common/{ => interop}/two_way_pipe_message_ipc.h (82%) rename src/common/{ => interop}/two_way_pipe_message_ipc_impl.h (100%) delete mode 100644 src/common/json.cpp rename src/common/{notifications_winrt/notifications.vcxproj => notifications/BackgroundActivator/BackgroundActivator.vcxproj} (85%) rename src/common/{notifications_winrt/notifications.vcxproj.filters => notifications/BackgroundActivator/BackgroundActivator.vcxproj.filters} (100%) rename src/common/{notifications_winrt => notifications/BackgroundActivator}/BackgroundHandler.cpp (91%) rename src/common/{notifications_winrt => notifications/BackgroundActivator}/BackgroundHandler.h (76%) rename src/common/{notifications_winrt => notifications/BackgroundActivator}/BackgroundHandler.idl (85%) rename src/common/{notifications_winrt => notifications/BackgroundActivator}/handler_functions.cpp (100%) rename src/common/{notifications_winrt => notifications/BackgroundActivator}/handler_functions.h (100%) create mode 100644 src/common/notifications/BackgroundActivator/packages.config rename src/common/{notifications_winrt => notifications/BackgroundActivator}/pch.cpp (100%) rename src/common/{notifications_winrt => notifications/BackgroundActivator}/pch.h (100%) rename src/common/notifications/{notifications.def => BackgroundActivatorDLL/BackgroundActivator.def} (100%) rename src/common/notifications/{notifications_dll.rc => BackgroundActivatorDLL/BackgroundActivator.rc} (96%) rename src/common/notifications/{notifications_dll.vcxproj.filters => BackgroundActivatorDLL/BackgroundActivator.vcxproj.filters} (100%) rename src/common/notifications/{notifications_dll.vcxproj => BackgroundActivatorDLL/BackgroundActivatorDLL.vcxproj} (73%) rename src/common/notifications/{ => BackgroundActivatorDLL}/cpp.hint (100%) rename src/common/notifications/{ => BackgroundActivatorDLL}/dllmain.cpp (100%) rename src/common/notifications/{ => BackgroundActivatorDLL}/framework.h (100%) create mode 100644 src/common/notifications/BackgroundActivatorDLL/packages.config rename src/common/{interop => notifications/BackgroundActivatorDLL}/pch.cpp (100%) create mode 100644 src/common/notifications/BackgroundActivatorDLL/pch.h rename src/common/notifications/{ => BackgroundActivatorDLL}/resource.h (84%) rename src/common/{toast_dont_show_again.cpp => notifications/dont_show_again.cpp} (98%) rename src/common/{toast_dont_show_again.h => notifications/dont_show_again.h} (95%) rename src/common/{ => notifications}/notifications.cpp (97%) rename src/common/{ => notifications}/notifications.h (100%) rename src/common/{common-md-flag/common-md-flag.vcxproj => notifications/notifications.vcxproj} (55%) delete mode 100644 src/common/os-detect.h delete mode 100644 src/common/pch.cpp delete mode 100644 src/common/pch.h rename src/common/{ => utils}/appMutex.h (100%) rename src/common/{ => utils}/com_object_factory.h (98%) create mode 100644 src/common/utils/elevation.h create mode 100644 src/common/utils/exec.h rename src/common/{ => utils}/json.h (59%) rename src/common/{os-detect.cpp => utils/os-detect.h} (53%) rename src/common/{ => utils}/processApi.h (100%) create mode 100644 src/common/utils/process_path.h create mode 100644 src/common/utils/resources.h rename src/common/{ => utils}/string_utils.h (100%) rename src/common/{ => utils}/timeutil.h (100%) create mode 100644 src/common/utils/winapi_error.h create mode 100644 src/common/utils/window.h rename src/common/{VersionHelper.cpp => version/helper.cpp} (92%) rename src/common/{VersionHelper.h => version/helper.h} (100%) rename src/common/{ => version}/version.cpp (95%) rename src/common/{ => version}/version.h (69%) create mode 100644 src/common/version/version.vcxproj delete mode 100644 src/common/window_helpers.cpp delete mode 100644 src/common/window_helpers.h rename src/{common/on_thread_executor.cpp => modules/fancyzones/lib/OnThreadExecutor.cpp} (100%) rename src/{common => modules/fancyzones/lib}/on_thread_executor.h (100%) rename src/{common => modules/shortcut_guide}/animation.cpp (100%) rename src/{common => modules/shortcut_guide}/animation.h (100%) rename src/{common => modules/shortcut_guide}/start_visible.cpp (100%) rename src/{common => modules/shortcut_guide}/start_visible.h (100%) rename src/{common => modules/shortcut_guide}/tasklist_positions.cpp (100%) rename src/{common => modules/shortcut_guide}/tasklist_positions.h (100%) rename src/{common => runner}/RestartManagement.cpp (96%) rename src/{common => runner}/RestartManagement.h (100%) rename src/{core => settings-ui}/Directory.Build.targets (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/AppSpecificKeysDataModel.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/BasePTModuleSettings.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/BoolProperty.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/BoolPropertyJsonConverter.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ColorFormatModel.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ColorPickerProperties.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ColorPickerSettings.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ConfigDefaults.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/CustomAction/CustomActionDataModel.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/CustomAction/CustomNamePolicy.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/CustomAction/ModuleCustomAction.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/CustomAction/SendCustomAction.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/DoubleProperty.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/EnabledModules.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/Enumerations/ColorPickerActivationAction.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/Enumerations/ColorRepresentationType.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/FZConfigProperties.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/FancyZonesSettings.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/FancyZonesSettingsIPCMessage.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/GeneralSettings.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/GeneralSettingsCustomAction.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/GenericProperty`1.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/Helpers/Observable.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/HotkeySettings.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/HotkeySettingsControlHook.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ISettingsPath.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ISettingsUtils.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ImageResizerProperties.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ImageResizerSettings.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ImageSize.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ImagerResizerKeepDateModified.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ImageresizerCustomSizeProperty.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ImageresizerFallbackEncoder.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ImageresizerSizes.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/IntProperty.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/Interfaces/ISettingsConfig.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/Interfaces/ISettingsRepository`1.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/KeyBoardKeysProperty.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/KeyboardManagerProfile.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/KeyboardManagerProperties.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/KeyboardManagerSettings.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/KeysDataModel.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/Microsoft.PowerToys.Settings.UI.Library.csproj (95%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/OutGoingGeneralSettings.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/PowerLauncherProperties.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/PowerLauncherSettings.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/PowerPreviewProperties.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/PowerPreviewSettings.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/PowerRenameLocalProperties.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/PowerRenameProperties.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/PowerRenameSettings.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/PowerRenameSettingsIPCMessage.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/RemapKeysDataModel.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/SettingPath.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/SettingsRepository`1.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/SettingsUtils.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ShortcutGuideProperties.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ShortcutGuideSettings.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ShortcutGuideSettingsIPCMessage.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ShortcutsKeyDataModel.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/SndFancyZonesSettings.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/SndImageResizerSettings.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/SndKeyboardManagerSettings.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/SndModuleSettings`1.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/SndPowerPreviewSettings.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/SndPowerRenameSettings.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/SndShortcutGuideSettings.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/StringProperty.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/Telemetry/Events/SettingsBootEvent.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/Telemetry/Events/SettingsEnabledEvent.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/Utilities/Helper.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/Utilities/IIOProvider.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/Utilities/Logger.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/Utilities/NativeMethods.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/Utilities/SystemIOProvider.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ViewModels/ColorPickerViewModel.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ViewModels/Commands/ButtonClickCommand.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ViewModels/Commands/RelayCommand.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ViewModels/Commands/RelayCommand`1.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ViewModels/FancyZonesViewModel.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ViewModels/GeneralViewModel.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ViewModels/ImageResizerViewModel.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ViewModels/KeyboardManagerViewModel.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ViewModels/PowerLauncherViewModel.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ViewModels/PowerPreviewViewModel.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ViewModels/PowerRenameViewModel.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Library/ViewModels/ShortcutGuideViewModel.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Runner/App.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Runner/App.xaml.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Runner/MainWindow.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Runner/MainWindow.xaml.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Runner/Microsoft.PowerToys.Settings.UI.Runner.csproj (96%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Runner/Program.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Runner/app.manifest (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.Runner/icon.ico (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/BackCompatTestProperties.cs (96%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/CorruptJson/Microsoft/PowerToys/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/V0.21.1/Microsoft/PowerToys/ColorPicker/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/V0.21.1/Microsoft/PowerToys/FancyZones/app-zone-history.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/V0.21.1/Microsoft/PowerToys/FancyZones/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/V0.21.1/Microsoft/PowerToys/FancyZones/zones-settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/V0.21.1/Microsoft/PowerToys/File Explorer/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/V0.21.1/Microsoft/PowerToys/ImageResizer/image-resizer-settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/V0.21.1/Microsoft/PowerToys/ImageResizer/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/V0.21.1/Microsoft/PowerToys/ImageResizer/sizes.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/V0.21.1/Microsoft/PowerToys/Keyboard Manager/default.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/V0.21.1/Microsoft/PowerToys/Keyboard Manager/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/V0.21.1/Microsoft/PowerToys/PowerRename/power-rename-settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/V0.21.1/Microsoft/PowerToys/PowerRename/power-rename-ui-flags (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/V0.21.1/Microsoft/PowerToys/PowerToys Run/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/V0.21.1/Microsoft/PowerToys/Shortcut Guide/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/V0.21.1/Microsoft/PowerToys/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/V0.21.1/Microsoft/PowerToys/update_state.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.18.2/Microsoft/PowerToys/ColorPicker/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.18.2/Microsoft/PowerToys/FancyZones/app-zone-history.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.18.2/Microsoft/PowerToys/FancyZones/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.18.2/Microsoft/PowerToys/FancyZones/zones-settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.18.2/Microsoft/PowerToys/File Explorer/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.18.2/Microsoft/PowerToys/ImageResizer/image-resizer-settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.18.2/Microsoft/PowerToys/ImageResizer/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.18.2/Microsoft/PowerToys/ImageResizer/sizes.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.18.2/Microsoft/PowerToys/Keyboard Manager/default.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.18.2/Microsoft/PowerToys/Keyboard Manager/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.18.2/Microsoft/PowerToys/PowerRename/power-rename-settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.18.2/Microsoft/PowerToys/PowerRename/power-rename-ui-flags (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.18.2/Microsoft/PowerToys/PowerToys Run/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.18.2/Microsoft/PowerToys/Shortcut Guide/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.18.2/Microsoft/PowerToys/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.18.2/Microsoft/PowerToys/update_state.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.19.2/Microsoft/PowerToys/FancyZones/app-zone-history.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.19.2/Microsoft/PowerToys/FancyZones/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.19.2/Microsoft/PowerToys/FancyZones/zones-settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.19.2/Microsoft/PowerToys/File Explorer/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.19.2/Microsoft/PowerToys/ImageResizer/image-resizer-settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.19.2/Microsoft/PowerToys/ImageResizer/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.19.2/Microsoft/PowerToys/ImageResizer/sizes.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.19.2/Microsoft/PowerToys/Keyboard Manager/default.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.19.2/Microsoft/PowerToys/Keyboard Manager/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.19.2/Microsoft/PowerToys/PowerRename/power-rename-settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.19.2/Microsoft/PowerToys/PowerRename/power-rename-ui-flags (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.19.2/Microsoft/PowerToys/PowerToys Run/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.19.2/Microsoft/PowerToys/Shortcut Guide/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.19.2/Microsoft/PowerToys/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.19.2/Microsoft/PowerToys/update_state.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.20.1/Microsoft/PowerToys/ColorPicker/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.20.1/Microsoft/PowerToys/FancyZones/app-zone-history.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.20.1/Microsoft/PowerToys/FancyZones/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.20.1/Microsoft/PowerToys/FancyZones/zones-settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.20.1/Microsoft/PowerToys/File Explorer/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.20.1/Microsoft/PowerToys/ImageResizer/image-resizer-settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.20.1/Microsoft/PowerToys/ImageResizer/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.20.1/Microsoft/PowerToys/ImageResizer/sizes.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.20.1/Microsoft/PowerToys/Keyboard Manager/default.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.20.1/Microsoft/PowerToys/Keyboard Manager/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.20.1/Microsoft/PowerToys/PowerRename/power-rename-settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.20.1/Microsoft/PowerToys/PowerRename/power-rename-ui-flags (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.20.1/Microsoft/PowerToys/PowerToys Run/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.20.1/Microsoft/PowerToys/Shortcut Guide/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.20.1/Microsoft/PowerToys/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.20.1/Microsoft/PowerToys/update_state.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.22.0/Microsoft/PowerToys/ColorPicker/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.22.0/Microsoft/PowerToys/FancyZones/app-zone-history.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.22.0/Microsoft/PowerToys/FancyZones/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.22.0/Microsoft/PowerToys/FancyZones/zones-settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.22.0/Microsoft/PowerToys/File Explorer/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.22.0/Microsoft/PowerToys/ImageResizer/image-resizer-settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.22.0/Microsoft/PowerToys/ImageResizer/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.22.0/Microsoft/PowerToys/ImageResizer/sizes.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.22.0/Microsoft/PowerToys/Keyboard Manager/default.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.22.0/Microsoft/PowerToys/Keyboard Manager/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.22.0/Microsoft/PowerToys/PowerRename/power-rename-settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.22.0/Microsoft/PowerToys/PowerRename/power-rename-ui-flags (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.22.0/Microsoft/PowerToys/PowerToys Run/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.22.0/Microsoft/PowerToys/Shortcut Guide/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.22.0/Microsoft/PowerToys/Video Conference/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.22.0/Microsoft/PowerToys/settings.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/v0.22.0/Microsoft/PowerToys/update_state.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/Microsoft.PowerToys.Settings.UI.UnitTests.csproj (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/Mocks/IIOProviderMocks.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/Mocks/ISettingsUtilsMocks.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/ModelsTests/BasePTModuleSettingsTest.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/ModelsTests/BasePTSettingsTest.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/ModelsTests/HelperTest.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/ModelsTests/SettingsRepositoryTest.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/ModelsTests/SettingsUtilsTests.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/ViewModelTests/ColorPicker.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/ViewModelTests/FancyZones.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/ViewModelTests/General.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/ViewModelTests/ImageResizer.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/ViewModelTests/KeyboardManager.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/ViewModelTests/PowerLauncherViewModelTest.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/ViewModelTests/PowerPreview.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/ViewModelTests/PowerRename.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI.UnitTests/ViewModelTests/ShortcutGuide.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Activation/ActivationHandler.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Activation/DefaultActivationHandler.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/App.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/App.xaml.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/LockScreenLogo.scale-200.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/Logo.scale-200.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/Modules/ColorPicker.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/Modules/FancyZones.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/Modules/ImageResizer.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/Modules/KBM.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/Modules/PT.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/Modules/PowerLauncher.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/Modules/PowerPreview.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/Modules/PowerRename.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/Modules/ShortcutGuide.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/SplashScreen.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/SplashScreen.scale-200.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/Square150x150Logo.scale-200.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/Square44x44Logo.scale-200.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/Square44x44Logo.targetsize-24_altform-unplated.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/StoreLogo.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/StoreLogo.scale-100.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/Wide310x150Logo.scale-200.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/logo.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/logo150.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Assets/logo44.png (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Behaviors/NavigationViewHeaderBehavior.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Behaviors/NavigationViewHeaderMode.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml (97%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Converters/ModuleEnabledToForegroundConverter.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Helpers/NativeKeyboardHelper.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Helpers/NativeMethods.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Helpers/NavHelper.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Helpers/Observable.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Helpers/RelayCommand.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Helpers/ResourceExtensions.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/ICoreWindowInterop.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Interop.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/LocProject.json (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj (99%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Package.appxmanifest (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Properties/Default.rd.xml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Services/ActivationService.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Services/NavigationService.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw (97%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Styles/Button.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Styles/Page.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Styles/TextBlock.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Styles/_Colors.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Styles/_FontSizes.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Styles/_Sizes.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Styles/_Thickness.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/ViewModels/Commands/ButtonClickCommand.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/ViewModels/ShellViewModel.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/ColorPickerPage.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/ColorPickerPage.xaml.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/ImageResizerPage.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/ImageResizerPage.xaml.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/KeyboardManagerPage.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/KeyboardManagerPage.xaml.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/PowerLauncherPage.xaml (98%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/PowerLauncherPage.xaml.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/PowerPreviewPage.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/PowerPreviewPage.xaml.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/PowerRenamePage.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/PowerRenamePage.xaml.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/ShortcutGuidePage.xaml (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/ShortcutGuidePage.xaml.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/Views/VisibleIfNotEmpty.cs (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/loc/cs/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/loc/de/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/loc/es/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/loc/fr/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/loc/hu/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/loc/it/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/loc/ja/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/loc/ko/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/loc/nl/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/loc/pl/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/loc/pt-BR/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/loc/pt-PT/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/loc/ru/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/loc/sv/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/loc/tr/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/loc/zh-Hans/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl (100%) rename src/{core => settings-ui}/Microsoft.PowerToys.Settings.UI/loc/zh-Hant/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl (100%) rename src/settings/{settings.vcxproj => old-settings-ui.vcxproj} (91%) rename src/settings/{settings.vcxproj.filters => old-settings-ui.vcxproj.filters} (93%) diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index 57d678d1da..2a71556ab4 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -197,6 +197,7 @@ buf BUFSIZE Buid buildcommand +buildtools buildtransitive BValue bytearray @@ -336,11 +337,13 @@ CPlus cplusplus CPower cpp +CPPARM cppblog cppm cpprestsdk cppstd cppwinrt +CPPx CProj CREATESCHEDULEDTASK CREATESTRUCT @@ -362,6 +365,7 @@ cso csproj CSRW css +cstdint cstdlib cstring CStyle @@ -465,8 +469,8 @@ DISPIDAMBIENTDLCONTROL DISPINFO Displayandhidethedesktop DISPLAYCHANGE -DISPLAYNAME displayname +DISPLAYNAME divyan DLACTIVEXCTLS DLCONTROL @@ -647,14 +651,14 @@ ENU enum ENUMITEMS EOAC -eol EOL +eol epicgames ERASEBKGND EREOF EResize -errorlevel ERRORLEVEL +errorlevel ERRORMESSAGE ERRORTITLE esize @@ -854,8 +858,8 @@ HLSL hmenu hmodule hmon -hmonitor HMONITOR +hmonitor HOLDENTER HOLDESC homljgmgpmcbpjbnjpfijnhipfkiclkd @@ -979,6 +983,7 @@ imageresizersettings IMain IMarkdown ime +imeutil img IMonitor IMouse @@ -1145,8 +1150,8 @@ keyremaps keystokes Keystool Keytool -KEYUP keyup +KEYUP Kf KILLFOCUS Knownfolders @@ -1155,6 +1160,7 @@ LAlt lambson lamotile Lastdevice +LASTEXITCODE laute laviusmotileng LAYOUTRTL @@ -1184,6 +1190,7 @@ LIGHTTURQUOISE LIGHTYELLOW lindex linecap +linkid Linkmenu linq LINQTo @@ -1385,8 +1392,8 @@ multizone mutex mutexes muxc -Mvvm mvvm +Mvvm MYICON myuri NAMECHANGE @@ -1441,6 +1448,7 @@ noactive Noactivewindow NOAGGREGATION NOASYNC +nocache NOCLOSEPROCESS NOCOPYBITS nodeca @@ -1475,6 +1483,7 @@ notafter notfound nothrow notificationsdll +NOTIFICATIONSDLL NOTIFYICONDATAW NOTIMPL notmatch @@ -1793,6 +1802,7 @@ resultlist resw resx returnvalue +retval rfind rgb RGBQUAD @@ -1894,6 +1904,7 @@ settingsheader settingshotkeycontrol settingsui settingsv +Setttings setwindowpos SETWORKAREA sfgao @@ -1908,8 +1919,8 @@ SHELLDLL shellex SHELLEXECUTEINFO SHELLEXECUTEINFOW -shellscalingapi Shellscalingapi +shellscalingapi Shelveset SHFILEINFO SHGFI @@ -2048,8 +2059,8 @@ stringtable stringval strsafe strutil -STTNGS sttngs +STTNGS Stubless STYLECHANGED STYLECHANGING @@ -2163,8 +2174,8 @@ toggleright toggleswitch toolbar Toolchain -Toolset toolset +Toolset tooltip toolwindow TOPDOWNDIB @@ -2210,12 +2221,14 @@ Uid uifabric uifabricicons uint +uintptr UIPI UIs ul ULARGE ULLONG ulong +umd unchecks uncomment uncompilable @@ -2234,8 +2247,8 @@ uninstalling uninstantiated Uniq uniquifier -uniquifies Uniquifies +uniquifies unittests unk unknwn @@ -2351,6 +2364,7 @@ wdupenv weakme webapp webcam +webclient webkit webp webpack @@ -2368,9 +2382,11 @@ wikipedia wil wildcards WINAPI +winapi winauto wincolor windef +windevbuildagents Windowcontrols WINDOWCREATED WINDOWEDGE @@ -2513,13 +2529,3 @@ ZONESETCHANGE Zoneszonabletester Zoomusingmagnifier zzz -buildtools -CPPARM -CPPx -LASTEXITCODE -linkid -nocache -retval -umd -webclient -windevbuildagents diff --git a/src/Cpp.Build.props b/Cpp.Build.props similarity index 100% rename from src/Cpp.Build.props rename to Cpp.Build.props diff --git a/src/Directory.Build.props b/Directory.Build.props similarity index 100% rename from src/Directory.Build.props rename to Directory.Build.props diff --git a/PowerToys.sln b/PowerToys.sln index 01bfb8a5d4..d15d6c616b 100644 --- a/PowerToys.sln +++ b/PowerToys.sln @@ -10,7 +10,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "runner", "src\runner\runner {51920F1F-C28C-4ADF-8660-4238766796C2} = {51920F1F-C28C-4ADF-8660-4238766796C2} {6A71162E-FC4C-4A2C-B90F-3CF94F59A9BB} = {6A71162E-FC4C-4A2C-B90F-3CF94F59A9BB} {031AC72E-FA28-4AB7-B690-6F7B9C28AA73} = {031AC72E-FA28-4AB7-B690-6F7B9C28AA73} - {74485049-C722-400F-ABE5-86AC52D929B3} = {74485049-C722-400F-ABE5-86AC52D929B3} {0485F45C-EA7A-4BB5-804B-3E8D14699387} = {0485F45C-EA7A-4BB5-804B-3E8D14699387} {D29DDD63-E2CF-4657-9FD5-2AEDE4257E5D} = {D29DDD63-E2CF-4657-9FD5-2AEDE4257E5D} {5CCC8468-DEC8-4D36-99D4-5C891BEBD481} = {5CCC8468-DEC8-4D36-99D4-5C891BEBD481} @@ -27,17 +26,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "runner", "src\runner\runner {A46629C4-1A6C-40FA-A8B6-10E5102BB0BA} = {A46629C4-1A6C-40FA-A8B6-10E5102BB0BA} {17DA04DF-E393-4397-9CF0-84DABE11032E} = {17DA04DF-E393-4397-9CF0-84DABE11032E} {F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99} = {F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99} - {07C389E3-6BC8-41CF-923E-307B1265FA2D} = {07C389E3-6BC8-41CF-923E-307B1265FA2D} {655C9AF2-18D3-4DA6-80E4-85504A7722BA} = {655C9AF2-18D3-4DA6-80E4-85504A7722BA} {89F34AF7-1C34-4A72-AA6E-534BCF972BD9} = {89F34AF7-1C34-4A72-AA6E-534BCF972BD9} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "src\common\common.vcxproj", "{74485049-C722-400F-ABE5-86AC52D929B3}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ShortcutGuide", "src\modules\shortcut_guide\shortcut_guide.vcxproj", "{A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}" - ProjectSection(ProjectDependencies) = postProject - {74485049-C722-400F-ABE5-86AC52D929B3} = {74485049-C722-400F-ABE5-86AC52D929B3} - EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "modules", "modules", "{4574FDD0-F61D-4376-98BF-E5A1262C11EC}" EndProject @@ -46,33 +39,23 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "interface", "interface", "{ src\modules\interface\powertoy_module_interface.h = src\modules\interface\powertoy_module_interface.h EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "settings", "src\settings\settings.vcxproj", "{07C389E3-6BC8-41CF-923E-307B1265FA2D}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "fancyzones", "fancyzones", "{D1D6BC88-09AE-4FB4-AD24-5DED46A791DD}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FancyZonesLib", "src\modules\fancyzones\lib\FancyZonesLib.vcxproj", "{F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99}" - ProjectSection(ProjectDependencies) = postProject - {74485049-C722-400F-ABE5-86AC52D929B3} = {74485049-C722-400F-ABE5-86AC52D929B3} - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fancyzones", "src\modules\fancyzones\dll\FancyZonesModule.vcxproj", "{48804216-2A0E-4168-A6D8-9CD068D14227}" ProjectSection(ProjectDependencies) = postProject - {74485049-C722-400F-ABE5-86AC52D929B3} = {74485049-C722-400F-ABE5-86AC52D929B3} {5CCC8468-DEC8-4D36-99D4-5C891BEBD481} = {5CCC8468-DEC8-4D36-99D4-5C891BEBD481} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTests-FancyZones", "src\modules\fancyzones\tests\UnitTests\UnitTests.vcxproj", "{9C6A7905-72D4-4BF5-B256-ABFDAEF68AE9}" ProjectSection(ProjectDependencies) = postProject - {74485049-C722-400F-ABE5-86AC52D929B3} = {74485049-C722-400F-ABE5-86AC52D929B3} {F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99} = {F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99} EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "common", "common", "{1AFB6476-670D-4E80-A464-657E01DFF482}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTests-CommonLib", "src\common\UnitTests-CommonLib\UnitTests-CommonLib.vcxproj", "{1A066C63-64B3-45F8-92FE-664E1CCE8077}" - ProjectSection(ProjectDependencies) = postProject - {74485049-C722-400F-ABE5-86AC52D929B3} = {74485049-C722-400F-ABE5-86AC52D929B3} - EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FancyZonesEditor", "src\modules\fancyzones\editor\FancyZonesEditor\FancyZonesEditor.csproj", "{5CCC8468-DEC8-4D36-99D4-5C891BEBD481}" EndProject @@ -82,7 +65,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerRenameExt", "src\modul ProjectSection(ProjectDependencies) = postProject {0E072714-D127-460B-AFAD-B4C40B412798} = {0E072714-D127-460B-AFAD-B4C40B412798} {51920F1F-C28C-4ADF-8660-4238766796C2} = {51920F1F-C28C-4ADF-8660-4238766796C2} - {74485049-C722-400F-ABE5-86AC52D929B3} = {74485049-C722-400F-ABE5-86AC52D929B3} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerRenameLib", "src\modules\powerrename\lib\PowerRenameLib.vcxproj", "{51920F1F-C28C-4ADF-8660-4238766796C2}" @@ -96,39 +78,20 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerRenameTest", "src\modu ProjectSection(ProjectDependencies) = postProject {0E072714-D127-460B-AFAD-B4C40B412798} = {0E072714-D127-460B-AFAD-B4C40B412798} {51920F1F-C28C-4ADF-8660-4238766796C2} = {51920F1F-C28C-4ADF-8660-4238766796C2} - {74485049-C722-400F-ABE5-86AC52D929B3} = {74485049-C722-400F-ABE5-86AC52D929B3} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerRenameUnitTests", "src\modules\powerrename\unittests\PowerRenameLibUnitTests.vcxproj", "{2151F984-E006-4A9F-92EF-C6DDE3DC8413}" ProjectSection(ProjectDependencies) = postProject {0E072714-D127-460B-AFAD-B4C40B412798} = {0E072714-D127-460B-AFAD-B4C40B412798} {51920F1F-C28C-4ADF-8660-4238766796C2} = {51920F1F-C28C-4ADF-8660-4238766796C2} - {74485049-C722-400F-ABE5-86AC52D929B3} = {74485049-C722-400F-ABE5-86AC52D929B3} {B25AC7A5-FB9F-4789-B392-D5C85E948670} = {B25AC7A5-FB9F-4789-B392-D5C85E948670} EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{BEEAB7F2-FFF6-45AB-9CDB-B04CC0734B88}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ModuleTemplateCompileTest", "tools\project_template\ModuleTemplate\ModuleTemplateCompileTest.vcxproj", "{64A80062-4D8B-4229-8A38-DFA1D7497749}" - ProjectSection(ProjectDependencies) = postProject - {74485049-C722-400F-ABE5-86AC52D929B3} = {74485049-C722-400F-ABE5-86AC52D929B3} - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerRenameUWPUI", "src\modules\powerrename\UWPui\PowerRenameUWPUI.vcxproj", "{0485F45C-EA7A-4BB5-804B-3E8D14699387}" ProjectSection(ProjectDependencies) = postProject {0E072714-D127-460B-AFAD-B4C40B412798} = {0E072714-D127-460B-AFAD-B4C40B412798} - {74485049-C722-400F-ABE5-86AC52D929B3} = {74485049-C722-400F-ABE5-86AC52D929B3} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "notifications", "src\common\notifications_winrt\notifications.vcxproj", "{0B593A6C-4143-4337-860E-DB5710FB87DB}" - ProjectSection(ProjectDependencies) = postProject - {74485049-C722-400F-ABE5-86AC52D929B3} = {74485049-C722-400F-ABE5-86AC52D929B3} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "notifications_dll", "src\common\notifications\notifications_dll.vcxproj", "{031AC72E-FA28-4AB7-B690-6F7B9C28AA73}" - ProjectSection(ProjectDependencies) = postProject - {74485049-C722-400F-ABE5-86AC52D929B3} = {74485049-C722-400F-ABE5-86AC52D929B3} - {0B593A6C-4143-4337-860E-DB5710FB87DB} = {0B593A6C-4143-4337-860E-DB5710FB87DB} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KeyboardManager", "src\modules\keyboardmanager\dll\KeyboardManager.vcxproj", "{89F34AF7-1C34-4A72-AA6E-534BCF972BD9}" @@ -148,7 +111,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "action_runner", "src\action {17DA04DF-E393-4397-9CF0-84DABE11032E} = {17DA04DF-E393-4397-9CF0-84DABE11032E} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "updating", "src\common\updating\updating.vcxproj", "{17DA04DF-E393-4397-9CF0-84DABE11032E}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ApplicationUpdate", "src\common\updating\updating.vcxproj", "{17DA04DF-E393-4397-9CF0-84DABE11032E}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "keyboardmanager", "keyboardmanager", "{38BDB927-829B-4C65-9CD9-93FB05D66D65}" EndProject @@ -200,27 +163,30 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{E775CC2C EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "previewpane", "previewpane", "{2F305555-C296-497E-AC20-5FA1B237996A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PreviewHandlerCommon", "src\modules\previewpane\Common\PreviewHandlerCommon.csproj", "{AF2349B8-E5B6-4004-9502-687C1C7730B1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PreviewHandlerCommon", "src\modules\previewpane\Common\PreviewHandlerCommon.csproj", "{AF2349B8-E5B6-4004-9502-687C1C7730B1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarkdownPreviewHandler", "src\modules\previewpane\MarkdownPreviewHandler\MarkdownPreviewHandler.csproj", "{6A71162E-FC4C-4A2C-B90F-3CF94F59A9BB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MarkdownPreviewHandler", "src\modules\previewpane\MarkdownPreviewHandler\MarkdownPreviewHandler.csproj", "{6A71162E-FC4C-4A2C-B90F-3CF94F59A9BB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests-MarkdownPreviewHandler", "src\modules\previewpane\PreviewPaneUnitTests\UnitTests-MarkdownPreviewHandler.csproj", "{A2B51B8B-8F90-424E-BC97-F9AB7D76CA1A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests-MarkdownPreviewHandler", "src\modules\previewpane\PreviewPaneUnitTests\UnitTests-MarkdownPreviewHandler.csproj", "{A2B51B8B-8F90-424E-BC97-F9AB7D76CA1A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SvgPreviewHandler", "src\modules\previewpane\SvgPreviewHandler\SvgPreviewHandler.csproj", "{DA425894-6E13-404F-8DCB-78584EC0557A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SvgPreviewHandler", "src\modules\previewpane\SvgPreviewHandler\SvgPreviewHandler.csproj", "{DA425894-6E13-404F-8DCB-78584EC0557A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests-SvgPreviewHandler", "src\modules\previewpane\UnitTests-SvgPreviewHandler\UnitTests-SvgPreviewHandler.csproj", "{060D75DA-2D1C-48E6-A4A1-6F0718B64661}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests-SvgPreviewHandler", "src\modules\previewpane\UnitTests-SvgPreviewHandler\UnitTests-SvgPreviewHandler.csproj", "{060D75DA-2D1C-48E6-A4A1-6F0718B64661}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests-PreviewHandlerCommon", "src\modules\previewpane\UnitTests-PreviewHandlerCommon\UnitTests-PreviewHandlerCommon.csproj", "{748417CA-F17E-487F-9411-CAFB6D3F4877}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests-PreviewHandlerCommon", "src\modules\previewpane\UnitTests-PreviewHandlerCommon\UnitTests-PreviewHandlerCommon.csproj", "{748417CA-F17E-487F-9411-CAFB6D3F4877}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "powerpreview", "src\modules\previewpane\powerpreview\powerpreview.vcxproj", "{217DF501-135C-4E38-BFC8-99D4821032EA}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "powerpreviewTest", "src\modules\previewpane\powerpreviewTest\powerpreviewTest.vcxproj", "{47310AB4-9034-4BD1-8D8B-E88AD21A171B}" + ProjectSection(ProjectDependencies) = postProject + {217DF501-135C-4E38-BFC8-99D4821032EA} = {217DF501-135C-4E38-BFC8-99D4821032EA} + EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{C3081D9A-1586-441A-B5F4-ED815B3719C1}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "settings-ui", "settings-ui", "{C3081D9A-1586-441A-B5F4-ED815B3719C1}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Settings.UI.Runner", "src\core\Microsoft.PowerToys.Settings.UI.Runner\Microsoft.PowerToys.Settings.UI.Runner.csproj", "{E4E0D2AE-B17D-4BD4-8BEE-AFC8CC464C5F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Settings.UI.Runner", "src\settings-ui\Microsoft.PowerToys.Settings.UI.Runner\Microsoft.PowerToys.Settings.UI.Runner.csproj", "{E4E0D2AE-B17D-4BD4-8BEE-AFC8CC464C5F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.PowerToys.Settings.UI", "src\core\Microsoft.PowerToys.Settings.UI\Microsoft.PowerToys.Settings.UI.csproj", "{A7D5099E-F0FD-4BF3-8522-5A682759F915}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.PowerToys.Settings.UI", "src\settings-ui\Microsoft.PowerToys.Settings.UI\Microsoft.PowerToys.Settings.UI.csproj", "{A7D5099E-F0FD-4BF3-8522-5A682759F915}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4981CCD1-4CD9-4A49-B240-00AA46493FF8}" ProjectSection(SolutionItems) = preProject @@ -228,19 +194,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution src\tests\win-app-driver\packages.config = src\tests\win-app-driver\packages.config EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Settings.UI.Library", "src\core\Microsoft.PowerToys.Settings.UI.Library\Microsoft.PowerToys.Settings.UI.Library.csproj", "{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Settings.UI.Library", "src\settings-ui\Microsoft.PowerToys.Settings.UI.Library\Microsoft.PowerToys.Settings.UI.Library.csproj", "{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "interop", "src\common\interop\interop.vcxproj", "{F055103B-F80B-4D0C-BF48-057C55620033}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common-md-flag", "src\common\common-md-flag\common-md-flag.vcxproj", "{985B3F2F-CEED-4C0A-A249-69257E719145}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Interop.Tests", "src\common\interop-tests\Microsoft.Interop.Tests.csproj", "{437AD818-3F1F-4CA5-A79B-25233A157026}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerToysInterop", "src\common\interop\PowerToysInterop.vcxproj", "{F055103B-F80B-4D0C-BF48-057C55620033}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Folder", "src\modules\launcher\Plugins\Microsoft.Plugin.Folder\Microsoft.Plugin.Folder.csproj", "{787B8AA6-CA93-4C84-96FE-DF31110AD1C4}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerLauncher.Telemetry", "src\modules\launcher\PowerLauncher.Telemetry\PowerLauncher.Telemetry.csproj", "{08C8C05F-0362-41BC-818C-724572DF8B06}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Telemetry", "src\common\ManagedTelemetry\Telemetry\Telemetry.csproj", "{5D00D290-4016-4CFE-9E41-1E7C724509BA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManagedTelemetry", "src\common\ManagedTelemetry\Telemetry\ManagedTelemetry.csproj", "{5D00D290-4016-4CFE-9E41-1E7C724509BA}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KeyboardManagerTest", "src\modules\keyboardmanager\test\KeyboardManagerTest.vcxproj", "{62173D9A-6724-4C00-A1C8-FB646480A9EC}" EndProject @@ -248,9 +210,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManagedCommon", "src\common EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Program.UnitTests", "src\modules\launcher\Plugins\Microsoft.Plugin.Program.UnitTests\Microsoft.Plugin.Program.UnitTests.csproj", "{42851751-CBC8-45A6-97F5-7A0753F7B4D1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests-SvgThumbnailProvider", "src\modules\previewpane\UnitTests-SvgThumbnailProvider\UnitTests-SvgThumbnailProvider.csproj", "{1EF1EEF0-10F0-4F2E-8550-39B6D8044D3E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests-SvgThumbnailProvider", "src\modules\previewpane\UnitTests-SvgThumbnailProvider\UnitTests-SvgThumbnailProvider.csproj", "{1EF1EEF0-10F0-4F2E-8550-39B6D8044D3E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SvgThumbnailProvider", "src\modules\previewpane\SvgThumbnailProvider\SvgThumbnailProvider.csproj", "{8FFE09DA-FA4F-4EE1-B3A2-AD5497FBD1AD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SvgThumbnailProvider", "src\modules\previewpane\SvgThumbnailProvider\SvgThumbnailProvider.csproj", "{8FFE09DA-FA4F-4EE1-B3A2-AD5497FBD1AD}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ColorPicker", "src\modules\colorPicker\ColorPicker\ColorPicker.vcxproj", "{655C9AF2-18D3-4DA6-80E4-85504A7722BA}" EndProject @@ -262,7 +224,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Uri", "src EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Uri.UnitTests", "src\modules\launcher\Plugins\Microsoft.Plugin.Uri.UnitTests\Microsoft.Plugin.Uri.UnitTests.csproj", "{B81FB7B6-D30E-428F-908A-41422EFC1172}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Settings.UI.UnitTests", "src\core\Microsoft.PowerToys.Settings.UI.UnitTests\Microsoft.PowerToys.Settings.UI.UnitTests.csproj", "{0F85E674-34AE-443D-954C-8321EB8B93B1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Settings.UI.UnitTests", "src\settings-ui\Microsoft.PowerToys.Settings.UI.UnitTests\Microsoft.PowerToys.Settings.UI.UnitTests.csproj", "{0F85E674-34AE-443D-954C-8321EB8B93B1}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Calculator.UnitTest", "src\modules\launcher\Plugins\Microsoft.Plugin.Calculator.UnitTest\Microsoft.Plugin.Calculator.UnitTest.csproj", "{632BBE62-5421-49EA-835A-7FFA4F499BD6}" EndProject @@ -270,7 +232,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Folder.Uni EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest-ColorPickerUI", "src\modules\colorPicker\UnitTest-ColorPickerUI\UnitTest-ColorPickerUI.csproj", "{090CD7B7-3B0C-4D1D-BC98-83EB5D799BC1}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "logging", "src\logging\logging.vcxproj", "{7E1E3F13-2BD6-3F75-A6A7-873A2B55C60F}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spdlog", "src\logging\logging.vcxproj", "{7E1E3F13-2BD6-3F75-A6A7-873A2B55C60F}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Sys", "src\modules\launcher\Plugins\Microsoft.Plugin.Sys\Microsoft.Plugin.Sys.csproj", "{FD8EB419-FF9C-4D88-BB6F-BF6CED37747B}" EndProject @@ -278,7 +240,59 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Sys.UnitTe EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "logger", "src\common\logger\logger.vcxproj", "{D9B8FC84-322A-4F9F-BBB9-20915C47DDFD}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "win-app-driver", "src\tests\win-app-driver\win-app-driver.csproj", "{F9E7CD57-0E86-4734-B56A-1B87179BC23C}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SetttingsAPI", "src\common\SettingsAPI\SetttingsAPI.vcxproj", "{6955446D-23F7-4023-9BB3-8657F904AF99}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Interop.Tests", "src\common\interop\interop-tests\Microsoft.Interop.Tests.csproj", "{58736667-1027-4AD7-BFDF-7A3A6474103A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "notifications", "notifications", "{D92131D6-7610-4D60-A7DB-1C169783F83B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Notifications", "src\common\notifications\notifications.vcxproj", "{1D5BE09D-78C0-4FD7-AF00-AE7C1AF7C525}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BackgroundActivatorDLL", "src\common\notifications\BackgroundActivatorDLL\BackgroundActivatorDLL.vcxproj", "{031AC72E-FA28-4AB7-B690-6F7B9C28AA73}" + ProjectSection(ProjectDependencies) = postProject + {0B593A6C-4143-4337-860E-DB5710FB87DB} = {0B593A6C-4143-4337-860E-DB5710FB87DB} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BackgroundActivator", "src\common\notifications\BackgroundActivator\BackgroundActivator.vcxproj", "{0B593A6C-4143-4337-860E-DB5710FB87DB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Version", "src\common\version\version.vcxproj", "{CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "interop", "interop", "{5A7818A8-109C-4E1C-850D-1A654E234B0E}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "log", "log", "{E4E03FE0-94FD-47C7-88C5-F17D0AA549D3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WinStore", "src\common\WinStore\Winstore.vcxproj", "{C502A854-53AC-4EBB-8DC0-E4AF2191E4F6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "COMUtils", "src\common\COMUtils\COMUtils.vcxproj", "{7319089E-46D6-4400-BC65-E39BDF1416EE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Display", "src\common\Display\Display.vcxproj", "{CABA8DFB-823B-4BF2-93AC-3F31984150D9}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Themes", "src\common\Themes\Themes.vcxproj", "{98537082-0FDB-40DE-ABD8-0DC5A4269BAB}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "utils", "utils", "{B39DC643-4663-475E-B329-03F0C9918D48}" + ProjectSection(SolutionItems) = preProject + src\common\utils\appMutex.h = src\common\utils\appMutex.h + src\common\utils\com_object_factory.h = src\common\utils\com_object_factory.h + src\common\utils\elevation.h = src\common\utils\elevation.h + src\common\utils\exec.h = src\common\utils\exec.h + src\common\utils\json.h = src\common\utils\json.h + src\common\utils\os-detect.h = src\common\utils\os-detect.h + src\common\utils\process_path.h = src\common\utils\process_path.h + src\common\utils\resources.h = src\common\utils\resources.h + src\common\utils\string_utils.h = src\common\utils\string_utils.h + src\common\utils\timeutil.h = src\common\utils\timeutil.h + src\common\utils\winapi_error.h = src\common\utils\winapi_error.h + src\common\utils\window.h = src\common\utils\window.h + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "old-settings-ui", "src\settings\old-settings-ui.vcxproj", "{07C389E3-6BC8-41CF-923E-307B1265FA2D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Telemetry", "Telemetry", "{8F62026A-294B-41C6-8839-87463613F216}" + ProjectSection(SolutionItems) = preProject + src\common\Telemetry\ProjectTelemetry.h = src\common\Telemetry\ProjectTelemetry.h + src\common\Telemetry\TelemetryBase.cs = src\common\Telemetry\TelemetryBase.cs + src\common\Telemetry\TraceLoggingDefines.h = src\common\Telemetry\TraceLoggingDefines.h + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -290,18 +304,10 @@ Global {9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Debug|x64.Build.0 = Debug|x64 {9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Release|x64.ActiveCfg = Release|x64 {9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Release|x64.Build.0 = Release|x64 - {74485049-C722-400F-ABE5-86AC52D929B3}.Debug|x64.ActiveCfg = Debug|x64 - {74485049-C722-400F-ABE5-86AC52D929B3}.Debug|x64.Build.0 = Debug|x64 - {74485049-C722-400F-ABE5-86AC52D929B3}.Release|x64.ActiveCfg = Release|x64 - {74485049-C722-400F-ABE5-86AC52D929B3}.Release|x64.Build.0 = Release|x64 {A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}.Debug|x64.ActiveCfg = Debug|x64 {A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}.Debug|x64.Build.0 = Debug|x64 {A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}.Release|x64.ActiveCfg = Release|x64 {A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}.Release|x64.Build.0 = Release|x64 - {07C389E3-6BC8-41CF-923E-307B1265FA2D}.Debug|x64.ActiveCfg = Debug|x64 - {07C389E3-6BC8-41CF-923E-307B1265FA2D}.Debug|x64.Build.0 = Debug|x64 - {07C389E3-6BC8-41CF-923E-307B1265FA2D}.Release|x64.ActiveCfg = Release|x64 - {07C389E3-6BC8-41CF-923E-307B1265FA2D}.Release|x64.Build.0 = Release|x64 {F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99}.Debug|x64.ActiveCfg = Debug|x64 {F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99}.Debug|x64.Build.0 = Debug|x64 {F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99}.Release|x64.ActiveCfg = Release|x64 @@ -350,14 +356,6 @@ Global {0485F45C-EA7A-4BB5-804B-3E8D14699387}.Debug|x64.Build.0 = Debug|x64 {0485F45C-EA7A-4BB5-804B-3E8D14699387}.Release|x64.ActiveCfg = Release|x64 {0485F45C-EA7A-4BB5-804B-3E8D14699387}.Release|x64.Build.0 = Release|x64 - {0B593A6C-4143-4337-860E-DB5710FB87DB}.Debug|x64.ActiveCfg = Debug|x64 - {0B593A6C-4143-4337-860E-DB5710FB87DB}.Debug|x64.Build.0 = Debug|x64 - {0B593A6C-4143-4337-860E-DB5710FB87DB}.Release|x64.ActiveCfg = Release|x64 - {0B593A6C-4143-4337-860E-DB5710FB87DB}.Release|x64.Build.0 = Release|x64 - {031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Debug|x64.ActiveCfg = Debug|x64 - {031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Debug|x64.Build.0 = Debug|x64 - {031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Release|x64.ActiveCfg = Release|x64 - {031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Release|x64.Build.0 = Release|x64 {89F34AF7-1C34-4A72-AA6E-534BCF972BD9}.Debug|x64.ActiveCfg = Debug|x64 {89F34AF7-1C34-4A72-AA6E-534BCF972BD9}.Debug|x64.Build.0 = Debug|x64 {89F34AF7-1C34-4A72-AA6E-534BCF972BD9}.Release|x64.ActiveCfg = Release|x64 @@ -478,14 +476,6 @@ Global {F055103B-F80B-4D0C-BF48-057C55620033}.Debug|x64.Build.0 = Debug|x64 {F055103B-F80B-4D0C-BF48-057C55620033}.Release|x64.ActiveCfg = Release|x64 {F055103B-F80B-4D0C-BF48-057C55620033}.Release|x64.Build.0 = Release|x64 - {985B3F2F-CEED-4C0A-A249-69257E719145}.Debug|x64.ActiveCfg = Debug|x64 - {985B3F2F-CEED-4C0A-A249-69257E719145}.Debug|x64.Build.0 = Debug|x64 - {985B3F2F-CEED-4C0A-A249-69257E719145}.Release|x64.ActiveCfg = Release|x64 - {985B3F2F-CEED-4C0A-A249-69257E719145}.Release|x64.Build.0 = Release|x64 - {437AD818-3F1F-4CA5-A79B-25233A157026}.Debug|x64.ActiveCfg = Debug|x64 - {437AD818-3F1F-4CA5-A79B-25233A157026}.Debug|x64.Build.0 = Debug|x64 - {437AD818-3F1F-4CA5-A79B-25233A157026}.Release|x64.ActiveCfg = Release|x64 - {437AD818-3F1F-4CA5-A79B-25233A157026}.Release|x64.Build.0 = Release|x64 {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Debug|x64.ActiveCfg = Debug|x64 {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Debug|x64.Build.0 = Debug|x64 {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Release|x64.ActiveCfg = Release|x64 @@ -566,14 +556,55 @@ Global {D9B8FC84-322A-4F9F-BBB9-20915C47DDFD}.Debug|x64.Build.0 = Debug|x64 {D9B8FC84-322A-4F9F-BBB9-20915C47DDFD}.Release|x64.ActiveCfg = Release|x64 {D9B8FC84-322A-4F9F-BBB9-20915C47DDFD}.Release|x64.Build.0 = Release|x64 - {F9E7CD57-0E86-4734-B56A-1B87179BC23C}.Debug|x64.ActiveCfg = Debug|Any CPU - {F9E7CD57-0E86-4734-B56A-1B87179BC23C}.Release|x64.ActiveCfg = Release|Any CPU + {6955446D-23F7-4023-9BB3-8657F904AF99}.Debug|x64.ActiveCfg = Debug|x64 + {6955446D-23F7-4023-9BB3-8657F904AF99}.Debug|x64.Build.0 = Debug|x64 + {6955446D-23F7-4023-9BB3-8657F904AF99}.Release|x64.ActiveCfg = Release|x64 + {6955446D-23F7-4023-9BB3-8657F904AF99}.Release|x64.Build.0 = Release|x64 + {58736667-1027-4AD7-BFDF-7A3A6474103A}.Debug|x64.ActiveCfg = Debug|x64 + {58736667-1027-4AD7-BFDF-7A3A6474103A}.Debug|x64.Build.0 = Debug|x64 + {58736667-1027-4AD7-BFDF-7A3A6474103A}.Release|x64.ActiveCfg = Release|x64 + {58736667-1027-4AD7-BFDF-7A3A6474103A}.Release|x64.Build.0 = Release|x64 + {1D5BE09D-78C0-4FD7-AF00-AE7C1AF7C525}.Debug|x64.ActiveCfg = Debug|x64 + {1D5BE09D-78C0-4FD7-AF00-AE7C1AF7C525}.Debug|x64.Build.0 = Debug|x64 + {1D5BE09D-78C0-4FD7-AF00-AE7C1AF7C525}.Release|x64.ActiveCfg = Release|x64 + {1D5BE09D-78C0-4FD7-AF00-AE7C1AF7C525}.Release|x64.Build.0 = Release|x64 + {031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Debug|x64.ActiveCfg = Debug|x64 + {031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Debug|x64.Build.0 = Debug|x64 + {031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Release|x64.ActiveCfg = Release|x64 + {031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Release|x64.Build.0 = Release|x64 + {0B593A6C-4143-4337-860E-DB5710FB87DB}.Debug|x64.ActiveCfg = Debug|x64 + {0B593A6C-4143-4337-860E-DB5710FB87DB}.Debug|x64.Build.0 = Debug|x64 + {0B593A6C-4143-4337-860E-DB5710FB87DB}.Release|x64.ActiveCfg = Release|x64 + {0B593A6C-4143-4337-860E-DB5710FB87DB}.Release|x64.Build.0 = Release|x64 + {CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}.Debug|x64.ActiveCfg = Debug|x64 + {CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}.Debug|x64.Build.0 = Debug|x64 + {CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}.Release|x64.ActiveCfg = Release|x64 + {CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}.Release|x64.Build.0 = Release|x64 + {C502A854-53AC-4EBB-8DC0-E4AF2191E4F6}.Debug|x64.ActiveCfg = Debug|x64 + {C502A854-53AC-4EBB-8DC0-E4AF2191E4F6}.Debug|x64.Build.0 = Debug|x64 + {C502A854-53AC-4EBB-8DC0-E4AF2191E4F6}.Release|x64.ActiveCfg = Release|x64 + {C502A854-53AC-4EBB-8DC0-E4AF2191E4F6}.Release|x64.Build.0 = Release|x64 + {7319089E-46D6-4400-BC65-E39BDF1416EE}.Debug|x64.ActiveCfg = Debug|x64 + {7319089E-46D6-4400-BC65-E39BDF1416EE}.Debug|x64.Build.0 = Debug|x64 + {7319089E-46D6-4400-BC65-E39BDF1416EE}.Release|x64.ActiveCfg = Release|x64 + {7319089E-46D6-4400-BC65-E39BDF1416EE}.Release|x64.Build.0 = Release|x64 + {CABA8DFB-823B-4BF2-93AC-3F31984150D9}.Debug|x64.ActiveCfg = Debug|x64 + {CABA8DFB-823B-4BF2-93AC-3F31984150D9}.Debug|x64.Build.0 = Debug|x64 + {CABA8DFB-823B-4BF2-93AC-3F31984150D9}.Release|x64.ActiveCfg = Release|x64 + {CABA8DFB-823B-4BF2-93AC-3F31984150D9}.Release|x64.Build.0 = Release|x64 + {98537082-0FDB-40DE-ABD8-0DC5A4269BAB}.Debug|x64.ActiveCfg = Debug|x64 + {98537082-0FDB-40DE-ABD8-0DC5A4269BAB}.Debug|x64.Build.0 = Debug|x64 + {98537082-0FDB-40DE-ABD8-0DC5A4269BAB}.Release|x64.ActiveCfg = Release|x64 + {98537082-0FDB-40DE-ABD8-0DC5A4269BAB}.Release|x64.Build.0 = Release|x64 + {07C389E3-6BC8-41CF-923E-307B1265FA2D}.Debug|x64.ActiveCfg = Debug|x64 + {07C389E3-6BC8-41CF-923E-307B1265FA2D}.Debug|x64.Build.0 = Debug|x64 + {07C389E3-6BC8-41CF-923E-307B1265FA2D}.Release|x64.ActiveCfg = Release|x64 + {07C389E3-6BC8-41CF-923E-307B1265FA2D}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {74485049-C722-400F-ABE5-86AC52D929B3} = {1AFB6476-670D-4E80-A464-657E01DFF482} {A46629C4-1A6C-40FA-A8B6-10E5102BB0BA} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC} {3BB8493E-D18E-4485-A320-CB40F90F55AE} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC} {D1D6BC88-09AE-4FB4-AD24-5DED46A791DD} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC} @@ -588,10 +619,7 @@ Global {0E072714-D127-460B-AFAD-B4C40B412798} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3} {A3935CF4-46C5-4A88-84D3-6B12E16E6BA2} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3} {2151F984-E006-4A9F-92EF-C6DDE3DC8413} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3} - {64A80062-4D8B-4229-8A38-DFA1D7497749} = {BEEAB7F2-FFF6-45AB-9CDB-B04CC0734B88} {0485F45C-EA7A-4BB5-804B-3E8D14699387} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3} - {0B593A6C-4143-4337-860E-DB5710FB87DB} = {1AFB6476-670D-4E80-A464-657E01DFF482} - {031AC72E-FA28-4AB7-B690-6F7B9C28AA73} = {1AFB6476-670D-4E80-A464-657E01DFF482} {89F34AF7-1C34-4A72-AA6E-534BCF972BD9} = {38BDB927-829B-4C65-9CD9-93FB05D66D65} {6C7F47CC-2151-44A3-A546-41C70025132C} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC} {2BE46397-4DFA-414C-9BD4-41E4BBF8CB34} = {6C7F47CC-2151-44A3-A546-41C70025132C} @@ -625,9 +653,7 @@ Global {E4E0D2AE-B17D-4BD4-8BEE-AFC8CC464C5F} = {C3081D9A-1586-441A-B5F4-ED815B3719C1} {A7D5099E-F0FD-4BF3-8522-5A682759F915} = {C3081D9A-1586-441A-B5F4-ED815B3719C1} {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A} = {C3081D9A-1586-441A-B5F4-ED815B3719C1} - {F055103B-F80B-4D0C-BF48-057C55620033} = {1AFB6476-670D-4E80-A464-657E01DFF482} - {985B3F2F-CEED-4C0A-A249-69257E719145} = {1AFB6476-670D-4E80-A464-657E01DFF482} - {437AD818-3F1F-4CA5-A79B-25233A157026} = {1AFB6476-670D-4E80-A464-657E01DFF482} + {F055103B-F80B-4D0C-BF48-057C55620033} = {5A7818A8-109C-4E1C-850D-1A654E234B0E} {787B8AA6-CA93-4C84-96FE-DF31110AD1C4} = {4AFC9975-2456-4C70-94A4-84073C1CED93} {08C8C05F-0362-41BC-818C-724572DF8B06} = {C140A3EF-6DBF-4084-9D4C-4EB5A99FEE68} {5D00D290-4016-4CFE-9E41-1E7C724509BA} = {1AFB6476-670D-4E80-A464-657E01DFF482} @@ -645,11 +671,25 @@ Global {632BBE62-5421-49EA-835A-7FFA4F499BD6} = {4AFC9975-2456-4C70-94A4-84073C1CED93} {4FA206A5-F69F-4193-BF8F-F6EEB496734C} = {4AFC9975-2456-4C70-94A4-84073C1CED93} {090CD7B7-3B0C-4D1D-BC98-83EB5D799BC1} = {1D78B84B-CA39-406C-98F4-71F7EC266CC0} - {7E1E3F13-2BD6-3F75-A6A7-873A2B55C60F} = {1AFB6476-670D-4E80-A464-657E01DFF482} + {7E1E3F13-2BD6-3F75-A6A7-873A2B55C60F} = {E4E03FE0-94FD-47C7-88C5-F17D0AA549D3} {FD8EB419-FF9C-4D88-BB6F-BF6CED37747B} = {4AFC9975-2456-4C70-94A4-84073C1CED93} {DA5A6FE9-0040-40CC-83CC-764AE5306590} = {4AFC9975-2456-4C70-94A4-84073C1CED93} - {D9B8FC84-322A-4F9F-BBB9-20915C47DDFD} = {1AFB6476-670D-4E80-A464-657E01DFF482} - {F9E7CD57-0E86-4734-B56A-1B87179BC23C} = {E775CC2C-24CB-48D6-9C3A-BE4CCE0DB17A} + {D9B8FC84-322A-4F9F-BBB9-20915C47DDFD} = {E4E03FE0-94FD-47C7-88C5-F17D0AA549D3} + {6955446D-23F7-4023-9BB3-8657F904AF99} = {1AFB6476-670D-4E80-A464-657E01DFF482} + {58736667-1027-4AD7-BFDF-7A3A6474103A} = {5A7818A8-109C-4E1C-850D-1A654E234B0E} + {D92131D6-7610-4D60-A7DB-1C169783F83B} = {1AFB6476-670D-4E80-A464-657E01DFF482} + {1D5BE09D-78C0-4FD7-AF00-AE7C1AF7C525} = {D92131D6-7610-4D60-A7DB-1C169783F83B} + {031AC72E-FA28-4AB7-B690-6F7B9C28AA73} = {D92131D6-7610-4D60-A7DB-1C169783F83B} + {0B593A6C-4143-4337-860E-DB5710FB87DB} = {D92131D6-7610-4D60-A7DB-1C169783F83B} + {CC6E41AC-8174-4E8A-8D22-85DD7F4851DF} = {1AFB6476-670D-4E80-A464-657E01DFF482} + {5A7818A8-109C-4E1C-850D-1A654E234B0E} = {1AFB6476-670D-4E80-A464-657E01DFF482} + {E4E03FE0-94FD-47C7-88C5-F17D0AA549D3} = {1AFB6476-670D-4E80-A464-657E01DFF482} + {C502A854-53AC-4EBB-8DC0-E4AF2191E4F6} = {1AFB6476-670D-4E80-A464-657E01DFF482} + {7319089E-46D6-4400-BC65-E39BDF1416EE} = {1AFB6476-670D-4E80-A464-657E01DFF482} + {CABA8DFB-823B-4BF2-93AC-3F31984150D9} = {1AFB6476-670D-4E80-A464-657E01DFF482} + {98537082-0FDB-40DE-ABD8-0DC5A4269BAB} = {1AFB6476-670D-4E80-A464-657E01DFF482} + {B39DC643-4663-475E-B329-03F0C9918D48} = {1AFB6476-670D-4E80-A464-657E01DFF482} + {8F62026A-294B-41C6-8839-87463613F216} = {1AFB6476-670D-4E80-A464-657E01DFF482} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0} diff --git a/doc/devdocs/guidance.md b/doc/devdocs/guidance.md index 329297cbc5..2edbc2db9f 100644 --- a/doc/devdocs/guidance.md +++ b/doc/devdocs/guidance.md @@ -28,8 +28,6 @@ END ```cpp #include -extern "C" IMAGE_DOS_HEADER __ImageBase; - std::wstring GET_RESOURCE_STRING(IDS_MODULE_DISPLAYNAME) ``` diff --git a/installer/PowerToysBootstrapper/PowerToysBootstrapper.sln b/installer/PowerToysBootstrapper/PowerToysBootstrapper.sln index 119aa75d00..2096d0c9a7 100644 --- a/installer/PowerToysBootstrapper/PowerToysBootstrapper.sln +++ b/installer/PowerToysBootstrapper/PowerToysBootstrapper.sln @@ -3,13 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.30320.27 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "updating", "..\..\src\common\updating\updating.vcxproj", "{17DA04DF-E393-4397-9CF0-84DABE11032E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "..\..\src\common\common.vcxproj", "{74485049-C722-400F-ABE5-86AC52D929B3}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Updating", "..\..\src\common\updating\updating.vcxproj", "{17DA04DF-E393-4397-9CF0-84DABE11032E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bootstrapper", "bootstrapper\bootstrapper.vcxproj", "{D194E3AA-F824-4CA9-9A58-034DD6B7D022}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "logging", "..\..\src\logging\logging.vcxproj", "{7E1E3F13-2BD6-3F75-A6A7-873A2B55C60F}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spdlog", "..\..\src\logging\logging.vcxproj", "{7E1E3F13-2BD6-3F75-A6A7-873A2B55C60F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Version", "..\..\src\common\version\version.vcxproj", "{CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SetttingsAPI", "..\..\src\common\SettingsAPI\SetttingsAPI.vcxproj", "{6955446D-23F7-4023-9BB3-8657F904AF99}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Notifications", "..\..\src\common\notifications\notifications.vcxproj", "{1D5BE09D-78C0-4FD7-AF00-AE7C1AF7C525}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WinStore", "..\..\src\common\WinStore\Winstore.vcxproj", "{C502A854-53AC-4EBB-8DC0-E4AF2191E4F6}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,10 +27,6 @@ Global {17DA04DF-E393-4397-9CF0-84DABE11032E}.Debug|x64.Build.0 = Debug|x64 {17DA04DF-E393-4397-9CF0-84DABE11032E}.Release|x64.ActiveCfg = Release|x64 {17DA04DF-E393-4397-9CF0-84DABE11032E}.Release|x64.Build.0 = Release|x64 - {74485049-C722-400F-ABE5-86AC52D929B3}.Debug|x64.ActiveCfg = Debug|x64 - {74485049-C722-400F-ABE5-86AC52D929B3}.Debug|x64.Build.0 = Debug|x64 - {74485049-C722-400F-ABE5-86AC52D929B3}.Release|x64.ActiveCfg = Release|x64 - {74485049-C722-400F-ABE5-86AC52D929B3}.Release|x64.Build.0 = Release|x64 {D194E3AA-F824-4CA9-9A58-034DD6B7D022}.Debug|x64.ActiveCfg = Debug|x64 {D194E3AA-F824-4CA9-9A58-034DD6B7D022}.Debug|x64.Build.0 = Debug|x64 {D194E3AA-F824-4CA9-9A58-034DD6B7D022}.Release|x64.ActiveCfg = Release|x64 @@ -33,6 +35,22 @@ Global {7E1E3F13-2BD6-3F75-A6A7-873A2B55C60F}.Debug|x64.Build.0 = Debug|x64 {7E1E3F13-2BD6-3F75-A6A7-873A2B55C60F}.Release|x64.ActiveCfg = Release|x64 {7E1E3F13-2BD6-3F75-A6A7-873A2B55C60F}.Release|x64.Build.0 = Release|x64 + {CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}.Debug|x64.ActiveCfg = Debug|x64 + {CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}.Debug|x64.Build.0 = Debug|x64 + {CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}.Release|x64.ActiveCfg = Release|x64 + {CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}.Release|x64.Build.0 = Release|x64 + {6955446D-23F7-4023-9BB3-8657F904AF99}.Debug|x64.ActiveCfg = Debug|x64 + {6955446D-23F7-4023-9BB3-8657F904AF99}.Debug|x64.Build.0 = Debug|x64 + {6955446D-23F7-4023-9BB3-8657F904AF99}.Release|x64.ActiveCfg = Release|x64 + {6955446D-23F7-4023-9BB3-8657F904AF99}.Release|x64.Build.0 = Release|x64 + {1D5BE09D-78C0-4FD7-AF00-AE7C1AF7C525}.Debug|x64.ActiveCfg = Debug|x64 + {1D5BE09D-78C0-4FD7-AF00-AE7C1AF7C525}.Debug|x64.Build.0 = Debug|x64 + {1D5BE09D-78C0-4FD7-AF00-AE7C1AF7C525}.Release|x64.ActiveCfg = Release|x64 + {1D5BE09D-78C0-4FD7-AF00-AE7C1AF7C525}.Release|x64.Build.0 = Release|x64 + {C502A854-53AC-4EBB-8DC0-E4AF2191E4F6}.Debug|x64.ActiveCfg = Debug|x64 + {C502A854-53AC-4EBB-8DC0-E4AF2191E4F6}.Debug|x64.Build.0 = Debug|x64 + {C502A854-53AC-4EBB-8DC0-E4AF2191E4F6}.Release|x64.ActiveCfg = Release|x64 + {C502A854-53AC-4EBB-8DC0-E4AF2191E4F6}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/common/RcResource.cpp b/installer/PowerToysBootstrapper/bootstrapper/RcResource.cpp similarity index 100% rename from src/common/RcResource.cpp rename to installer/PowerToysBootstrapper/bootstrapper/RcResource.cpp diff --git a/src/common/RcResource.h b/installer/PowerToysBootstrapper/bootstrapper/RcResource.h similarity index 100% rename from src/common/RcResource.h rename to installer/PowerToysBootstrapper/bootstrapper/RcResource.h diff --git a/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.base.rc b/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.base.rc index 5c0ad738df..e28ff90e74 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.base.rc +++ b/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.base.rc @@ -1,6 +1,6 @@ #include #include "resource.h" -#include "../../../src/common/version.h" +#include "../../../src/common/version/version.h" MAINICON ICON "../../../src/runner/svgs/icon.ico" IDR_BIN_ICON BIN "../../../src/runner/svgs/icon.ico" diff --git a/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.cpp b/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.cpp index 74432a51b1..c05accfa94 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.cpp +++ b/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.cpp @@ -1,19 +1,22 @@ #include "pch.h" #include "Generated Files/resource.h" -#include -#include +#include "RcResource.h" #include #include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include "progressbar_window.h" -extern "C" IMAGE_DOS_HEADER __ImageBase; auto Strings = create_notifications_strings(); diff --git a/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.vcxproj b/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.vcxproj index b1b0cd0ac1..702521bfa2 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.vcxproj +++ b/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.vcxproj @@ -120,6 +120,7 @@ Create + @@ -137,9 +138,6 @@ - - {74485049-c722-400f-abe5-86ac52d929b3} - {17da04df-e393-4397-9cf0-84dabe11032e} diff --git a/installer/PowerToysBootstrapper/bootstrapper/progressbar_window.cpp b/installer/PowerToysBootstrapper/bootstrapper/progressbar_window.cpp index f8ddafed21..6b44e2fdb0 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/progressbar_window.cpp +++ b/installer/PowerToysBootstrapper/bootstrapper/progressbar_window.cpp @@ -1,6 +1,7 @@ #include "pch.h" -#include +#include +#include #include "progressbar_window.h" #include "Generated Files/resource.h" diff --git a/installer/PowerToysSetup/Product.wxs b/installer/PowerToysSetup/Product.wxs index fa33b42a4f..80ae064181 100644 --- a/installer/PowerToysSetup/Product.wxs +++ b/installer/PowerToysSetup/Product.wxs @@ -314,8 +314,8 @@ - - + + @@ -364,7 +364,7 @@ - + @@ -565,7 +565,7 @@ - + @@ -587,7 +587,7 @@ - + @@ -616,7 +616,7 @@ - + @@ -734,7 +734,7 @@ - + @@ -862,7 +862,7 @@ - + @@ -880,7 +880,7 @@ - + @@ -891,7 +891,7 @@ - + @@ -903,7 +903,7 @@ - + @@ -915,7 +915,7 @@ - + @@ -927,7 +927,7 @@ - + @@ -939,7 +939,7 @@ - + @@ -950,7 +950,7 @@ - + diff --git a/installer/PowerToysSetup/publish.cmd b/installer/PowerToysSetup/publish.cmd index b52cdc0bbd..a240c1c5b4 100644 --- a/installer/PowerToysSetup/publish.cmd +++ b/installer/PowerToysSetup/publish.cmd @@ -3,7 +3,7 @@ setlocal enableDelayedExpansion IF NOT DEFINED PTRoot (SET PTRoot=..\..) rem Publish Settings -SET settingsProfileFolderName=!PTRoot!\src\core\Microsoft.PowerToys.Settings.UI.Runner\Properties\PublishProfiles\ +SET settingsProfileFolderName=!PTRoot!\src\settings-ui\Microsoft.PowerToys.Settings.UI.Runner\Properties\PublishProfiles\ rem Create the publish profile folder if it doesn't exist IF NOT EXIST !settingsProfileFolderName! (mkdir !settingsProfileFolderName!) SET settingsProfileFileName=SettingsProfile.pubxml @@ -29,7 +29,7 @@ echo ^ >> !settingsPublishProfile! echo ^ >> !settingsPublishProfile! rem In case of Release we should not use Debug CRT in VCRT forwarders -msbuild !PTRoot!\src\core\Microsoft.PowerToys.Settings.UI.Runner\Microsoft.PowerToys.Settings.UI.Runner.csproj -t:Publish -p:Configuration="Release" -p:Platform="x64" -p:AppxBundle=Never -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=!settingsProfileFileName! +msbuild !PTRoot!\src\settings-ui\Microsoft.PowerToys.Settings.UI.Runner\Microsoft.PowerToys.Settings.UI.Runner.csproj -t:Publish -p:Configuration="Release" -p:Platform="x64" -p:AppxBundle=Never -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=!settingsProfileFileName! rem Publish Launcher diff --git a/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj b/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj index a514bc8e06..5e68a677e8 100644 --- a/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj +++ b/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj @@ -47,10 +47,19 @@ false $(Platform)\$(Configuration)\ + + + inc;..\..\src\;telemetry;$(WIX)sdk\$(WixPlatformToolset)\inc;$(SolutionDir)\packages\WiX.3.11.2\tools\sdk\inc;%(AdditionalIncludeDirectories) + + + $(WIX)sdk\$(WixPlatformToolset)\lib\x64;$(SolutionDir)\packages\WiX.3.11.2\tools\sdk\vs2017\lib\x64;..\..\$(PlatformShortName)\$(Configuration)\;%(AdditionalLibraryDirectories) + msi.lib;wcautil.lib;Psapi.lib;Pathcch.lib;comsupp.lib;taskschd.lib;Secur32.lib;msi.lib;dutil.lib;wcautil.lib;Version.lib;ApplicationUpdate.lib;Notifications.lib;winstore.lib;%(AdditionalDependencies) + + + Disabled - inc;telemetry;$(WIX)sdk\$(WixPlatformToolset)\inc;$(SolutionDir)\packages\WiX.3.11.2\tools\sdk\inc;%(AdditionalIncludeDirectories) WIN64;_DEBUG;_WINDOWS;_USRDLL;CUSTOMACTIONTEST_EXPORTS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug @@ -60,8 +69,6 @@ true - Psapi.lib;Pathcch.lib;comsupp.lib;taskschd.lib;Secur32.lib;msi.lib;dutil.lib;wcautil.lib;Version.lib;..\..\$(PlatformShortName)\$(Configuration)\common.lib;..\..\$(PlatformShortName)\$(Configuration)\updating.lib;%(AdditionalDependencies) - $(WIX)sdk\$(WixPlatformToolset)\lib\x64;$(SolutionDir)\packages\WiX.3.11.2\tools\sdk\vs2017\lib\x64;%(AdditionalLibraryDirectories) CustomAction.def true Windows @@ -72,7 +79,6 @@ MaxSpeed true - inc;telemetry;$(WIX)sdk\$(WixPlatformToolset)\inc;$(SolutionDir)\packages\WiX.3.11.2\tools\sdk\inc;%(AdditionalIncludeDirectories) WIN64;NDEBUG;_WINDOWS;_USRDLL;CUSTOMACTIONTEST_EXPORTS;%(PreprocessorDefinitions) MultiThreaded true @@ -82,8 +88,6 @@ true - Psapi.lib;Pathcch.lib;comsupp.lib;taskschd.lib;Secur32.lib;msi.lib;dutil.lib;wcautil.lib;Version.lib;..\..\$(PlatformShortName)\$(Configuration)\common.lib;..\..\$(PlatformShortName)\$(Configuration)\updating.lib;%(AdditionalDependencies) - $(WIX)sdk\$(WixPlatformToolset)\lib\x64;$(SolutionDir)\packages\WiX.3.11.2\tools\sdk\vs2017\lib\x64;%(AdditionalLibraryDirectories) CustomAction.def true Windows diff --git a/src/action_runner/action_runner.base.rc b/src/action_runner/action_runner.base.rc index 31ad79b258..5e4e3aab3c 100644 --- a/src/action_runner/action_runner.base.rc +++ b/src/action_runner/action_runner.base.rc @@ -1,6 +1,6 @@ #include #include "resource.h" -#include "../common/version.h" +#include "../common/version/version.h" 1 VERSIONINFO FILEVERSION FILE_VERSION diff --git a/src/action_runner/action_runner.cpp b/src/action_runner/action_runner.cpp index 5e5fdb2262..a7157efd79 100644 --- a/src/action_runner/action_runner.cpp +++ b/src/action_runner/action_runner.cpp @@ -7,12 +7,15 @@ #include #include -#include #include #include #include #include +#include +#include +#include + #include #include #include @@ -20,8 +23,6 @@ #include "../runner/tray_icon.h" #include "../runner/action_runner_utils.h" -extern "C" IMAGE_DOS_HEADER __ImageBase; - auto Strings = create_notifications_strings(); int uninstall_msi_action() diff --git a/src/action_runner/action_runner.vcxproj b/src/action_runner/action_runner.vcxproj index 9ce34c9803..af535c479e 100644 --- a/src/action_runner/action_runner.vcxproj +++ b/src/action_runner/action_runner.vcxproj @@ -1,11 +1,9 @@ - - 16.0 {D29DDD63-E2CF-4657-9FD5-2AEDE4257E5D} @@ -46,13 +44,15 @@ WindowsApp.lib;Msi.lib;Shlwapi.lib;%(AdditionalDependencies) - - - {74485049-c722-400f-abe5-86ac52d929b3} + + {1d5be09d-78c0-4fd7-af00-ae7c1af7c525} + + + {6955446d-23f7-4023-9bb3-8657f904af99} {17da04df-e393-4397-9cf0-84dabe11032e} diff --git a/src/common/comUtils.cpp b/src/common/COMUtils/COMUtils.cpp similarity index 78% rename from src/common/comUtils.cpp rename to src/common/COMUtils/COMUtils.cpp index 31694caa02..7a31e8349d 100644 --- a/src/common/comUtils.cpp +++ b/src/common/COMUtils/COMUtils.cpp @@ -1,11 +1,29 @@ -#include "pch.h" +#include "comUtils.h" +#include +#pragma warning(push) +#pragma warning(disable : 4067) #include +#pragma warning(pop) +#include #include -#include "comUtils.h" -#include "common.h" +// Helper class for various COM-related APIs, e.g working with security descriptors +template +struct typed_storage +{ + std::unique_ptr _buffer; + inline explicit typed_storage(const DWORD size) : + _buffer{ std::make_unique(size) } + { + } + + inline operator T*() + { + return reinterpret_cast(_buffer.get()); + } +}; bool initializeCOMSecurity(const wchar_t* securityDescriptor) { @@ -64,4 +82,4 @@ bool initializeCOMSecurity(const wchar_t* securityDescriptor) nullptr, EOAC_DYNAMIC_CLOAKING | EOAC_DISABLE_AAA, nullptr)); -} \ No newline at end of file +} diff --git a/src/common/comUtils.h b/src/common/COMUtils/COMUtils.h similarity index 100% rename from src/common/comUtils.h rename to src/common/COMUtils/COMUtils.h diff --git a/src/common/COMUtils/COMUtils.vcxproj b/src/common/COMUtils/COMUtils.vcxproj new file mode 100644 index 0000000000..d203825431 --- /dev/null +++ b/src/common/COMUtils/COMUtils.vcxproj @@ -0,0 +1,47 @@ + + + + 16.0 + {7319089E-46D6-4400-BC65-E39BDF1416EE} + Win32Proj + COMUtils + COMUtils + + + + StaticLibrary + + + + + + + + + + NotUsing + ..\..\..\;%(AdditionalIncludeDirectories) + _LIB;%(PreprocessorDefinitions) + true + + + + + + + + + + + + + + + + + + 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}. + + + + \ No newline at end of file diff --git a/src/common/common-md-flag/packages.config b/src/common/COMUtils/packages.config similarity index 100% rename from src/common/common-md-flag/packages.config rename to src/common/COMUtils/packages.config diff --git a/src/common/Display/Display.vcxproj b/src/common/Display/Display.vcxproj new file mode 100644 index 0000000000..949d3461e8 --- /dev/null +++ b/src/common/Display/Display.vcxproj @@ -0,0 +1,44 @@ + + + + 16.0 + {CABA8DFB-823B-4BF2-93AC-3F31984150D9} + Win32Proj + Display + Display + + + + StaticLibrary + + + + + + + + + + + + + + + + NotUsing + ..\..\..\;%(AdditionalIncludeDirectories) + _LIB;%(PreprocessorDefinitions) + true + NotUsing + + + + + + + + + + + + \ No newline at end of file diff --git a/src/common/dpi_aware.cpp b/src/common/Display/dpi_aware.cpp similarity index 98% rename from src/common/dpi_aware.cpp rename to src/common/Display/dpi_aware.cpp index 460d7f3c78..9c76800197 100644 --- a/src/common/dpi_aware.cpp +++ b/src/common/Display/dpi_aware.cpp @@ -1,7 +1,9 @@ -#include "pch.h" #include "dpi_aware.h" #include "monitors.h" #include +#include + +#pragma comment(lib, "shcore.lib") namespace DPIAware { diff --git a/src/common/dpi_aware.h b/src/common/Display/dpi_aware.h similarity index 92% rename from src/common/dpi_aware.h rename to src/common/Display/dpi_aware.h index 341531c433..093994153e 100644 --- a/src/common/dpi_aware.h +++ b/src/common/Display/dpi_aware.h @@ -1,7 +1,7 @@ #pragma once -#include "windef.h" -#pragma comment(lib, "shcore.lib") +#define WIN32_LEAN_AND_MEAN +#include namespace DPIAware { diff --git a/src/common/monitors.cpp b/src/common/Display/monitors.cpp similarity index 98% rename from src/common/monitors.cpp rename to src/common/Display/monitors.cpp index 1ad10aaff2..39ce11462c 100644 --- a/src/common/monitors.cpp +++ b/src/common/Display/monitors.cpp @@ -1,11 +1,10 @@ -#include "pch.h" - #include "monitors.h" -#include "common.h" +#include namespace { + // TODO: use compare bool operator<(const RECT& lhs, const RECT& rhs) { auto lhs_tuple = std::make_tuple(lhs.left, lhs.right, lhs.top, lhs.bottom); diff --git a/src/common/monitors.h b/src/common/Display/monitors.h similarity index 100% rename from src/common/monitors.h rename to src/common/Display/monitors.h diff --git a/src/common/ManagedCommon/ManagedCommon.csproj b/src/common/ManagedCommon/ManagedCommon.csproj index 83111e2a18..0c7f7b7944 100644 --- a/src/common/ManagedCommon/ManagedCommon.csproj +++ b/src/common/ManagedCommon/ManagedCommon.csproj @@ -33,7 +33,7 @@ - + diff --git a/src/common/ManagedTelemetry/Telemetry/Telemetry.csproj b/src/common/ManagedTelemetry/Telemetry/ManagedTelemetry.csproj similarity index 97% rename from src/common/ManagedTelemetry/Telemetry/Telemetry.csproj rename to src/common/ManagedTelemetry/Telemetry/ManagedTelemetry.csproj index eb222a5315..5b1b5a4e09 100644 --- a/src/common/ManagedTelemetry/Telemetry/Telemetry.csproj +++ b/src/common/ManagedTelemetry/Telemetry/ManagedTelemetry.csproj @@ -1,40 +1,40 @@ - - - - - x64 - x64 - netstandard2.0 - $(Version).0 - Microsoft Corporation - PowerToys - PowerToys Telemetry - Copyright (C) 2020 Microsoft Corporation - https://github.com/microsoft/PowerToys - Github - PowerToys - en-US - true - - - - - - - - StyleCop.json - - - - - 1.1.118 - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - GlobalSuppressions.cs - - - + + + + + x64 + x64 + netstandard2.0 + $(Version).0 + Microsoft Corporation + PowerToys + PowerToys Telemetry + Copyright (C) 2020 Microsoft Corporation + https://github.com/microsoft/PowerToys + Github + PowerToys + en-US + true + + + + + + + + StyleCop.json + + + + + 1.1.118 + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + GlobalSuppressions.cs + + + diff --git a/src/common/SettingsAPI/SetttingsAPI.vcxproj b/src/common/SettingsAPI/SetttingsAPI.vcxproj new file mode 100644 index 0000000000..344c7b289c --- /dev/null +++ b/src/common/SettingsAPI/SetttingsAPI.vcxproj @@ -0,0 +1,54 @@ + + + + + 16.0 + {6955446D-23F7-4023-9BB3-8657F904AF99} + Win32Proj + SetttingsAPI + SetttingsAPI + + + + StaticLibrary + + + + + + + + + + ..\;..\..\;..\..\..\;%(AdditionalIncludeDirectories) + _LIB;%(PreprocessorDefinitions) + true + + + + + + + + + + + + Create + + + + + + + + + + + + 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}. + + + + + \ No newline at end of file diff --git a/src/common/SettingsAPI/pch.cpp b/src/common/SettingsAPI/pch.cpp new file mode 100644 index 0000000000..17305716aa --- /dev/null +++ b/src/common/SettingsAPI/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" \ No newline at end of file diff --git a/src/common/SettingsAPI/pch.h b/src/common/SettingsAPI/pch.h new file mode 100644 index 0000000000..9526a2f072 --- /dev/null +++ b/src/common/SettingsAPI/pch.h @@ -0,0 +1,11 @@ +#pragma once + +#define WIN32_LEAN_AND_MEAN +#define NOMINMAX +#include +#include +#include + +#include +#include + diff --git a/src/common/settings_helpers.cpp b/src/common/SettingsAPI/settings_helpers.cpp similarity index 98% rename from src/common/settings_helpers.cpp rename to src/common/SettingsAPI/settings_helpers.cpp index 8250fabc15..3bd8dd12fd 100644 --- a/src/common/settings_helpers.cpp +++ b/src/common/SettingsAPI/settings_helpers.cpp @@ -1,7 +1,5 @@ #include "pch.h" #include "settings_helpers.h" -#include -#include namespace PTSettingsHelper { diff --git a/src/common/settings_helpers.h b/src/common/SettingsAPI/settings_helpers.h similarity index 95% rename from src/common/settings_helpers.h rename to src/common/SettingsAPI/settings_helpers.h index 9e8c94e392..2437620f5d 100644 --- a/src/common/settings_helpers.h +++ b/src/common/SettingsAPI/settings_helpers.h @@ -2,7 +2,7 @@ #include #include -#include "json.h" +#include "../utils/json.h" namespace PTSettingsHelper { diff --git a/src/common/settings_objects.cpp b/src/common/SettingsAPI/settings_objects.cpp similarity index 99% rename from src/common/settings_objects.cpp rename to src/common/SettingsAPI/settings_objects.cpp index b92da8933b..5a5f6940a8 100644 --- a/src/common/settings_objects.cpp +++ b/src/common/SettingsAPI/settings_objects.cpp @@ -1,7 +1,6 @@ #include "pch.h" #include "settings_objects.h" #include "settings_helpers.h" -#include namespace PowerToysSettings { diff --git a/src/common/settings_objects.h b/src/common/SettingsAPI/settings_objects.h similarity index 99% rename from src/common/settings_objects.h rename to src/common/SettingsAPI/settings_objects.h index e27e2973ed..95e3990244 100644 --- a/src/common/settings_objects.h +++ b/src/common/SettingsAPI/settings_objects.h @@ -1,6 +1,6 @@ #pragma once -#include "json.h" +#include "../utils/json.h" namespace PowerToysSettings { diff --git a/src/common/Themes/Themes.vcxproj b/src/common/Themes/Themes.vcxproj new file mode 100644 index 0000000000..c7a7454d3a --- /dev/null +++ b/src/common/Themes/Themes.vcxproj @@ -0,0 +1,57 @@ + + + + + 16.0 + {98537082-0FDB-40DE-ABD8-0DC5A4269BAB} + Win32Proj + Themes + Themes + + + + StaticLibrary + + + + + + + + + + + + + + + + ..\..\..\;%(AdditionalIncludeDirectories) + _LIB;%(PreprocessorDefinitions) + true + NotUsing + + + + + + + + + + + + + + + + + + + + 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}. + + + + + \ No newline at end of file diff --git a/src/common/icon_helpers.cpp b/src/common/Themes/icon_helpers.cpp similarity index 96% rename from src/common/icon_helpers.cpp rename to src/common/Themes/icon_helpers.cpp index ce4e69d9bc..e5387e85a9 100644 --- a/src/common/icon_helpers.cpp +++ b/src/common/Themes/icon_helpers.cpp @@ -1,90 +1,92 @@ -#include "icon_helpers.h" -#include "pch.h" - -HRESULT GetIconIndexFromPath(_In_ PCWSTR path, _Out_ int* index) -{ - *index = 0; - - HRESULT hr = E_FAIL; - - SHFILEINFO shFileInfo = { 0 }; - - if (!PathIsRelative(path)) - { - DWORD attrib = GetFileAttributes(path); - HIMAGELIST himl = (HIMAGELIST)SHGetFileInfo(path, attrib, &shFileInfo, sizeof(shFileInfo), (SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES)); - if (himl) - { - *index = shFileInfo.iIcon; - // We shouldn't free the HIMAGELIST. - hr = S_OK; - } - } - - return hr; -} - -HBITMAP CreateBitmapFromIcon(_In_ HICON hIcon, _In_opt_ UINT width, _In_opt_ UINT height) -{ - HBITMAP hBitmapResult = NULL; - - // Create compatible DC - HDC hDC = CreateCompatibleDC(NULL); - if (hDC != NULL) - { - // Get bitmap rectangle size - RECT rc = { 0 }; - rc.left = 0; - rc.right = (width != 0) ? width : GetSystemMetrics(SM_CXSMICON); - rc.top = 0; - rc.bottom = (height != 0) ? height : GetSystemMetrics(SM_CYSMICON); - - // Create bitmap compatible with DC - BITMAPINFO BitmapInfo; - ZeroMemory(&BitmapInfo, sizeof(BITMAPINFO)); - - BitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - BitmapInfo.bmiHeader.biWidth = rc.right; - BitmapInfo.bmiHeader.biHeight = rc.bottom; - BitmapInfo.bmiHeader.biPlanes = 1; - BitmapInfo.bmiHeader.biBitCount = 32; - BitmapInfo.bmiHeader.biCompression = BI_RGB; - - HDC hDCBitmap = GetDC(NULL); - - HBITMAP hBitmap = CreateDIBSection(hDCBitmap, &BitmapInfo, DIB_RGB_COLORS, NULL, NULL, 0); - - ReleaseDC(NULL, hDCBitmap); - - if (hBitmap != NULL) - { - // Select bitmap into DC - HBITMAP hBitmapOld = (HBITMAP)SelectObject(hDC, hBitmap); - if (hBitmapOld != NULL) - { - // Draw icon into DC - if (DrawIconEx(hDC, 0, 0, hIcon, rc.right, rc.bottom, 0, NULL, DI_NORMAL)) - { - // Restore original bitmap in DC - hBitmapResult = (HBITMAP)SelectObject(hDC, hBitmapOld); - hBitmapOld = NULL; - hBitmap = NULL; - } - - if (hBitmapOld != NULL) - { - SelectObject(hDC, hBitmapOld); - } - } - - if (hBitmap != NULL) - { - DeleteObject(hBitmap); - } - } - - DeleteDC(hDC); - } - - return hBitmapResult; +#include "icon_helpers.h" +#include +#include +#include + +HRESULT GetIconIndexFromPath(_In_ PCWSTR path, _Out_ int* index) +{ + *index = 0; + + HRESULT hr = E_FAIL; + + SHFILEINFO shFileInfo = { 0 }; + + if (!PathIsRelative(path)) + { + DWORD attrib = GetFileAttributes(path); + HIMAGELIST himl = (HIMAGELIST)SHGetFileInfo(path, attrib, &shFileInfo, sizeof(shFileInfo), (SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES)); + if (himl) + { + *index = shFileInfo.iIcon; + // We shouldn't free the HIMAGELIST. + hr = S_OK; + } + } + + return hr; +} + +HBITMAP CreateBitmapFromIcon(_In_ HICON hIcon, _In_opt_ UINT width, _In_opt_ UINT height) +{ + HBITMAP hBitmapResult = NULL; + + // Create compatible DC + HDC hDC = CreateCompatibleDC(NULL); + if (hDC != NULL) + { + // Get bitmap rectangle size + RECT rc = { 0 }; + rc.left = 0; + rc.right = (width != 0) ? width : GetSystemMetrics(SM_CXSMICON); + rc.top = 0; + rc.bottom = (height != 0) ? height : GetSystemMetrics(SM_CYSMICON); + + // Create bitmap compatible with DC + BITMAPINFO BitmapInfo; + ZeroMemory(&BitmapInfo, sizeof(BITMAPINFO)); + + BitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + BitmapInfo.bmiHeader.biWidth = rc.right; + BitmapInfo.bmiHeader.biHeight = rc.bottom; + BitmapInfo.bmiHeader.biPlanes = 1; + BitmapInfo.bmiHeader.biBitCount = 32; + BitmapInfo.bmiHeader.biCompression = BI_RGB; + + HDC hDCBitmap = GetDC(NULL); + + HBITMAP hBitmap = CreateDIBSection(hDCBitmap, &BitmapInfo, DIB_RGB_COLORS, NULL, NULL, 0); + + ReleaseDC(NULL, hDCBitmap); + + if (hBitmap != NULL) + { + // Select bitmap into DC + HBITMAP hBitmapOld = (HBITMAP)SelectObject(hDC, hBitmap); + if (hBitmapOld != NULL) + { + // Draw icon into DC + if (DrawIconEx(hDC, 0, 0, hIcon, rc.right, rc.bottom, 0, NULL, DI_NORMAL)) + { + // Restore original bitmap in DC + hBitmapResult = (HBITMAP)SelectObject(hDC, hBitmapOld); + hBitmapOld = NULL; + hBitmap = NULL; + } + + if (hBitmapOld != NULL) + { + SelectObject(hDC, hBitmapOld); + } + } + + if (hBitmap != NULL) + { + DeleteObject(hBitmap); + } + } + + DeleteDC(hDC); + } + + return hBitmapResult; } \ No newline at end of file diff --git a/src/common/icon_helpers.h b/src/common/Themes/icon_helpers.h similarity index 78% rename from src/common/icon_helpers.h rename to src/common/Themes/icon_helpers.h index 46b85cbc24..500a650df3 100644 --- a/src/common/icon_helpers.h +++ b/src/common/Themes/icon_helpers.h @@ -1,5 +1,7 @@ -#pragma once -#include "common.h" - -HRESULT GetIconIndexFromPath(_In_ PCWSTR path, _Out_ int* index); +#pragma once + +#define WIN32_LEAN_AND_MEAN +#include + +HRESULT GetIconIndexFromPath(_In_ PCWSTR path, _Out_ int* index); HBITMAP CreateBitmapFromIcon(_In_ HICON hIcon, _In_opt_ UINT width = 0, _In_opt_ UINT height = 0); \ No newline at end of file diff --git a/src/common/notifications_winrt/packages.config b/src/common/Themes/packages.config similarity index 100% rename from src/common/notifications_winrt/packages.config rename to src/common/Themes/packages.config diff --git a/src/common/windows_colors.cpp b/src/common/Themes/windows_colors.cpp similarity index 99% rename from src/common/windows_colors.cpp rename to src/common/Themes/windows_colors.cpp index a48acc3fd3..962c2acf4c 100644 --- a/src/common/windows_colors.cpp +++ b/src/common/Themes/windows_colors.cpp @@ -1,4 +1,3 @@ -#include "pch.h" #include "windows_colors.h" DWORD WindowsColors::rgb_color(DWORD abgr_color) diff --git a/src/common/windows_colors.h b/src/common/Themes/windows_colors.h similarity index 94% rename from src/common/windows_colors.h rename to src/common/Themes/windows_colors.h index ec81d08b4e..564ffbb0c6 100644 --- a/src/common/windows_colors.h +++ b/src/common/Themes/windows_colors.h @@ -1,4 +1,6 @@ #pragma once +#define WIN32_LEAN_AND_MEAN +#include #include struct WindowsColors diff --git a/src/common/UnitTests-CommonLib/Settings.Tests.cpp b/src/common/UnitTests-CommonLib/Settings.Tests.cpp index 6d9148817c..d4a1a2ba87 100644 --- a/src/common/UnitTests-CommonLib/Settings.Tests.cpp +++ b/src/common/UnitTests-CommonLib/Settings.Tests.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include +#include -#include "VersionHelper.h" +#include "version/helper.h" using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace PowerToysSettings; diff --git a/src/common/UnitTests-CommonLib/UnitTests-CommonLib.rc b/src/common/UnitTests-CommonLib/UnitTests-CommonLib.rc index a1e74e496e..5a515fef17 100644 --- a/src/common/UnitTests-CommonLib/UnitTests-CommonLib.rc +++ b/src/common/UnitTests-CommonLib/UnitTests-CommonLib.rc @@ -1,6 +1,6 @@ #include #include "resource.h" -#include "../version.h" +#include "../version/version.h" 1 VERSIONINFO FILEVERSION FILE_VERSION diff --git a/src/common/UnitTests-CommonLib/UnitTests-CommonLib.vcxproj b/src/common/UnitTests-CommonLib/UnitTests-CommonLib.vcxproj index 10d7ed19b8..7e8db5df29 100644 --- a/src/common/UnitTests-CommonLib/UnitTests-CommonLib.vcxproj +++ b/src/common/UnitTests-CommonLib/UnitTests-CommonLib.vcxproj @@ -9,12 +9,10 @@ NativeUnitTestProject - DynamicLibrary false - @@ -27,10 +25,9 @@ - - ..\;..\Telemetry;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + ..\;..\Telemetry;..\..\;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) @@ -38,7 +35,6 @@ - Create @@ -50,8 +46,11 @@ - - {74485049-c722-400f-abe5-86ac52d929b3} + + {6955446d-23f7-4023-9bb3-8657f904af99} + + + {cc6e41ac-8174-4e8a-8d22-85dd7f4851df} diff --git a/src/common/UnitTests-CommonLib/UnitTests-CommonLib.vcxproj.filters b/src/common/UnitTests-CommonLib/UnitTests-CommonLib.vcxproj.filters index c947aaa9cb..ca76619315 100644 --- a/src/common/UnitTests-CommonLib/UnitTests-CommonLib.vcxproj.filters +++ b/src/common/UnitTests-CommonLib/UnitTests-CommonLib.vcxproj.filters @@ -24,9 +24,6 @@ Source Files - - Source Files - diff --git a/src/common/UnitTests-CommonLib/UnitTestsCommon.cpp b/src/common/UnitTests-CommonLib/UnitTestsCommon.cpp deleted file mode 100644 index e495863d10..0000000000 --- a/src/common/UnitTests-CommonLib/UnitTestsCommon.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "pch.h" -#include "common.h" - -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - -namespace UnitTestsCommon -{ - TEST_CLASS (CommonUtils) - { - std::vector what_global{ - L"TELEGRAM", - L"SUBLIME TEXT", - L"PROGRAM", - L"TEXT", - }; - - TEST_METHOD (FindAppNameInPathTest1) - { - std::wstring where(L"C:\\USERS\\GUEST\\APPDATA\\ROAMING\\TELEGRAM DESKTOP\\TELEGRAM.EXE"); - bool ans = find_app_name_in_path(where, what_global); - Assert::IsTrue(ans); - } - TEST_METHOD (FindAppNameInPathTest2) - { - std::vector what{ - L"NOTEPAD", - }; - std::wstring where(L"C:\\PROGRAM FILES\\NOTEPAD++\\NOTEPAD++.EXE"); - bool ans = find_app_name_in_path(where, what); - Assert::IsTrue(ans); - } - TEST_METHOD (FindAppNameInPathTest3) - { - std::vector what{ - L"NOTEPAD++.EXE", - }; - std::wstring where(L"C:\\PROGRAM FILES\\NOTEPAD++\\NOTEPAD++.EXE"); - bool ans = find_app_name_in_path(where, what); - Assert::IsTrue(ans); - } - TEST_METHOD (FindAppNameInPathTest4) - { - std::wstring where(L"C:\\PROGRAM FILES\\SUBLIME TEXT 3\\SUBLIME_TEXT.EXE"); - bool ans = find_app_name_in_path(where, what_global); - Assert::IsFalse(ans); - } - TEST_METHOD (FindAppNameInPathTest5) - { - std::vector what{ - L"NOTEPAD.EXE", - }; - std::wstring where(L"C:\\PROGRAM FILES\\NOTEPAD++\\NOTEPAD++.EXE"); - bool ans = find_app_name_in_path(where, what); - Assert::IsFalse(ans); - } - }; -} diff --git a/src/common/UnitTests-CommonLib/UnitTestsVersionHelper.cpp b/src/common/UnitTests-CommonLib/UnitTestsVersionHelper.cpp index 79424a4827..7d6f54024c 100644 --- a/src/common/UnitTests-CommonLib/UnitTestsVersionHelper.cpp +++ b/src/common/UnitTests-CommonLib/UnitTestsVersionHelper.cpp @@ -1,6 +1,6 @@ #include "pch.h" -#include "VersionHelper.h" +#include using namespace Microsoft::VisualStudio::CppUnitTestFramework; diff --git a/src/common/WinStore/Winstore.vcxproj b/src/common/WinStore/Winstore.vcxproj new file mode 100644 index 0000000000..6c550a0b9d --- /dev/null +++ b/src/common/WinStore/Winstore.vcxproj @@ -0,0 +1,55 @@ + + + + + 16.0 + {C502A854-53AC-4EBB-8DC0-E4AF2191E4F6} + Win32Proj + WinStore + WinStore + + + + StaticLibrary + + + + + + + + + + + + + + + + ..\..\..\;%(AdditionalIncludeDirectories) + _LIB;%(PreprocessorDefinitions) + true + NotUsing + + + + + + + + + + + + + + + + + + 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}. + + + + + \ No newline at end of file diff --git a/src/common/packages.config b/src/common/WinStore/packages.config similarity index 59% rename from src/common/packages.config rename to src/common/WinStore/packages.config index fda08e21c1..81f107b8bc 100644 --- a/src/common/packages.config +++ b/src/common/WinStore/packages.config @@ -1,5 +1,4 @@  - \ No newline at end of file diff --git a/src/common/winstore.cpp b/src/common/WinStore/winstore.cpp similarity index 96% rename from src/common/winstore.cpp rename to src/common/WinStore/winstore.cpp index a289a488fb..270bd61d44 100644 --- a/src/common/winstore.cpp +++ b/src/common/WinStore/winstore.cpp @@ -1,10 +1,8 @@ -#include "pch.h" #include "winstore.h" +#include #include -#include - using winrt::Windows::ApplicationModel::StartupTask; namespace diff --git a/src/common/winstore.h b/src/common/WinStore/winstore.h similarity index 82% rename from src/common/winstore.h rename to src/common/WinStore/winstore.h index 3846d3d418..514bfeef07 100644 --- a/src/common/winstore.h +++ b/src/common/WinStore/winstore.h @@ -2,6 +2,8 @@ #include +#include +#include #include namespace winstore diff --git a/src/common/common-md-flag/common-md-flag.vcxproj.filters b/src/common/common-md-flag/common-md-flag.vcxproj.filters deleted file mode 100644 index d6f5a68088..0000000000 --- a/src/common/common-md-flag/common-md-flag.vcxproj.filters +++ /dev/null @@ -1,60 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;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 - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - - \ No newline at end of file diff --git a/src/common/common.cpp b/src/common/common.cpp deleted file mode 100644 index ce32d257e5..0000000000 --- a/src/common/common.cpp +++ /dev/null @@ -1,638 +0,0 @@ -#include "pch.h" -#include "common.h" -#include -#pragma comment(lib, "dwmapi.lib") -#include -#include -#include "version.h" - -#include - -#pragma comment(lib, "advapi32.lib") -#pragma comment(lib, "shlwapi.lib") - -std::optional get_window_pos(HWND hwnd) -{ - RECT window; - if (DwmGetWindowAttribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, &window, sizeof(window)) == S_OK) - { - return window; - } - else - { - return {}; - } -} - -bool is_system_window(HWND hwnd, const char* class_name) -{ - // We compare the HWND against HWND of the desktop and shell windows, - // we also filter out some window class names know to belong to the taskbar. - static auto system_classes = { "SysListView32", "WorkerW", "Shell_TrayWnd", "Shell_SecondaryTrayWnd", "Progman" }; - static auto system_hwnds = { GetDesktopWindow(), GetShellWindow() }; - for (auto system_hwnd : system_hwnds) - { - if (hwnd == system_hwnd) - { - return true; - } - } - for (const auto& system_class : system_classes) - { - if (strcmp(system_class, class_name) == 0) - { - return true; - } - } - return false; -} - -int run_message_loop(const bool until_idle, const std::optional timeout_seconds) -{ - MSG msg{}; - bool stop = false; - UINT_PTR timerId = 0; - if (timeout_seconds.has_value()) - { - timerId = SetTimer(nullptr, 0, *timeout_seconds * 1000, nullptr); - } - - while (!stop && GetMessageW(&msg, nullptr, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessageW(&msg); - stop = until_idle && !PeekMessageW(&msg, nullptr, 0, 0, PM_NOREMOVE); - stop = stop || (msg.message == WM_TIMER && msg.wParam == timerId); - } - if (timeout_seconds.has_value()) - { - KillTimer(nullptr, timerId); - } - return static_cast(msg.wParam); -} - -std::optional get_last_error_message(const DWORD dw) -{ - std::optional message; - try - { - const auto msg = std::system_category().message(dw); - message.emplace(begin(msg), end(msg)); - } - catch (...) - { - } - return message; -} - -void show_last_error_message(LPCWSTR functionName, DWORD dw, LPCWSTR errorTitle) -{ - const auto system_message = get_last_error_message(dw); - if (!system_message.has_value()) - { - return; - } - LPWSTR lpDisplayBuf = (LPWSTR)LocalAlloc(LMEM_ZEROINIT, (system_message->size() + lstrlenW(functionName) + 40) * sizeof(WCHAR)); - if (lpDisplayBuf != NULL) - { - StringCchPrintfW(lpDisplayBuf, - LocalSize(lpDisplayBuf) / sizeof(WCHAR), - L"%s: %s (%d)", - functionName, - system_message->c_str(), - dw); - MessageBoxW(NULL, (LPCTSTR)lpDisplayBuf, errorTitle, MB_OK | MB_ICONERROR); - LocalFree(lpDisplayBuf); - } -} - -WindowState get_window_state(HWND hwnd) -{ - WINDOWPLACEMENT placement; - placement.length = sizeof(WINDOWPLACEMENT); - - if (GetWindowPlacement(hwnd, &placement) == 0) - { - return UNKNOWN; - } - - if (placement.showCmd == SW_MINIMIZE || placement.showCmd == SW_SHOWMINIMIZED || IsIconic(hwnd)) - { - return MINIMIZED; - } - - if (placement.showCmd == SW_MAXIMIZE || placement.showCmd == SW_SHOWMAXIMIZED) - { - return MAXIMIZED; - } - - auto rectp = get_window_pos(hwnd); - if (!rectp) - { - return UNKNOWN; - } - - auto rect = *rectp; - MONITORINFO monitor; - monitor.cbSize = sizeof(MONITORINFO); - auto h_monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); - GetMonitorInfo(h_monitor, &monitor); - bool top_left = monitor.rcWork.top == rect.top && monitor.rcWork.left == rect.left; - bool bottom_left = monitor.rcWork.bottom == rect.bottom && monitor.rcWork.left == rect.left; - bool top_right = monitor.rcWork.top == rect.top && monitor.rcWork.right == rect.right; - bool bottom_right = monitor.rcWork.bottom == rect.bottom && monitor.rcWork.right == rect.right; - - if (top_left && bottom_left) - return SNAPED_LEFT; - if (top_left) - return SNAPED_TOP_LEFT; - if (bottom_left) - return SNAPED_BOTTOM_LEFT; - if (top_right && bottom_right) - return SNAPED_RIGHT; - if (top_right) - return SNAPED_TOP_RIGHT; - if (bottom_right) - return SNAPED_BOTTOM_RIGHT; - - return RESTORED; -} - -bool is_process_elevated(const bool use_cached_value) -{ - auto detection_func = []() { - HANDLE token = nullptr; - bool elevated = false; - - if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) - { - TOKEN_ELEVATION elevation; - DWORD size; - if (GetTokenInformation(token, TokenElevation, &elevation, sizeof(elevation), &size)) - { - elevated = (elevation.TokenIsElevated != 0); - } - } - - if (token) - { - CloseHandle(token); - } - - return elevated; - }; - static const bool cached_value = detection_func(); - return use_cached_value ? cached_value : detection_func(); -} - -bool drop_elevated_privileges() -{ - HANDLE token = nullptr; - LPCTSTR lpszPrivilege = SE_SECURITY_NAME; - if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_DEFAULT | WRITE_OWNER, &token)) - { - return false; - } - - PSID medium_sid = NULL; - if (!::ConvertStringSidToSid(SDDL_ML_MEDIUM, &medium_sid)) - { - return false; - } - - TOKEN_MANDATORY_LABEL label = { 0 }; - label.Label.Attributes = SE_GROUP_INTEGRITY; - label.Label.Sid = medium_sid; - DWORD size = (DWORD)sizeof(TOKEN_MANDATORY_LABEL) + ::GetLengthSid(medium_sid); - - BOOL result = SetTokenInformation(token, TokenIntegrityLevel, &label, size); - LocalFree(medium_sid); - CloseHandle(token); - - return result; -} - -std::wstring get_process_path(DWORD pid) noexcept -{ - auto process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, TRUE, pid); - std::wstring name; - if (process != INVALID_HANDLE_VALUE) - { - name.resize(MAX_PATH); - DWORD name_length = static_cast(name.length()); - if (QueryFullProcessImageNameW(process, 0, (LPWSTR)name.data(), &name_length) == 0) - { - name_length = 0; - } - name.resize(name_length); - CloseHandle(process); - } - return name; -} - -HANDLE run_elevated(const std::wstring& file, const std::wstring& params) -{ - SHELLEXECUTEINFOW exec_info = { 0 }; - exec_info.cbSize = sizeof(SHELLEXECUTEINFOW); - exec_info.lpVerb = L"runas"; - exec_info.lpFile = file.c_str(); - exec_info.lpParameters = params.c_str(); - exec_info.hwnd = 0; - exec_info.fMask = SEE_MASK_NOCLOSEPROCESS; - exec_info.lpDirectory = 0; - exec_info.hInstApp = 0; - exec_info.nShow = SW_SHOWDEFAULT; - - return ShellExecuteExW(&exec_info) ? exec_info.hProcess : nullptr; -} - -bool run_non_elevated(const std::wstring& file, const std::wstring& params, DWORD* returnPid) -{ - auto executable_args = L"\"" + file + L"\""; - if (!params.empty()) - { - executable_args += L" " + params; - } - - HWND hwnd = GetShellWindow(); - if (!hwnd) - { - return false; - } - DWORD pid; - GetWindowThreadProcessId(hwnd, &pid); - - winrt::handle process{ OpenProcess(PROCESS_CREATE_PROCESS, FALSE, pid) }; - if (!process) - { - return false; - } - - SIZE_T size = 0; - - InitializeProcThreadAttributeList(nullptr, 1, 0, &size); - auto pproc_buffer = std::make_unique(size); - auto pptal = reinterpret_cast(pproc_buffer.get()); - - if (!InitializeProcThreadAttributeList(pptal, 1, 0, &size)) - { - return false; - } - - HANDLE process_handle = process.get(); - if (!pptal || !UpdateProcThreadAttribute(pptal, - 0, - PROC_THREAD_ATTRIBUTE_PARENT_PROCESS, - &process_handle, - sizeof(process_handle), - nullptr, - nullptr)) - { - return false; - } - - STARTUPINFOEX siex = { 0 }; - siex.lpAttributeList = pptal; - siex.StartupInfo.cb = sizeof(siex); - - PROCESS_INFORMATION pi = { 0 }; - auto succeeded = CreateProcessW(file.c_str(), - const_cast(executable_args.c_str()), - nullptr, - nullptr, - FALSE, - EXTENDED_STARTUPINFO_PRESENT, - nullptr, - nullptr, - &siex.StartupInfo, - &pi); - if (succeeded) - { - if (pi.hProcess) - { - if (returnPid) - { - *returnPid = GetProcessId(pi.hProcess); - } - - CloseHandle(pi.hProcess); - } - if (pi.hThread) - { - CloseHandle(pi.hThread); - } - } - - return succeeded; -} - -bool run_same_elevation(const std::wstring& file, const std::wstring& params, DWORD* returnPid) -{ - auto executable_args = L"\"" + file + L"\""; - if (!params.empty()) - { - executable_args += L" " + params; - } - - STARTUPINFO si = { 0 }; - PROCESS_INFORMATION pi = { 0 }; - auto succeeded = CreateProcessW(file.c_str(), - const_cast(executable_args.c_str()), - nullptr, - nullptr, - FALSE, - 0, - nullptr, - nullptr, - &si, - &pi); - - if (succeeded) - { - if (pi.hProcess) - { - if (returnPid) - { - *returnPid = GetProcessId(pi.hProcess); - } - - CloseHandle(pi.hProcess); - } - - if (pi.hThread) - { - CloseHandle(pi.hThread); - } - } - return succeeded; -} - -std::wstring get_process_path(HWND window) noexcept -{ - const static std::wstring app_frame_host = L"ApplicationFrameHost.exe"; - DWORD pid{}; - GetWindowThreadProcessId(window, &pid); - auto name = get_process_path(pid); - if (name.length() >= app_frame_host.length() && - name.compare(name.length() - app_frame_host.length(), app_frame_host.length(), app_frame_host) == 0) - { - // It is a UWP app. We will enumerate the windows and look for one created - // by something with a different PID - DWORD new_pid = pid; - EnumChildWindows( - window, [](HWND hwnd, LPARAM param) -> BOOL { - auto new_pid_ptr = reinterpret_cast(param); - DWORD pid; - GetWindowThreadProcessId(hwnd, &pid); - if (pid != *new_pid_ptr) - { - *new_pid_ptr = pid; - return FALSE; - } - else - { - return TRUE; - } - }, - reinterpret_cast(&new_pid)); - // If we have a new pid, get the new name. - if (new_pid != pid) - { - return get_process_path(new_pid); - } - } - return name; -} - -std::wstring get_product_version() -{ - static std::wstring version = L"v" + std::to_wstring(VERSION_MAJOR) + - L"." + std::to_wstring(VERSION_MINOR) + - L"." + std::to_wstring(VERSION_REVISION); - - return version; -} - -std::wstring get_resource_string(UINT resource_id, HINSTANCE instance, const wchar_t* fallback) -{ - wchar_t* text_ptr; - auto length = LoadStringW(instance, resource_id, reinterpret_cast(&text_ptr), 0); - if (length == 0) - { - return fallback; - } - else - { - return { text_ptr, static_cast(length) }; - } -} - -std::wstring get_module_filename(HMODULE mod) -{ - wchar_t buffer[MAX_PATH + 1]; - DWORD actual_length = GetModuleFileNameW(mod, buffer, MAX_PATH); - if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) - { - const DWORD long_path_length = 0xFFFF; // should be always enough - std::wstring long_filename(long_path_length, L'\0'); - actual_length = GetModuleFileNameW(mod, long_filename.data(), long_path_length); - return long_filename.substr(0, actual_length); - } - return { buffer, actual_length }; -} - -std::wstring get_module_folderpath(HMODULE mod, const bool removeFilename) -{ - wchar_t buffer[MAX_PATH + 1]; - DWORD actual_length = GetModuleFileNameW(mod, buffer, MAX_PATH); - if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) - { - const DWORD long_path_length = 0xFFFF; // should be always enough - std::wstring long_filename(long_path_length, L'\0'); - actual_length = GetModuleFileNameW(mod, long_filename.data(), long_path_length); - PathRemoveFileSpecW(long_filename.data()); - long_filename.resize(std::wcslen(long_filename.data())); - long_filename.shrink_to_fit(); - return long_filename; - } - - if (removeFilename) - { - PathRemoveFileSpecW(buffer); - } - return { buffer, (UINT)lstrlenW(buffer) }; -} - -// The function returns true in case of error since we want to return false -// only in case of a positive verification that the user is not an admin. -bool check_user_is_admin() -{ - auto freeMemory = [](PSID pSID, PTOKEN_GROUPS pGroupInfo) { - if (pSID) - { - FreeSid(pSID); - } - if (pGroupInfo) - { - GlobalFree(pGroupInfo); - } - }; - - HANDLE hToken; - DWORD dwSize = 0; - PTOKEN_GROUPS pGroupInfo; - SID_IDENTIFIER_AUTHORITY SIDAuth = SECURITY_NT_AUTHORITY; - PSID pSID = NULL; - - // Open a handle to the access token for the calling process. - if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) - { - return true; - } - - // Call GetTokenInformation to get the buffer size. - if (!GetTokenInformation(hToken, TokenGroups, NULL, dwSize, &dwSize)) - { - if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) - { - return true; - } - } - - // Allocate the buffer. - pGroupInfo = (PTOKEN_GROUPS)GlobalAlloc(GPTR, dwSize); - - // Call GetTokenInformation again to get the group information. - if (!GetTokenInformation(hToken, TokenGroups, pGroupInfo, dwSize, &dwSize)) - { - freeMemory(pSID, pGroupInfo); - return true; - } - - // Create a SID for the BUILTIN\Administrators group. - if (!AllocateAndInitializeSid(&SIDAuth, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &pSID)) - { - freeMemory(pSID, pGroupInfo); - return true; - } - - // Loop through the group SIDs looking for the administrator SID. - for (DWORD i = 0; i < pGroupInfo->GroupCount; ++i) - { - if (EqualSid(pSID, pGroupInfo->Groups[i].Sid)) - { - freeMemory(pSID, pGroupInfo); - return true; - } - } - - freeMemory(pSID, pGroupInfo); - return false; -} - -bool find_app_name_in_path(const std::wstring& where, const std::vector& what) -{ - for (const auto& row : what) - { - const auto pos = where.rfind(row); - const auto last_slash = where.rfind('\\'); - //Check that row occurs in where, and its last occurrence contains in itself the first character after the last backslash. - if (pos != std::wstring::npos && pos <= last_slash + 1 && pos + row.length() > last_slash) - { - return true; - } - } - return false; -} - -std::optional exec_and_read_output(const std::wstring_view command, DWORD timeout_ms) -{ - SECURITY_ATTRIBUTES saAttr{ sizeof(saAttr) }; - saAttr.bInheritHandle = false; - - constexpr size_t bufferSize = 4096; - // We must use a named pipe for async I/O - char pipename[MAX_PATH + 1]; - if (!GetTempFileNameA(R"(\\.\pipe\)", "tmp", 1, pipename)) - { - return std::nullopt; - } - - wil::unique_handle readPipe{ CreateNamedPipeA(pipename, PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE, PIPE_UNLIMITED_INSTANCES, bufferSize, bufferSize, 0, &saAttr) }; - - saAttr.bInheritHandle = true; - wil::unique_handle writePipe{ CreateFileA(pipename, GENERIC_WRITE, 0, &saAttr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr) }; - - if (!readPipe || !writePipe) - { - return std::nullopt; - } - - PROCESS_INFORMATION piProcInfo{}; - STARTUPINFOW siStartInfo{ sizeof(siStartInfo) }; - - siStartInfo.hStdError = writePipe.get(); - siStartInfo.hStdOutput = writePipe.get(); - siStartInfo.dwFlags |= STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; - siStartInfo.wShowWindow = SW_HIDE; - - std::wstring cmdLine{ command }; - if (!CreateProcessW(nullptr, - cmdLine.data(), - nullptr, - nullptr, - true, - NORMAL_PRIORITY_CLASS | CREATE_NEW_CONSOLE, - nullptr, - nullptr, - &siStartInfo, - &piProcInfo)) - { - return std::nullopt; - } - // Child process inherited the write end of the pipe, we can close it now - writePipe.reset(); - - auto closeProcessHandles = wil::scope_exit([&] { - CloseHandle(piProcInfo.hThread); - CloseHandle(piProcInfo.hProcess); - }); - - std::string childOutput; - bool processExited = false; - for (;;) - { - char buffer[bufferSize]; - DWORD gotBytes = 0; - wil::unique_handle IOEvent{ CreateEventW(nullptr, true, false, nullptr) }; - OVERLAPPED overlapped{ .hEvent = IOEvent.get() }; - ReadFile(readPipe.get(), buffer, sizeof(buffer), nullptr, &overlapped); - - const std::array handlesToWait = { overlapped.hEvent, piProcInfo.hProcess }; - switch (WaitForMultipleObjects(1 + !processExited, handlesToWait.data(), false, timeout_ms)) - { - case WAIT_OBJECT_0 + 1: - if (!processExited) - { - // When the process exits, we can reduce timeout and read the rest of the output w/o possibly big timeout - timeout_ms = 1000; - processExited = true; - closeProcessHandles.reset(); - } - [[fallthrough]]; - case WAIT_OBJECT_0: - if (GetOverlappedResultEx(readPipe.get(), &overlapped, &gotBytes, timeout_ms, true)) - { - childOutput += std::string_view{ buffer, gotBytes }; - break; - } - // Timeout - [[fallthrough]]; - default: - goto exit; - } - } -exit: - CancelIo(readPipe.get()); - return childOutput; -} diff --git a/src/common/common.h b/src/common/common.h deleted file mode 100644 index ed3db9e0a4..0000000000 --- a/src/common/common.h +++ /dev/null @@ -1,99 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include -#include - - -// Gets position of given window. -std::optional get_window_pos(HWND hwnd); - -// Check if window is part of the shell or the taskbar. -bool is_system_window(HWND hwnd, const char* class_name); - -// Initializes and runs windows message loop -int run_message_loop(const bool until_idle = false, const std::optional timeout_seconds = {}); - -std::optional get_last_error_message(const DWORD dw); -void show_last_error_message(LPCWSTR lpszFunction, DWORD dw, LPCWSTR errorTitle); - -enum WindowState -{ - UNKNOWN, - MINIMIZED, - MAXIMIZED, - SNAPED_TOP_LEFT, - SNAPED_LEFT, - SNAPED_BOTTOM_LEFT, - SNAPED_TOP_RIGHT, - SNAPED_RIGHT, - SNAPED_BOTTOM_RIGHT, - RESTORED -}; -WindowState get_window_state(HWND hwnd); - -// Returns true if the current process is running with elevated privileges -bool is_process_elevated(const bool use_cached_value = true); - -// Drops the elevated privileges if present -bool drop_elevated_privileges(); - -// Run command as elevated user, returns true if succeeded -HANDLE run_elevated(const std::wstring& file, const std::wstring& params); - -// Run command as non-elevated user, returns true if succeeded, puts the process id into returnPid if returnPid != NULL -bool run_non_elevated(const std::wstring& file, const std::wstring& params, DWORD* returnPid); - -// Run command with the same elevation, returns true if succeeded -bool run_same_elevation(const std::wstring& file, const std::wstring& params, DWORD* returnPid); - -// Returns true if the current process is running from administrator account -bool check_user_is_admin(); - -// Returns true when one or more strings from vector found in string -bool find_app_name_in_path(const std::wstring& where, const std::vector& what); - -// Get the executable path or module name for modern apps -std::wstring get_process_path(DWORD pid) noexcept; -// Get the executable path or module name for modern apps -std::wstring get_process_path(HWND hwnd) noexcept; - -std::wstring get_product_version(); - -std::wstring get_module_filename(HMODULE mod = nullptr); -std::wstring get_module_folderpath(HMODULE mod = nullptr, const bool removeFilename = true); - -// Get a string from the resource file -std::wstring get_resource_string(UINT resource_id, HINSTANCE instance, const wchar_t* fallback); -// Wrapper for getting a string from the resource file. Returns the resource id text when fails. -// Requires that -// extern "C" IMAGE_DOS_HEADER __ImageBase; -// is added to the .cpp file. -#define GET_RESOURCE_STRING(resource_id) get_resource_string(resource_id, reinterpret_cast(&__ImageBase), L#resource_id) - -std::optional exec_and_read_output(const std::wstring_view command, DWORD timeout_ms = 30000); - -// Helper class for various COM-related APIs, e.g working with security descriptors -template -struct typed_storage -{ - std::unique_ptr _buffer; - inline explicit typed_storage(const DWORD size) : - _buffer{ std::make_unique(size) } - { - } - inline operator T*() - { - return reinterpret_cast(_buffer.get()); - } -}; - -template -struct overloaded : Ts... -{ - using Ts::operator()...; -}; -template -overloaded(Ts...) -> overloaded; diff --git a/src/common/common.vcxproj b/src/common/common.vcxproj deleted file mode 100644 index c8f448c2f4..0000000000 --- a/src/common/common.vcxproj +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - 15.0 - {74485049-C722-400F-ABE5-86AC52D929B3} - Win32Proj - common - common - - - - - - StaticLibrary - - - - - - - - - - - - - - - - - - _DEBUG;_LIB;%(PreprocessorDefinitions) - inc;telemetry;%(AdditionalIncludeDirectories) - - - - - NDEBUG;_LIB;%(PreprocessorDefinitions) - inc;telemetry;%(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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}. - - - - - - \ No newline at end of file diff --git a/src/common/common.vcxproj.filters b/src/common/common.vcxproj.filters deleted file mode 100644 index e3388b3b29..0000000000 --- a/src/common/common.vcxproj.filters +++ /dev/null @@ -1,217 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - - {3e9f944e-5d97-4a28-8865-2eff3a3568e7} - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files\Telemetry - - - Header Files\Telemetry - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - - \ No newline at end of file diff --git a/src/common/LowlevelKeyboardEvent.h b/src/common/hooks/LowlevelKeyboardEvent.h similarity index 100% rename from src/common/LowlevelKeyboardEvent.h rename to src/common/hooks/LowlevelKeyboardEvent.h diff --git a/src/common/WinHookEvent.h b/src/common/hooks/WinHookEvent.h similarity index 100% rename from src/common/WinHookEvent.h rename to src/common/hooks/WinHookEvent.h diff --git a/src/common/interop/KeyboardHook.cpp b/src/common/interop/KeyboardHook.cpp index c13a60dcb9..e0cbca73c0 100644 --- a/src/common/interop/KeyboardHook.cpp +++ b/src/common/interop/KeyboardHook.cpp @@ -1,10 +1,10 @@ #include "pch.h" #include "KeyboardHook.h" #include -#include -#include +#include +#include #include -#include +#include using namespace interop; using namespace System::Runtime::InteropServices; diff --git a/src/common/interop/interop.vcxproj b/src/common/interop/PowerToysInterop.vcxproj similarity index 87% rename from src/common/interop/interop.vcxproj rename to src/common/interop/PowerToysInterop.vcxproj index 707ca211ce..e0958df04c 100644 --- a/src/common/interop/interop.vcxproj +++ b/src/common/interop/PowerToysInterop.vcxproj @@ -1,117 +1,118 @@ - - - - - PowerToysInterop - Microsoft Corp. - Copyright (C) 2019 Microsoft Corp. - - - 16.0 - {F055103B-F80B-4D0C-BF48-057C55620033} - v4.7.2 - ManagedCProj - PowerToysInterop - - - - DynamicLibrary - true - - - - - - - - - - - - - - - PowerToysInterop - $(SolutionDir)$(Platform)\$(Configuration)\ - - - - - MultiThreadedDebugDLL - - - - - MultiThreadedDLL - - - - - - $(SolutionDir)src\common\interop;../../;../;%(AdditionalIncludeDirectories) - false - /Zc:twoPhase- - stdcpp17 - - - WindowsApp.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create - - - - - - - - - - - - - {985b3f2f-ceed-4c0a-a249-69257e719145} - - - - - + + + + + PowerToysInterop + Microsoft Corp. + Copyright (C) 2019 Microsoft Corp. + + + 16.0 + {F055103B-F80B-4D0C-BF48-057C55620033} + v4.7.2 + ManagedCProj + PowerToysInterop + PowerToysInterop + + + + DynamicLibrary + true + + + + + + + + + + + + + + + PowerToysInterop + $(SolutionDir)$(Platform)\$(Configuration)\ + + + + MultiThreadedDebugDLL + + + + + MultiThreadedDLL + + + + + NotUsing + $(SolutionDir)src\common\interop;../../;../;%(AdditionalIncludeDirectories) + false + /Zc:twoPhase- + stdcpp17 + + + WindowsApp.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + false + + + false + false + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/common/interop/interop.vcxproj.filters b/src/common/interop/PowerToysInterop.vcxproj.filters similarity index 88% rename from src/common/interop/interop.vcxproj.filters rename to src/common/interop/PowerToysInterop.vcxproj.filters index 5ea6de842e..fe86d91de6 100644 --- a/src/common/interop/interop.vcxproj.filters +++ b/src/common/interop/PowerToysInterop.vcxproj.filters @@ -1,56 +1,62 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;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 - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Resource Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;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 + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + \ No newline at end of file diff --git a/src/common/async_message_queue.h b/src/common/interop/async_message_queue.h similarity index 100% rename from src/common/async_message_queue.h rename to src/common/interop/async_message_queue.h diff --git a/src/common/interop-tests/InteropTests.cs b/src/common/interop/interop-tests/InteropTests.cs similarity index 100% rename from src/common/interop-tests/InteropTests.cs rename to src/common/interop/interop-tests/InteropTests.cs diff --git a/src/common/interop-tests/Microsoft.Interop.Tests.csproj b/src/common/interop/interop-tests/Microsoft.Interop.Tests.csproj similarity index 92% rename from src/common/interop-tests/Microsoft.Interop.Tests.csproj rename to src/common/interop/interop-tests/Microsoft.Interop.Tests.csproj index 3c7656a17a..bd026c1fd5 100644 --- a/src/common/interop-tests/Microsoft.Interop.Tests.csproj +++ b/src/common/interop/interop-tests/Microsoft.Interop.Tests.csproj @@ -1,5 +1,5 @@  - + netcoreapp3.1 @@ -72,16 +72,16 @@ - + GlobalSuppressions.cs - + StyleCop.json - + diff --git a/src/common/interop/interop.h b/src/common/interop/interop.h index 45f71e44a6..183de8051b 100644 --- a/src/common/interop/interop.h +++ b/src/common/interop/interop.h @@ -1,13 +1,14 @@ #pragma once -#include -#include +#include +#include #include -#include "..\keyboard_layout.h" -#include "..\two_way_pipe_message_ipc.h" -#include "..\common.h" -#include "..\shared_constants.h" -#include "..\os-detect.h" +#include "keyboard_layout.h" +#include "two_way_pipe_message_ipc.h" +#include "shared_constants.h" +#include "../utils/os-detect.h" + +#include using namespace System; using namespace System::Runtime::InteropServices; @@ -56,7 +57,7 @@ public { _wrapperCallback = gcnew InternalReadCallback(this, &TwoWayPipeMessageIPCManaged::ReadCallbackHelper); _callback = callback; - + TwoWayPipeMessageIPC::callback_function cb = nullptr; if (callback != nullptr) { @@ -107,12 +108,11 @@ public } }; - public +public ref class CommonManaged { public: - static String^ GetProductVersion() - { + static String ^ GetProductVersion() { return gcnew String(get_product_version().c_str()); } @@ -122,14 +122,13 @@ public } }; - public +public ref class Constants { public: literal int VK_WIN_BOTH = CommonSharedConstants::VK_WIN_BOTH; - - static String^ PowerLauncherSharedEvent() - { + + static String ^ PowerLauncherSharedEvent() { return gcnew String(CommonSharedConstants::POWER_LAUNCHER_SHARED_EVENT); } }; diff --git a/src/common/interop/interop.rc b/src/common/interop/interop.rc index 9cd6d02314..e8bb6947bd 100644 --- a/src/common/interop/interop.rc +++ b/src/common/interop/interop.rc @@ -1,6 +1,6 @@ ÿþ#include <windows.h> #include "resource.h" -#include "../version.h" +#include "../version/version.h" 1 VERSIONINFO FILEVERSION FILE_VERSION diff --git a/src/common/keyboard_layout.cpp b/src/common/interop/keyboard_layout.cpp similarity index 100% rename from src/common/keyboard_layout.cpp rename to src/common/interop/keyboard_layout.cpp diff --git a/src/common/keyboard_layout.h b/src/common/interop/keyboard_layout.h similarity index 95% rename from src/common/keyboard_layout.h rename to src/common/interop/keyboard_layout.h index 4b1504c466..c6b7cf21cc 100644 --- a/src/common/keyboard_layout.h +++ b/src/common/interop/keyboard_layout.h @@ -1,20 +1,20 @@ -#pragma once -#include -#include -#include -#include - -class LayoutMap -{ -public: - LayoutMap(); - ~LayoutMap(); - void UpdateLayout(); - std::wstring GetKeyName(DWORD key); - std::vector GetKeyCodeList(const bool isShortcut = false); - std::vector> GetKeyNameList(const bool isShortcut = false); - -private: - class LayoutMapImpl; - LayoutMapImpl* impl; -}; +#pragma once +#include +#include +#include +#include + +class LayoutMap +{ +public: + LayoutMap(); + ~LayoutMap(); + void UpdateLayout(); + std::wstring GetKeyName(DWORD key); + std::vector GetKeyCodeList(const bool isShortcut = false); + std::vector> GetKeyNameList(const bool isShortcut = false); + +private: + class LayoutMapImpl; + LayoutMapImpl* impl; +}; diff --git a/src/common/keyboard_layout_impl.h b/src/common/interop/keyboard_layout_impl.h similarity index 100% rename from src/common/keyboard_layout_impl.h rename to src/common/interop/keyboard_layout_impl.h diff --git a/src/common/shared_constants.h b/src/common/interop/shared_constants.h similarity index 71% rename from src/common/shared_constants.h rename to src/common/interop/shared_constants.h index 196901394c..5446057c92 100644 --- a/src/common/shared_constants.h +++ b/src/common/interop/shared_constants.h @@ -1,17 +1,18 @@ #pragma once -#include "common.h" + +#include namespace CommonSharedConstants { // Flag that can be set on an input event so that it is ignored by Keyboard Manager - const ULONG_PTR KEYBOARDMANAGER_INJECTED_FLAG = 0x1; + const uintptr_t KEYBOARDMANAGER_INJECTED_FLAG = 0x1; // Fake key code to represent VK_WIN. - inline const DWORD VK_WIN_BOTH = 0x104; + inline const int VK_WIN_BOTH = 0x104; // Path to the event used by PowerLauncher const wchar_t POWER_LAUNCHER_SHARED_EVENT[] = L"Local\\PowerToysRunInvokeEvent-30f26ad7-d36d-4c0e-ab02-68bb5ff3c4ab"; // Max DWORD for key code to disable keys. - const DWORD VK_DISABLED = 0x100; + const int VK_DISABLED = 0x100; } \ No newline at end of file diff --git a/src/common/two_way_pipe_message_ipc.cpp b/src/common/interop/two_way_pipe_message_ipc.cpp similarity index 99% rename from src/common/two_way_pipe_message_ipc.cpp rename to src/common/interop/two_way_pipe_message_ipc.cpp index 5b17ec064a..ec4da61d6b 100644 --- a/src/common/two_way_pipe_message_ipc.cpp +++ b/src/common/interop/two_way_pipe_message_ipc.cpp @@ -1,6 +1,8 @@ #include "pch.h" #include "two_way_pipe_message_ipc_impl.h" +#include + #pragma comment(lib, "advapi32.lib") TwoWayPipeMessageIPC::TwoWayPipeMessageIPC( @@ -34,7 +36,6 @@ void TwoWayPipeMessageIPC::end() impl->end(); } - TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::TwoWayPipeMessageIPCImpl( std::wstring _input_pipe_name, std::wstring _output_pipe_name, diff --git a/src/common/two_way_pipe_message_ipc.h b/src/common/interop/two_way_pipe_message_ipc.h similarity index 82% rename from src/common/two_way_pipe_message_ipc.h rename to src/common/interop/two_way_pipe_message_ipc.h index bcf7bd4c24..18c4b236b9 100644 --- a/src/common/two_way_pipe_message_ipc.h +++ b/src/common/interop/two_way_pipe_message_ipc.h @@ -4,8 +4,8 @@ class TwoWayPipeMessageIPC public: typedef void (*callback_function)(const std::wstring&); TwoWayPipeMessageIPC( - std::wstring _input_pipe_name, - std::wstring _output_pipe_name, + std::wstring _input_pipe_name, + std::wstring _output_pipe_name, callback_function p_func); ~TwoWayPipeMessageIPC(); void send(std::wstring msg); diff --git a/src/common/two_way_pipe_message_ipc_impl.h b/src/common/interop/two_way_pipe_message_ipc_impl.h similarity index 100% rename from src/common/two_way_pipe_message_ipc_impl.h rename to src/common/interop/two_way_pipe_message_ipc_impl.h diff --git a/src/common/json.cpp b/src/common/json.cpp deleted file mode 100644 index 0c8533a46e..0000000000 --- a/src/common/json.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "pch.h" -#include "json.h" - -#include - -namespace json -{ - std::optional from_file(std::wstring_view file_name) - { - try - { - std::ifstream file(file_name.data(), std::ios::binary); - if (file.is_open()) - { - using isbi = std::istreambuf_iterator; - std::string obj_str{ isbi{ file }, isbi{} }; - return JsonValue::Parse(winrt::to_hstring(obj_str)).GetObjectW(); - } - return std::nullopt; - } - catch (...) - { - return std::nullopt; - } - } - - void to_file(std::wstring_view file_name, const JsonObject& obj) - { - std::wstring obj_str{ obj.Stringify().c_str() }; - std::ofstream{ file_name.data(), std::ios::binary } << winrt::to_string(obj_str); - } -} diff --git a/src/common/logger/logger.vcxproj b/src/common/logger/logger.vcxproj index ce63d68a52..a5ef300c5a 100644 --- a/src/common/logger/logger.vcxproj +++ b/src/common/logger/logger.vcxproj @@ -1,7 +1,6 @@ - 16.0 Win32Proj @@ -12,7 +11,6 @@ StaticLibrary - @@ -53,6 +51,9 @@ {7e1e3f13-2bd6-3f75-a6a7-873a2b55c60f} + + {6955446d-23f7-4023-9bb3-8657f904af99} + diff --git a/src/common/notifications_winrt/notifications.vcxproj b/src/common/notifications/BackgroundActivator/BackgroundActivator.vcxproj similarity index 85% rename from src/common/notifications_winrt/notifications.vcxproj rename to src/common/notifications/BackgroundActivator/BackgroundActivator.vcxproj index 06dd9a1e61..6567eb492d 100644 --- a/src/common/notifications_winrt/notifications.vcxproj +++ b/src/common/notifications/BackgroundActivator/BackgroundActivator.vcxproj @@ -1,14 +1,14 @@ - + true true true true {0b593a6c-4143-4337-860e-db5710fb87db} - notifications - PowerToysNotifications + BackgroundActivator + BackgroundActivator en-US 14.0 true @@ -141,13 +141,13 @@ - + 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}. - - + + \ No newline at end of file diff --git a/src/common/notifications_winrt/notifications.vcxproj.filters b/src/common/notifications/BackgroundActivator/BackgroundActivator.vcxproj.filters similarity index 100% rename from src/common/notifications_winrt/notifications.vcxproj.filters rename to src/common/notifications/BackgroundActivator/BackgroundActivator.vcxproj.filters diff --git a/src/common/notifications_winrt/BackgroundHandler.cpp b/src/common/notifications/BackgroundActivator/BackgroundHandler.cpp similarity index 91% rename from src/common/notifications_winrt/BackgroundHandler.cpp rename to src/common/notifications/BackgroundActivator/BackgroundHandler.cpp index c06d33809e..c5a819c4e7 100644 --- a/src/common/notifications_winrt/BackgroundHandler.cpp +++ b/src/common/notifications/BackgroundActivator/BackgroundHandler.cpp @@ -4,7 +4,7 @@ #include "handler_functions.h" -namespace winrt::PowerToysNotifications::implementation +namespace winrt::BackgroundActivator::implementation { using Windows::ApplicationModel::Background::IBackgroundTaskInstance; using Windows::UI::Notifications::ToastNotificationActionTriggerDetail; diff --git a/src/common/notifications_winrt/BackgroundHandler.h b/src/common/notifications/BackgroundActivator/BackgroundHandler.h similarity index 76% rename from src/common/notifications_winrt/BackgroundHandler.h rename to src/common/notifications/BackgroundActivator/BackgroundHandler.h index 73cff3dfa8..ba121f5778 100644 --- a/src/common/notifications_winrt/BackgroundHandler.h +++ b/src/common/notifications/BackgroundActivator/BackgroundHandler.h @@ -2,7 +2,7 @@ #include "BackgroundHandler.g.h" -namespace winrt::PowerToysNotifications::implementation +namespace winrt::BackgroundActivator::implementation { struct BackgroundHandler : BackgroundHandlerT { @@ -12,7 +12,7 @@ namespace winrt::PowerToysNotifications::implementation }; } -namespace winrt::PowerToysNotifications::factory_implementation +namespace winrt::BackgroundActivator::factory_implementation { struct BackgroundHandler : BackgroundHandlerT { diff --git a/src/common/notifications_winrt/BackgroundHandler.idl b/src/common/notifications/BackgroundActivator/BackgroundHandler.idl similarity index 85% rename from src/common/notifications_winrt/BackgroundHandler.idl rename to src/common/notifications/BackgroundActivator/BackgroundHandler.idl index 528ff5c57f..7ef1ff6352 100644 --- a/src/common/notifications_winrt/BackgroundHandler.idl +++ b/src/common/notifications/BackgroundActivator/BackgroundHandler.idl @@ -1,4 +1,4 @@ -namespace PowerToysNotifications +namespace BackgroundActivator { [version(1)] runtimeclass BackgroundHandler diff --git a/src/common/notifications_winrt/handler_functions.cpp b/src/common/notifications/BackgroundActivator/handler_functions.cpp similarity index 100% rename from src/common/notifications_winrt/handler_functions.cpp rename to src/common/notifications/BackgroundActivator/handler_functions.cpp diff --git a/src/common/notifications_winrt/handler_functions.h b/src/common/notifications/BackgroundActivator/handler_functions.h similarity index 100% rename from src/common/notifications_winrt/handler_functions.h rename to src/common/notifications/BackgroundActivator/handler_functions.h diff --git a/src/common/notifications/BackgroundActivator/packages.config b/src/common/notifications/BackgroundActivator/packages.config new file mode 100644 index 0000000000..81f107b8bc --- /dev/null +++ b/src/common/notifications/BackgroundActivator/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/common/notifications_winrt/pch.cpp b/src/common/notifications/BackgroundActivator/pch.cpp similarity index 100% rename from src/common/notifications_winrt/pch.cpp rename to src/common/notifications/BackgroundActivator/pch.cpp diff --git a/src/common/notifications_winrt/pch.h b/src/common/notifications/BackgroundActivator/pch.h similarity index 100% rename from src/common/notifications_winrt/pch.h rename to src/common/notifications/BackgroundActivator/pch.h diff --git a/src/common/notifications/notifications.def b/src/common/notifications/BackgroundActivatorDLL/BackgroundActivator.def similarity index 100% rename from src/common/notifications/notifications.def rename to src/common/notifications/BackgroundActivatorDLL/BackgroundActivator.def diff --git a/src/common/notifications/notifications_dll.rc b/src/common/notifications/BackgroundActivatorDLL/BackgroundActivator.rc similarity index 96% rename from src/common/notifications/notifications_dll.rc rename to src/common/notifications/BackgroundActivatorDLL/BackgroundActivator.rc index a1e74e496e..4c9dd3fffc 100644 --- a/src/common/notifications/notifications_dll.rc +++ b/src/common/notifications/BackgroundActivatorDLL/BackgroundActivator.rc @@ -1,6 +1,6 @@ #include #include "resource.h" -#include "../version.h" +#include "../../version/version.h" 1 VERSIONINFO FILEVERSION FILE_VERSION diff --git a/src/common/notifications/notifications_dll.vcxproj.filters b/src/common/notifications/BackgroundActivatorDLL/BackgroundActivator.vcxproj.filters similarity index 100% rename from src/common/notifications/notifications_dll.vcxproj.filters rename to src/common/notifications/BackgroundActivatorDLL/BackgroundActivator.vcxproj.filters diff --git a/src/common/notifications/notifications_dll.vcxproj b/src/common/notifications/BackgroundActivatorDLL/BackgroundActivatorDLL.vcxproj similarity index 73% rename from src/common/notifications/notifications_dll.vcxproj rename to src/common/notifications/BackgroundActivatorDLL/BackgroundActivatorDLL.vcxproj index 123d887439..c80957d96b 100644 --- a/src/common/notifications/notifications_dll.vcxproj +++ b/src/common/notifications/BackgroundActivatorDLL/BackgroundActivatorDLL.vcxproj @@ -1,12 +1,12 @@ - + 16.0 {031AC72E-FA28-4AB7-B690-6F7B9C28AA73} Win32Proj - notificationsdll + BackgroundActivatorDLL @@ -32,7 +32,7 @@ - Notifications + BackgroundActivatorDLL @@ -54,7 +54,7 @@ false - notifications.def + BackgroundActivator.def WindowsApp.lib;%(AdditionalDependencies) /ignore:4099 %(AdditionalOptions) @@ -77,21 +77,21 @@ - + - + {031AC72E-FA28-4AB7-B690-6F7B9C28AA73} - + 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}. - - + + \ No newline at end of file diff --git a/src/common/notifications/cpp.hint b/src/common/notifications/BackgroundActivatorDLL/cpp.hint similarity index 100% rename from src/common/notifications/cpp.hint rename to src/common/notifications/BackgroundActivatorDLL/cpp.hint diff --git a/src/common/notifications/dllmain.cpp b/src/common/notifications/BackgroundActivatorDLL/dllmain.cpp similarity index 100% rename from src/common/notifications/dllmain.cpp rename to src/common/notifications/BackgroundActivatorDLL/dllmain.cpp diff --git a/src/common/notifications/framework.h b/src/common/notifications/BackgroundActivatorDLL/framework.h similarity index 100% rename from src/common/notifications/framework.h rename to src/common/notifications/BackgroundActivatorDLL/framework.h diff --git a/src/common/notifications/BackgroundActivatorDLL/packages.config b/src/common/notifications/BackgroundActivatorDLL/packages.config new file mode 100644 index 0000000000..81f107b8bc --- /dev/null +++ b/src/common/notifications/BackgroundActivatorDLL/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/common/interop/pch.cpp b/src/common/notifications/BackgroundActivatorDLL/pch.cpp similarity index 100% rename from src/common/interop/pch.cpp rename to src/common/notifications/BackgroundActivatorDLL/pch.cpp diff --git a/src/common/notifications/BackgroundActivatorDLL/pch.h b/src/common/notifications/BackgroundActivatorDLL/pch.h new file mode 100644 index 0000000000..20fe3b3766 --- /dev/null +++ b/src/common/notifications/BackgroundActivatorDLL/pch.h @@ -0,0 +1,8 @@ +#pragma once + +#ifndef PCH_H +#define PCH_H + +#include "framework.h" + +#endif //PCH_H diff --git a/src/common/notifications/resource.h b/src/common/notifications/BackgroundActivatorDLL/resource.h similarity index 84% rename from src/common/notifications/resource.h rename to src/common/notifications/BackgroundActivatorDLL/resource.h index 2ec9d3ca91..9284f65c51 100644 --- a/src/common/notifications/resource.h +++ b/src/common/notifications/BackgroundActivatorDLL/resource.h @@ -7,7 +7,7 @@ #define FILE_DESCRIPTION "PowerToys Notifications" #define INTERNAL_NAME "Notifications" -#define ORIGINAL_FILENAME "Notifications.dll" +#define ORIGINAL_FILENAME "BackgroundActivatorDLL.dll" // Non-localizable ////////////////////////////// diff --git a/src/common/toast_dont_show_again.cpp b/src/common/notifications/dont_show_again.cpp similarity index 98% rename from src/common/toast_dont_show_again.cpp rename to src/common/notifications/dont_show_again.cpp index c57ee81866..4d9d8d91a8 100644 --- a/src/common/toast_dont_show_again.cpp +++ b/src/common/notifications/dont_show_again.cpp @@ -1,5 +1,5 @@ #include "pch.h" -#include "toast_dont_show_again.h" +#include "dont_show_again.h" namespace notifications { diff --git a/src/common/toast_dont_show_again.h b/src/common/notifications/dont_show_again.h similarity index 95% rename from src/common/toast_dont_show_again.h rename to src/common/notifications/dont_show_again.h index 95444b0d5a..98657b1e7e 100644 --- a/src/common/toast_dont_show_again.h +++ b/src/common/notifications/dont_show_again.h @@ -1,6 +1,6 @@ #pragma once -#include "timeutil.h" +#include "../utils/timeutil.h" namespace notifications { diff --git a/src/common/notifications.cpp b/src/common/notifications/notifications.cpp similarity index 97% rename from src/common/notifications.cpp rename to src/common/notifications/notifications.cpp index bb48d76feb..c3a389187e 100644 --- a/src/common/notifications.cpp +++ b/src/common/notifications/notifications.cpp @@ -1,9 +1,9 @@ #include "pch.h" -#include "common.h" -#include "com_object_factory.h" #include "notifications.h" -#include "winstore.h" +#include "utils/com_object_factory.h" +#include "utils/window.h" +#include "winstore/winstore.h" #include #include @@ -19,12 +19,12 @@ #include #include #include +#include #include #include -#include "notifications_winrt/handler_functions.h" -#include +#include "BackgroundActivator/handler_functions.h" using namespace winrt::Windows::ApplicationModel::Background; using winrt::Windows::Data::Xml::Dom::XmlDocument; @@ -33,10 +33,19 @@ using winrt::Windows::UI::Notifications::ToastNotificationManager; namespace fs = std::filesystem; +template +struct overloaded : Ts... +{ + using Ts::operator()...; +}; + +template +overloaded(Ts...) -> overloaded; + namespace // Strings in this namespace should not be localized { constexpr std::wstring_view TASK_NAME = L"PowerToysBackgroundNotificationsHandler"; - constexpr std::wstring_view TASK_ENTRYPOINT = L"PowerToysNotifications.BackgroundHandler"; + constexpr std::wstring_view TASK_ENTRYPOINT = L"BackgroundActivator.BackgroundHandler"; constexpr std::wstring_view PACKAGED_APPLICATION_ID = L"PowerToys"; constexpr std::wstring_view APPIDS_REGISTRY = LR"(Software\Classes\AppUserModelId\)"; @@ -84,7 +93,7 @@ public: const NOTIFICATION_USER_INPUT_DATA*, ULONG) override { - auto lib = LoadLibraryW(L"Notifications.dll"); + auto lib = LoadLibraryW(L"BackgroundActivatorDLL.dll"); if (!lib) { return 1; diff --git a/src/common/notifications.h b/src/common/notifications/notifications.h similarity index 100% rename from src/common/notifications.h rename to src/common/notifications/notifications.h diff --git a/src/common/common-md-flag/common-md-flag.vcxproj b/src/common/notifications/notifications.vcxproj similarity index 55% rename from src/common/common-md-flag/common-md-flag.vcxproj rename to src/common/notifications/notifications.vcxproj index 248ec3bb1d..589c308284 100644 --- a/src/common/common-md-flag/common-md-flag.vcxproj +++ b/src/common/notifications/notifications.vcxproj @@ -1,76 +1,61 @@ - - - - 16.0 - {985B3F2F-CEED-4C0A-A249-69257E719145} - Win32Proj - commonmdflag - - - - StaticLibrary - - - - - - - - - - - - - - - - - MultiThreadedDebugDLL - - - - - MultiThreadedDLL - - - - - - _LIB;%(PreprocessorDefinitions) - inc;telemetry;../../;%(AdditionalIncludeDirectories) - /Zc:twoPhase- %(AdditionalOptions) - - - - - - - - - - - - - - - - - - Create - - - - - - - - - - - - - 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}. - - - + + + + + 16.0 + {1D5BE09D-78C0-4FD7-AF00-AE7C1AF7C525} + Win32Proj + notifications + Notifications + + + + StaticLibrary + + + + + + + + + + ..\;..\..\;..\..\..\;%(AdditionalIncludeDirectories) + _LIB;%(PreprocessorDefinitions) + true + + + + + + + + + + + + Create + + + + + + + + {c502a854-53ac-4ebb-8dc0-e4af2191e4f6} + + + + + + + + + + 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}. + + + + + \ No newline at end of file diff --git a/src/common/notifications/packages.config b/src/common/notifications/packages.config index 81f107b8bc..fda08e21c1 100644 --- a/src/common/notifications/packages.config +++ b/src/common/notifications/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/src/common/notifications/pch.cpp b/src/common/notifications/pch.cpp index 64b7eef6d6..17305716aa 100644 --- a/src/common/notifications/pch.cpp +++ b/src/common/notifications/pch.cpp @@ -1,5 +1 @@ -// pch.cpp: source file corresponding to the pre-compiled header - -#include "pch.h" - -// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. +#include "pch.h" \ No newline at end of file diff --git a/src/common/notifications/pch.h b/src/common/notifications/pch.h index 20fe3b3766..dd3fe1b42a 100644 --- a/src/common/notifications/pch.h +++ b/src/common/notifications/pch.h @@ -1,8 +1,8 @@ #pragma once -#ifndef PCH_H -#define PCH_H +#define NOMINMAX +#define WIN32_LEAN_AND_MEAN -#include "framework.h" - -#endif //PCH_H +#include +#include +#include \ No newline at end of file diff --git a/src/common/os-detect.h b/src/common/os-detect.h deleted file mode 100644 index c50f367e76..0000000000 --- a/src/common/os-detect.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -bool UseNewSettings(); \ No newline at end of file diff --git a/src/common/pch.cpp b/src/common/pch.cpp deleted file mode 100644 index 1d9f38c57d..0000000000 --- a/src/common/pch.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "pch.h" diff --git a/src/common/pch.h b/src/common/pch.h deleted file mode 100644 index 53453d3cf9..0000000000 --- a/src/common/pch.h +++ /dev/null @@ -1,21 +0,0 @@ -#define NOMINMAX -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include diff --git a/src/common/updating/dotnet_installation.cpp b/src/common/updating/dotnet_installation.cpp index fd8d197ad8..90a7c75748 100644 --- a/src/common/updating/dotnet_installation.cpp +++ b/src/common/updating/dotnet_installation.cpp @@ -1,9 +1,10 @@ #include "pch.h" -#include - -#include "http_client.h" #include "dotnet_installation.h" +#include "http_client.h" + +#include "utils/exec.h" +#include "utils/winapi_error.h" namespace fs = std::filesystem; diff --git a/src/common/updating/installer.cpp b/src/common/updating/installer.cpp index ab3e3c301a..8ca50d1ece 100644 --- a/src/common/updating/installer.cpp +++ b/src/common/updating/installer.cpp @@ -1,18 +1,9 @@ #include "pch.h" #include "installer.h" -#include "version.h" -#include -#include - -#include -#include - -#include -#include -#include -#include -#include +#include +#include +#include "utils/winapi_error.h" namespace // Strings in this namespace should not be localized { diff --git a/src/common/updating/installer.h b/src/common/updating/installer.h index 62e5da6fab..27d886243c 100644 --- a/src/common/updating/installer.h +++ b/src/common/updating/installer.h @@ -5,7 +5,7 @@ #include #include "notifications.h" -#include "../VersionHelper.h" +#include namespace updating { diff --git a/src/common/updating/notifications.cpp b/src/common/updating/notifications.cpp index d27f3f4bb0..a14f55c665 100644 --- a/src/common/updating/notifications.cpp +++ b/src/common/updating/notifications.cpp @@ -2,12 +2,12 @@ #include "notifications.h" -#include +#include #include "updating.h" -#include "VersionHelper.h" -#include "version.h" +#include +#include namespace updating { diff --git a/src/common/updating/packages.config b/src/common/updating/packages.config index 81f107b8bc..fda08e21c1 100644 --- a/src/common/updating/packages.config +++ b/src/common/updating/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/src/common/updating/pch.h b/src/common/updating/pch.h index d51d5df04c..8eefa4f284 100644 --- a/src/common/updating/pch.h +++ b/src/common/updating/pch.h @@ -15,8 +15,18 @@ #include #include #include -#include +#include +#include #include +#include + +#include +#include +#include +#include +#include + #endif //PCH_H + diff --git a/src/common/updating/updating.cpp b/src/common/updating/updating.cpp index ab200989e6..c2a0e5cfa8 100644 --- a/src/common/updating/updating.cpp +++ b/src/common/updating/updating.cpp @@ -1,23 +1,15 @@ #include "pch.h" -#include "version.h" +#include +#include #include "http_client.h" #include "notifications.h" #include "updating.h" -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "VersionHelper.h" +#include +#include +#include namespace // Strings in this namespace should not be localized { diff --git a/src/common/updating/updating.h b/src/common/updating/updating.h index 384bea5f50..58d0ff6f6b 100644 --- a/src/common/updating/updating.h +++ b/src/common/updating/updating.h @@ -8,7 +8,7 @@ #include #include "notifications.h" -#include "../VersionHelper.h" +#include namespace updating { diff --git a/src/common/updating/updating.vcxproj b/src/common/updating/updating.vcxproj index d01cedf60a..e6a2ec4da3 100644 --- a/src/common/updating/updating.vcxproj +++ b/src/common/updating/updating.vcxproj @@ -6,7 +6,7 @@ {17DA04DF-E393-4397-9CF0-84DABE11032E} Win32Proj updating - updating + ApplicationUpdate @@ -18,12 +18,6 @@ - - - - - - @@ -31,7 +25,6 @@ - ..\;..\..\;..\..\..\;%(AdditionalIncludeDirectories) @@ -39,10 +32,9 @@ true - Version.lib + Version.lib;shlwapi.lib - @@ -50,6 +42,7 @@ + @@ -62,8 +55,14 @@ - - {74485049-c722-400f-abe5-86ac52d929b3} + + {1d5be09d-78c0-4fd7-af00-ae7c1af7c525} + + + {6955446d-23f7-4023-9bb3-8657f904af99} + + + {cc6e41ac-8174-4e8a-8d22-85dd7f4851df} @@ -72,6 +71,7 @@ + @@ -79,5 +79,6 @@ + \ No newline at end of file diff --git a/src/common/updating/updating.vcxproj.filters b/src/common/updating/updating.vcxproj.filters index 9cbef007af..640764edda 100644 --- a/src/common/updating/updating.vcxproj.filters +++ b/src/common/updating/updating.vcxproj.filters @@ -33,6 +33,9 @@ Header Files + + Header Files + diff --git a/src/common/appMutex.h b/src/common/utils/appMutex.h similarity index 100% rename from src/common/appMutex.h rename to src/common/utils/appMutex.h diff --git a/src/common/com_object_factory.h b/src/common/utils/com_object_factory.h similarity index 98% rename from src/common/com_object_factory.h rename to src/common/utils/com_object_factory.h index 8ed984377d..e3ae06e938 100644 --- a/src/common/com_object_factory.h +++ b/src/common/utils/com_object_factory.h @@ -3,6 +3,7 @@ #include #include #include +#include template class com_object_factory : public IClassFactory diff --git a/src/common/utils/elevation.h b/src/common/utils/elevation.h new file mode 100644 index 0000000000..7f709a3831 --- /dev/null +++ b/src/common/utils/elevation.h @@ -0,0 +1,271 @@ +#pragma once + +#define WIN32_LEAN_AND_MEAN +#include +#include +#include + +#include + +// Returns true if the current process is running with elevated privileges +inline bool is_process_elevated(const bool use_cached_value = true) +{ + auto detection_func = []() { + HANDLE token = nullptr; + bool elevated = false; + + if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) + { + TOKEN_ELEVATION elevation; + DWORD size; + if (GetTokenInformation(token, TokenElevation, &elevation, sizeof(elevation), &size)) + { + elevated = (elevation.TokenIsElevated != 0); + } + } + + if (token) + { + CloseHandle(token); + } + + return elevated; + }; + static const bool cached_value = detection_func(); + return use_cached_value ? cached_value : detection_func(); +} + +// Drops the elevated privileges if present +inline bool drop_elevated_privileges() +{ + HANDLE token = nullptr; + if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_DEFAULT | WRITE_OWNER, &token)) + { + return false; + } + + PSID medium_sid = NULL; + if (!::ConvertStringSidToSid(SDDL_ML_MEDIUM, &medium_sid)) + { + return false; + } + + TOKEN_MANDATORY_LABEL label = { 0 }; + label.Label.Attributes = SE_GROUP_INTEGRITY; + label.Label.Sid = medium_sid; + DWORD size = (DWORD)sizeof(TOKEN_MANDATORY_LABEL) + ::GetLengthSid(medium_sid); + + BOOL result = SetTokenInformation(token, TokenIntegrityLevel, &label, size); + LocalFree(medium_sid); + CloseHandle(token); + + return result; +} + +// Run command as elevated user, returns true if succeeded +inline HANDLE run_elevated(const std::wstring& file, const std::wstring& params) +{ + SHELLEXECUTEINFOW exec_info = { 0 }; + exec_info.cbSize = sizeof(SHELLEXECUTEINFOW); + exec_info.lpVerb = L"runas"; + exec_info.lpFile = file.c_str(); + exec_info.lpParameters = params.c_str(); + exec_info.hwnd = 0; + exec_info.fMask = SEE_MASK_NOCLOSEPROCESS; + exec_info.lpDirectory = 0; + exec_info.hInstApp = 0; + exec_info.nShow = SW_SHOWDEFAULT; + + return ShellExecuteExW(&exec_info) ? exec_info.hProcess : nullptr; +} + +// Run command as non-elevated user, returns true if succeeded, puts the process id into returnPid if returnPid != NULL +inline bool run_non_elevated(const std::wstring& file, const std::wstring& params, DWORD* returnPid) +{ + auto executable_args = L"\"" + file + L"\""; + if (!params.empty()) + { + executable_args += L" " + params; + } + + HWND hwnd = GetShellWindow(); + if (!hwnd) + { + return false; + } + DWORD pid; + GetWindowThreadProcessId(hwnd, &pid); + + winrt::handle process{ OpenProcess(PROCESS_CREATE_PROCESS, FALSE, pid) }; + if (!process) + { + return false; + } + + SIZE_T size = 0; + + InitializeProcThreadAttributeList(nullptr, 1, 0, &size); + auto pproc_buffer = std::make_unique(size); + auto pptal = reinterpret_cast(pproc_buffer.get()); + + if (!InitializeProcThreadAttributeList(pptal, 1, 0, &size)) + { + return false; + } + + HANDLE process_handle = process.get(); + if (!pptal || !UpdateProcThreadAttribute(pptal, + 0, + PROC_THREAD_ATTRIBUTE_PARENT_PROCESS, + &process_handle, + sizeof(process_handle), + nullptr, + nullptr)) + { + return false; + } + + STARTUPINFOEX siex = { 0 }; + siex.lpAttributeList = pptal; + siex.StartupInfo.cb = sizeof(siex); + + PROCESS_INFORMATION pi = { 0 }; + auto succeeded = CreateProcessW(file.c_str(), + const_cast(executable_args.c_str()), + nullptr, + nullptr, + FALSE, + EXTENDED_STARTUPINFO_PRESENT, + nullptr, + nullptr, + &siex.StartupInfo, + &pi); + if (succeeded) + { + if (pi.hProcess) + { + if (returnPid) + { + *returnPid = GetProcessId(pi.hProcess); + } + + CloseHandle(pi.hProcess); + } + if (pi.hThread) + { + CloseHandle(pi.hThread); + } + } + + return succeeded; +} + +// Run command with the same elevation, returns true if succeeded +inline bool run_same_elevation(const std::wstring& file, const std::wstring& params, DWORD* returnPid) +{ + auto executable_args = L"\"" + file + L"\""; + if (!params.empty()) + { + executable_args += L" " + params; + } + + STARTUPINFO si = { 0 }; + PROCESS_INFORMATION pi = { 0 }; + auto succeeded = CreateProcessW(file.c_str(), + const_cast(executable_args.c_str()), + nullptr, + nullptr, + FALSE, + 0, + nullptr, + nullptr, + &si, + &pi); + + if (succeeded) + { + if (pi.hProcess) + { + if (returnPid) + { + *returnPid = GetProcessId(pi.hProcess); + } + + CloseHandle(pi.hProcess); + } + + if (pi.hThread) + { + CloseHandle(pi.hThread); + } + } + return succeeded; +} + +// Returns true if the current process is running from administrator account +// The function returns true in case of error since we want to return false +// only in case of a positive verification that the user is not an admin. +inline bool check_user_is_admin() +{ + auto freeMemory = [](PSID pSID, PTOKEN_GROUPS pGroupInfo) { + if (pSID) + { + FreeSid(pSID); + } + if (pGroupInfo) + { + GlobalFree(pGroupInfo); + } + }; + + HANDLE hToken; + DWORD dwSize = 0; + PTOKEN_GROUPS pGroupInfo; + SID_IDENTIFIER_AUTHORITY SIDAuth = SECURITY_NT_AUTHORITY; + PSID pSID = NULL; + + // Open a handle to the access token for the calling process. + if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) + { + return true; + } + + // Call GetTokenInformation to get the buffer size. + if (!GetTokenInformation(hToken, TokenGroups, NULL, dwSize, &dwSize)) + { + if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) + { + return true; + } + } + + // Allocate the buffer. + pGroupInfo = (PTOKEN_GROUPS)GlobalAlloc(GPTR, dwSize); + + // Call GetTokenInformation again to get the group information. + if (!GetTokenInformation(hToken, TokenGroups, pGroupInfo, dwSize, &dwSize)) + { + freeMemory(pSID, pGroupInfo); + return true; + } + + // Create a SID for the BUILTIN\Administrators group. + if (!AllocateAndInitializeSid(&SIDAuth, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &pSID)) + { + freeMemory(pSID, pGroupInfo); + return true; + } + + // Loop through the group SIDs looking for the administrator SID. + for (DWORD i = 0; i < pGroupInfo->GroupCount; ++i) + { + if (EqualSid(pSID, pGroupInfo->Groups[i].Sid)) + { + freeMemory(pSID, pGroupInfo); + return true; + } + } + + freeMemory(pSID, pGroupInfo); + return false; +} \ No newline at end of file diff --git a/src/common/utils/exec.h b/src/common/utils/exec.h new file mode 100644 index 0000000000..d8267304d7 --- /dev/null +++ b/src/common/utils/exec.h @@ -0,0 +1,100 @@ +#pragma once + +#define WIN32_LEAN_AND_MEAN +#include +#include + +#include +#include + +inline std::optional exec_and_read_output(const std::wstring_view command, DWORD timeout_ms = 30000) +{ + SECURITY_ATTRIBUTES saAttr{ sizeof(saAttr) }; + saAttr.bInheritHandle = false; + + constexpr size_t bufferSize = 4096; + // We must use a named pipe for async I/O + char pipename[MAX_PATH + 1]; + if (!GetTempFileNameA(R"(\\.\pipe\)", "tmp", 1, pipename)) + { + return std::nullopt; + } + + wil::unique_handle readPipe{ CreateNamedPipeA(pipename, PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE, PIPE_UNLIMITED_INSTANCES, bufferSize, bufferSize, 0, &saAttr) }; + + saAttr.bInheritHandle = true; + wil::unique_handle writePipe{ CreateFileA(pipename, GENERIC_WRITE, 0, &saAttr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr) }; + + if (!readPipe || !writePipe) + { + return std::nullopt; + } + + PROCESS_INFORMATION piProcInfo{}; + STARTUPINFOW siStartInfo{ sizeof(siStartInfo) }; + + siStartInfo.hStdError = writePipe.get(); + siStartInfo.hStdOutput = writePipe.get(); + siStartInfo.dwFlags |= STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; + siStartInfo.wShowWindow = SW_HIDE; + + std::wstring cmdLine{ command }; + if (!CreateProcessW(nullptr, + cmdLine.data(), + nullptr, + nullptr, + true, + NORMAL_PRIORITY_CLASS | CREATE_NEW_CONSOLE, + nullptr, + nullptr, + &siStartInfo, + &piProcInfo)) + { + return std::nullopt; + } + // Child process inherited the write end of the pipe, we can close it now + writePipe.reset(); + + auto closeProcessHandles = wil::scope_exit([&] { + CloseHandle(piProcInfo.hThread); + CloseHandle(piProcInfo.hProcess); + }); + + std::string childOutput; + bool processExited = false; + for (;;) + { + char buffer[bufferSize]; + DWORD gotBytes = 0; + wil::unique_handle IOEvent{ CreateEventW(nullptr, true, false, nullptr) }; + OVERLAPPED overlapped{ .hEvent = IOEvent.get() }; + ReadFile(readPipe.get(), buffer, sizeof(buffer), nullptr, &overlapped); + + const std::array handlesToWait = { overlapped.hEvent, piProcInfo.hProcess }; + switch (WaitForMultipleObjects(1 + !processExited, handlesToWait.data(), false, timeout_ms)) + { + case WAIT_OBJECT_0 + 1: + if (!processExited) + { + // When the process exits, we can reduce timeout and read the rest of the output w/o possibly big timeout + timeout_ms = 1000; + processExited = true; + closeProcessHandles.reset(); + } + [[fallthrough]]; + case WAIT_OBJECT_0: + if (GetOverlappedResultEx(readPipe.get(), &overlapped, &gotBytes, timeout_ms, true)) + { + childOutput += std::string_view{ buffer, gotBytes }; + break; + } + // Timeout + [[fallthrough]]; + default: + goto exit; + } + } +exit: + CancelIo(readPipe.get()); + return childOutput; +} diff --git a/src/common/json.h b/src/common/utils/json.h similarity index 59% rename from src/common/json.h rename to src/common/utils/json.h index c0ec8eb14c..43e3b858f1 100644 --- a/src/common/json.h +++ b/src/common/utils/json.h @@ -5,14 +5,36 @@ #include #include +#include namespace json { using namespace winrt::Windows::Data::Json; - std::optional from_file(std::wstring_view file_name); + inline std::optional from_file(std::wstring_view file_name) + { + try + { + std::ifstream file(file_name.data(), std::ios::binary); + if (file.is_open()) + { + using isbi = std::istreambuf_iterator; + std::string obj_str{ isbi{ file }, isbi{} }; + return JsonValue::Parse(winrt::to_hstring(obj_str)).GetObjectW(); + } + return std::nullopt; + } + catch (...) + { + return std::nullopt; + } + } - void to_file(std::wstring_view file_name, const JsonObject& obj); + inline void to_file(std::wstring_view file_name, const JsonObject& obj) + { + std::wstring obj_str{ obj.Stringify().c_str() }; + std::ofstream{ file_name.data(), std::ios::binary } << winrt::to_string(obj_str); + } inline bool has( const json::JsonObject& o, diff --git a/src/common/os-detect.cpp b/src/common/utils/os-detect.h similarity index 53% rename from src/common/os-detect.cpp rename to src/common/utils/os-detect.h index 71a6763d41..a3f7eda288 100644 --- a/src/common/os-detect.cpp +++ b/src/common/utils/os-detect.h @@ -1,5 +1,4 @@ -#include "pch.h" -#include "os-detect.h" +#pragma once #include @@ -7,26 +6,26 @@ // Source : Microsoft-ui-xaml github // Link: https://github.com/microsoft/microsoft-ui-xaml/blob/c045cde57c5c754683d674634a0baccda34d58c4/dev/dll/SharedHelpers.cpp template -bool IsAPIContractVxAvailable() +inline bool IsAPIContractVxAvailable() { - static bool isAPIContractVxAvailable = winrt::Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", APIVersion); + static bool isAPIContractVxAvailable = winrt::Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", APIVersion); - return isAPIContractVxAvailable; + return isAPIContractVxAvailable; } -bool IsAPIContractV8Available() +inline bool IsAPIContractV8Available() { - return IsAPIContractVxAvailable<8>(); + return IsAPIContractVxAvailable<8>(); } -bool Is19H1OrHigher() +inline bool Is19H1OrHigher() { - return IsAPIContractV8Available(); + return IsAPIContractV8Available(); } // This function returns true if the build is 19h1 or higher, so that we deploy the new settings. // It returns false otherwise. -bool UseNewSettings() +inline bool UseNewSettings() { - return Is19H1OrHigher(); + return Is19H1OrHigher(); } \ No newline at end of file diff --git a/src/common/processApi.h b/src/common/utils/processApi.h similarity index 100% rename from src/common/processApi.h rename to src/common/utils/processApi.h diff --git a/src/common/utils/process_path.h b/src/common/utils/process_path.h new file mode 100644 index 0000000000..d6dee06469 --- /dev/null +++ b/src/common/utils/process_path.h @@ -0,0 +1,101 @@ +#pragma once +#define WIN32_LEAN_AND_MEAN +#include +#include + +#include + +#pragma comment(lib, "shlwapi.lib") + +// Get the executable path or module name for modern apps +inline std::wstring get_process_path(DWORD pid) noexcept +{ + auto process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, TRUE, pid); + std::wstring name; + if (process != INVALID_HANDLE_VALUE) + { + name.resize(MAX_PATH); + DWORD name_length = static_cast(name.length()); + if (QueryFullProcessImageNameW(process, 0, (LPWSTR)name.data(), &name_length) == 0) + { + name_length = 0; + } + name.resize(name_length); + CloseHandle(process); + } + return name; +} + +// Get the executable path or module name for modern apps +inline std::wstring get_process_path(HWND window) noexcept +{ + const static std::wstring app_frame_host = L"ApplicationFrameHost.exe"; + DWORD pid{}; + GetWindowThreadProcessId(window, &pid); + auto name = get_process_path(pid); + if (name.length() >= app_frame_host.length() && + name.compare(name.length() - app_frame_host.length(), app_frame_host.length(), app_frame_host) == 0) + { + // It is a UWP app. We will enumerate the windows and look for one created + // by something with a different PID + DWORD new_pid = pid; + EnumChildWindows( + window, [](HWND hwnd, LPARAM param) -> BOOL { + auto new_pid_ptr = reinterpret_cast(param); + DWORD pid; + GetWindowThreadProcessId(hwnd, &pid); + if (pid != *new_pid_ptr) + { + *new_pid_ptr = pid; + return FALSE; + } + else + { + return TRUE; + } + }, + reinterpret_cast(&new_pid)); + // If we have a new pid, get the new name. + if (new_pid != pid) + { + return get_process_path(new_pid); + } + } + return name; +} + +inline std::wstring get_module_filename(HMODULE mod = nullptr) +{ + wchar_t buffer[MAX_PATH + 1]; + DWORD actual_length = GetModuleFileNameW(mod, buffer, MAX_PATH); + if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) + { + const DWORD long_path_length = 0xFFFF; // should be always enough + std::wstring long_filename(long_path_length, L'\0'); + actual_length = GetModuleFileNameW(mod, long_filename.data(), long_path_length); + return long_filename.substr(0, actual_length); + } + return { buffer, actual_length }; +} + +inline std::wstring get_module_folderpath(HMODULE mod = nullptr, const bool removeFilename = true) +{ + wchar_t buffer[MAX_PATH + 1]; + DWORD actual_length = GetModuleFileNameW(mod, buffer, MAX_PATH); + if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) + { + const DWORD long_path_length = 0xFFFF; // should be always enough + std::wstring long_filename(long_path_length, L'\0'); + actual_length = GetModuleFileNameW(mod, long_filename.data(), long_path_length); + PathRemoveFileSpecW(long_filename.data()); + long_filename.resize(std::wcslen(long_filename.data())); + long_filename.shrink_to_fit(); + return long_filename; + } + + if (removeFilename) + { + PathRemoveFileSpecW(buffer); + } + return { buffer, (UINT)lstrlenW(buffer) }; +} \ No newline at end of file diff --git a/src/common/utils/resources.h b/src/common/utils/resources.h new file mode 100644 index 0000000000..ffb88ca3a7 --- /dev/null +++ b/src/common/utils/resources.h @@ -0,0 +1,23 @@ +#pragma once +#define WIN32_LEAN_AND_MEAN +#include +#include + +// Get a string from the resource file +inline std::wstring get_resource_string(UINT resource_id, HINSTANCE instance, const wchar_t* fallback) +{ + wchar_t* text_ptr; + auto length = LoadStringW(instance, resource_id, reinterpret_cast(&text_ptr), 0); + if (length == 0) + { + return fallback; + } + else + { + return { text_ptr, static_cast(length) }; + } +} + +extern "C" IMAGE_DOS_HEADER __ImageBase; +// Wrapper for getting a string from the resource file. Returns the resource id text when fails. +#define GET_RESOURCE_STRING(resource_id) get_resource_string(resource_id, reinterpret_cast(&__ImageBase), L#resource_id) diff --git a/src/common/string_utils.h b/src/common/utils/string_utils.h similarity index 100% rename from src/common/string_utils.h rename to src/common/utils/string_utils.h diff --git a/src/common/timeutil.h b/src/common/utils/timeutil.h similarity index 100% rename from src/common/timeutil.h rename to src/common/utils/timeutil.h diff --git a/src/common/utils/winapi_error.h b/src/common/utils/winapi_error.h new file mode 100644 index 0000000000..5a9dc4fc9c --- /dev/null +++ b/src/common/utils/winapi_error.h @@ -0,0 +1,44 @@ +#pragma once + +#define WIN32_LEAN_AND_MEAN +#include + +#include +#include +#include +#include + +inline std::optional get_last_error_message(const DWORD dw) +{ + std::optional message; + try + { + const auto msg = std::system_category().message(dw); + message.emplace(begin(msg), end(msg)); + } + catch (...) + { + } + return message; +} + +inline void show_last_error_message(const wchar_t* functionName, DWORD dw, const wchar_t* errorTitle) +{ + const auto system_message = get_last_error_message(dw); + if (!system_message.has_value()) + { + return; + } + LPWSTR lpDisplayBuf = (LPWSTR)LocalAlloc(LMEM_ZEROINIT, (system_message->size() + lstrlenW(functionName) + 40) * sizeof(WCHAR)); + if (lpDisplayBuf != NULL) + { + StringCchPrintfW(lpDisplayBuf, + LocalSize(lpDisplayBuf) / sizeof(WCHAR), + L"%s: %s (%d)", + functionName, + system_message->c_str(), + dw); + MessageBoxW(NULL, (LPCTSTR)lpDisplayBuf, errorTitle, MB_OK | MB_ICONERROR); + LocalFree(lpDisplayBuf); + } +} diff --git a/src/common/utils/window.h b/src/common/utils/window.h new file mode 100644 index 0000000000..0e6f31a59a --- /dev/null +++ b/src/common/utils/window.h @@ -0,0 +1,59 @@ +#pragma once + +#define WIN32_LEAN_AND_MEAN +#include +#include + +#include +#include + +#pragma comment(lib, "dwmapi.lib") + +// Initializes and runs windows message loop +inline int run_message_loop(const bool until_idle = false, const std::optional timeout_seconds = {}) +{ + MSG msg{}; + bool stop = false; + UINT_PTR timerId = 0; + if (timeout_seconds.has_value()) + { + timerId = SetTimer(nullptr, 0, *timeout_seconds * 1000, nullptr); + } + + while (!stop && GetMessageW(&msg, nullptr, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessageW(&msg); + stop = until_idle && !PeekMessageW(&msg, nullptr, 0, 0, PM_NOREMOVE); + stop = stop || (msg.message == WM_TIMER && msg.wParam == timerId); + } + if (timeout_seconds.has_value()) + { + KillTimer(nullptr, timerId); + } + return static_cast(msg.wParam); +} + +// Check if window is part of the shell or the taskbar. +inline bool is_system_window(HWND hwnd, const char* class_name) +{ + // We compare the HWND against HWND of the desktop and shell windows, + // we also filter out some window class names know to belong to the taskbar. + constexpr std::array system_classes = { "SysListView32", "WorkerW", "Shell_TrayWnd", "Shell_SecondaryTrayWnd", "Progman" }; + const std::array system_hwnds = { GetDesktopWindow(), GetShellWindow() }; + for (auto system_hwnd : system_hwnds) + { + if (hwnd == system_hwnd) + { + return true; + } + } + for (const auto system_class : system_classes) + { + if (!strcmp(system_class, class_name)) + { + return true; + } + } + return false; +} diff --git a/src/common/VersionHelper.cpp b/src/common/version/helper.cpp similarity index 92% rename from src/common/VersionHelper.cpp rename to src/common/version/helper.cpp index 3b1139e7b0..12ca48f8d5 100644 --- a/src/common/VersionHelper.cpp +++ b/src/common/version/helper.cpp @@ -1,7 +1,6 @@ -#include "pch.h" -#include "VersionHelper.h" +#include "helper.h" -#include "string_utils.h" +#include "../utils/string_utils.h" #include #include diff --git a/src/common/VersionHelper.h b/src/common/version/helper.h similarity index 100% rename from src/common/VersionHelper.h rename to src/common/version/helper.h diff --git a/src/common/version.cpp b/src/common/version/version.cpp similarity index 95% rename from src/common/version.cpp rename to src/common/version/version.cpp index 3797e96675..39a5616084 100644 --- a/src/common/version.cpp +++ b/src/common/version/version.cpp @@ -1,6 +1,7 @@ -#include "pch.h" #include "version.h" +#include + version_architecture get_current_architecture() { // TODO: detect ARM build with #ifdef diff --git a/src/common/version.h b/src/common/version/version.h similarity index 69% rename from src/common/version.h rename to src/common/version/version.h index 7bf595ad9c..4cf88d8ac7 100644 --- a/src/common/version.h +++ b/src/common/version/version.h @@ -16,6 +16,8 @@ #define COPYRIGHT_NOTE "Copyright (C) 2020 Microsoft Corporation" #define PRODUCT_NAME "PowerToys" +#include + enum class version_architecture { x64, @@ -23,4 +25,13 @@ enum class version_architecture }; version_architecture get_current_architecture(); -const wchar_t* get_architecture_string(const version_architecture); \ No newline at end of file +const wchar_t* get_architecture_string(const version_architecture); + +inline std::wstring get_product_version() +{ + static std::wstring version = L"v" + std::to_wstring(VERSION_MAJOR) + + L"." + std::to_wstring(VERSION_MINOR) + + L"." + std::to_wstring(VERSION_REVISION); + + return version; +} \ No newline at end of file diff --git a/src/common/version/version.vcxproj b/src/common/version/version.vcxproj new file mode 100644 index 0000000000..447bc41c6e --- /dev/null +++ b/src/common/version/version.vcxproj @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + 16.0 + {CC6E41AC-8174-4E8A-8D22-85DD7F4851DF} + Win32Proj + Version + Version + + + + StaticLibrary + + + + + + + + + + ..\;..\..\;..\..\..\;%(AdditionalIncludeDirectories) + _LIB;%(PreprocessorDefinitions) + true + NotUsing + + + + + + + + + + + + \ No newline at end of file diff --git a/src/common/window_helpers.cpp b/src/common/window_helpers.cpp deleted file mode 100644 index 925e6f48f7..0000000000 --- a/src/common/window_helpers.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "window_helpers.h" -#include "pch.h" -#include - - -HWND CreateMsgWindow(_In_ HINSTANCE hInst, _In_ WNDPROC pfnWndProc, _In_ void* p) -{ - WNDCLASS wc = { 0 }; - - PCWSTR wndClassName = L"MsgWindow"; - - wc.lpfnWndProc = DefWindowProc; - wc.cbWndExtra = sizeof(void*); - wc.hInstance = hInst; - wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); - wc.lpszClassName = wndClassName; - - RegisterClass(&wc); - - HWND hwnd = CreateWindowEx( - 0, wndClassName, nullptr, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hInst, nullptr); - if (hwnd) - { - SetWindowLongPtr(hwnd, 0, (LONG_PTR)p); - if (pfnWndProc) - { - SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)pfnWndProc); - } - } - - return hwnd; -} - -bool IsProcessOfWindowElevated(HWND window) -{ - DWORD pid = 0; - GetWindowThreadProcessId(window, &pid); - if (!pid) - { - return false; - } - - wil::unique_handle hProcess{ OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, - FALSE, - pid) }; - - wil::unique_handle token; - bool elevated = false; - - if (OpenProcessToken(hProcess.get(), TOKEN_QUERY, &token)) - { - TOKEN_ELEVATION elevation; - DWORD size; - if (GetTokenInformation(token.get(), TokenElevation, &elevation, sizeof(elevation), &size)) - { - return elevation.TokenIsElevated != 0; - } - } - return false; -} diff --git a/src/common/window_helpers.h b/src/common/window_helpers.h deleted file mode 100644 index 2494b8125c..0000000000 --- a/src/common/window_helpers.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once -#include "common.h" - -HWND CreateMsgWindow(_In_ HINSTANCE hInst, _In_ WNDPROC pfnWndProc, _In_ void* p); - -// If HWND is already dead, we assume it wasn't elevated -bool IsProcessOfWindowElevated(HWND window); \ No newline at end of file diff --git a/src/logging/logging.vcxproj b/src/logging/logging.vcxproj index 800d28e68d..53b70a1cbb 100644 --- a/src/logging/logging.vcxproj +++ b/src/logging/logging.vcxproj @@ -3,11 +3,10 @@ x64 - {7E1E3F13-2BD6-3F75-A6A7-873A2B55C60F} Win32Proj - logging + spdlog @@ -22,7 +21,6 @@ - Default diff --git a/src/modules/colorPicker/ColorPicker/ColorPicker.base.rc b/src/modules/colorPicker/ColorPicker/ColorPicker.base.rc index b22c9c2e80..b30e3923c9 100644 --- a/src/modules/colorPicker/ColorPicker/ColorPicker.base.rc +++ b/src/modules/colorPicker/ColorPicker/ColorPicker.base.rc @@ -1,6 +1,6 @@ #include #include "resource.h" -#include "../../../../common/version.h" +#include "../../../../common/version/version.h" #define APSTUDIO_READONLY_SYMBOLS #include "winres.h" diff --git a/src/modules/colorPicker/ColorPicker/ColorPicker.vcxproj b/src/modules/colorPicker/ColorPicker/ColorPicker.vcxproj index 193e0fab78..6e08e9d206 100644 --- a/src/modules/colorPicker/ColorPicker/ColorPicker.vcxproj +++ b/src/modules/colorPicker/ColorPicker/ColorPicker.vcxproj @@ -1,7 +1,6 @@ - @@ -16,7 +15,6 @@ DynamicLibrary - @@ -32,7 +30,6 @@ $(SolutionDir)$(Platform)\$(Configuration)\modules\$(ProjectName)\ - EXAMPLEPOWERTOY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) @@ -42,7 +39,6 @@ $(OutDir)$(TargetName)$(TargetExt) - @@ -58,8 +54,8 @@ - - {74485049-c722-400f-abe5-86ac52d929b3} + + {6955446d-23f7-4023-9bb3-8657f904af99} diff --git a/src/modules/colorPicker/ColorPicker/ColorPicker.vcxproj.filters b/src/modules/colorPicker/ColorPicker/ColorPicker.vcxproj.filters index 6bb6e599f5..b087129bc4 100644 --- a/src/modules/colorPicker/ColorPicker/ColorPicker.vcxproj.filters +++ b/src/modules/colorPicker/ColorPicker/ColorPicker.vcxproj.filters @@ -27,6 +27,9 @@ Generated Files + + Header Files + diff --git a/src/modules/colorPicker/ColorPicker/dllmain.cpp b/src/modules/colorPicker/ColorPicker/dllmain.cpp index 5376a6b896..86bdab7d15 100644 --- a/src/modules/colorPicker/ColorPicker/dllmain.cpp +++ b/src/modules/colorPicker/ColorPicker/dllmain.cpp @@ -1,14 +1,14 @@ // dllmain.cpp : Defines the entry point for the DLL application. #include "pch.h" -#include + #include #include "trace.h" #include "Generated Files/resource.h" -#include -#include -#include +#include +#include +#include -extern "C" IMAGE_DOS_HEADER __ImageBase; +#include BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, diff --git a/src/modules/colorPicker/ColorPicker/pch.h b/src/modules/colorPicker/ColorPicker/pch.h index 6b8a8f11d0..eddac0fdc1 100644 --- a/src/modules/colorPicker/ColorPicker/pch.h +++ b/src/modules/colorPicker/ColorPicker/pch.h @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include \ No newline at end of file diff --git a/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj b/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj index d0b990b15e..77a769846a 100644 --- a/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj +++ b/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj @@ -76,8 +76,8 @@ - - + + diff --git a/src/modules/colorPicker/UnitTest-ColorPickerUI/UnitTest-ColorPickerUI.csproj b/src/modules/colorPicker/UnitTest-ColorPickerUI/UnitTest-ColorPickerUI.csproj index 2d5be9722b..4abfe55292 100644 --- a/src/modules/colorPicker/UnitTest-ColorPickerUI/UnitTest-ColorPickerUI.csproj +++ b/src/modules/colorPicker/UnitTest-ColorPickerUI/UnitTest-ColorPickerUI.csproj @@ -38,7 +38,7 @@ - + diff --git a/src/modules/fancyzones/dll/FancyZonesModule.vcxproj b/src/modules/fancyzones/dll/FancyZonesModule.vcxproj index 91bb34b8a4..a65361c3b7 100644 --- a/src/modules/fancyzones/dll/FancyZonesModule.vcxproj +++ b/src/modules/fancyzones/dll/FancyZonesModule.vcxproj @@ -12,7 +12,6 @@ DynamicLibrary - @@ -30,7 +29,6 @@ $(SolutionDir)$(Platform)\$(Configuration)\modules\FancyZones\ - FANCYZONES_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) @@ -52,8 +50,8 @@ - - {74485049-c722-400f-abe5-86ac52d929b3} + + {caba8dfb-823b-4bf2-93ac-3f31984150d9} {d9b8fc84-322a-4f9f-bbb9-20915c47ddfd} diff --git a/src/modules/fancyzones/dll/FancyZonesModule.vcxproj.filters b/src/modules/fancyzones/dll/FancyZonesModule.vcxproj.filters index c7ebbe4263..6c6aa5fa65 100644 --- a/src/modules/fancyzones/dll/FancyZonesModule.vcxproj.filters +++ b/src/modules/fancyzones/dll/FancyZonesModule.vcxproj.filters @@ -34,8 +34,6 @@ - - Generated Files - + \ No newline at end of file diff --git a/src/modules/fancyzones/dll/dllmain.cpp b/src/modules/fancyzones/dll/dllmain.cpp index a2253d6a43..43f5c5e8ce 100644 --- a/src/modules/fancyzones/dll/dllmain.cpp +++ b/src/modules/fancyzones/dll/dllmain.cpp @@ -1,8 +1,8 @@ #include "pch.h" -#include -#include + +#include #include -#include +#include #include #include @@ -14,8 +14,9 @@ #include #include #include - -extern "C" IMAGE_DOS_HEADER __ImageBase; +#include +#include +#include BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { diff --git a/src/modules/fancyzones/lib/FancyZones.cpp b/src/modules/fancyzones/lib/FancyZones.cpp index e2a1bb0bb1..add3ffea6a 100644 --- a/src/modules/fancyzones/lib/FancyZones.cpp +++ b/src/modules/fancyzones/lib/FancyZones.cpp @@ -1,10 +1,9 @@ #include "pch.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include #include "FancyZones.h" #include "lib/Settings.h" @@ -14,14 +13,14 @@ #include "lib/WindowMoveHandler.h" #include "lib/FancyZonesWinHookEventIDs.h" #include "lib/util.h" +#include "on_thread_executor.h" #include "trace.h" #include "VirtualDesktopUtils.h" #include "MonitorWorkAreaHandler.h" +#include "util.h" #include -extern "C" IMAGE_DOS_HEADER __ImageBase; - enum class DisplayChangeType { WorkArea, @@ -637,9 +636,9 @@ void FancyZones::ToggleEditor() noexcept params += std::to_wstring(spanZonesAcrossMonitors) + divider; /* Span zones */ std::vector> allMonitors; - allMonitors = GetAllMonitorInfo<&MONITORINFOEX::rcWork>(); - - // device id map + allMonitors = FancyZonesUtils::GetAllMonitorInfo<&MONITORINFOEX::rcWork>(); + + // device id map std::unordered_map displayDeviceIdxMap; bool showDpiWarning = false; @@ -649,7 +648,7 @@ void FancyZones::ToggleEditor() noexcept { HMONITOR monitor = monitorData.first; auto monitorInfo = monitorData.second; - + std::wstring monitorId; std::wstring deviceId = FancyZonesUtils::GetDisplayDeviceId(monitorInfo.szDevice, displayDeviceIdxMap); wil::unique_cotaskmem_string virtualDesktopId; @@ -1117,7 +1116,7 @@ bool FancyZones::OnSnapHotkeyBasedOnPosition(HWND window, DWORD vkCode) noexcept current = MonitorFromWindow(window, MONITOR_DEFAULTTONULL); } - auto allMonitors = GetAllMonitorRects<&MONITORINFOEX::rcWork>(); + auto allMonitors = FancyZonesUtils::GetAllMonitorRects<&MONITORINFOEX::rcWork>(); if (current && allMonitors.size() > 1 && m_settings->GetSettings()->moveWindowAcrossMonitors) { diff --git a/src/modules/fancyzones/lib/FancyZones.h b/src/modules/fancyzones/lib/FancyZones.h index ea31a67148..6a188bf7b6 100644 --- a/src/modules/fancyzones/lib/FancyZones.h +++ b/src/modules/fancyzones/lib/FancyZones.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include diff --git a/src/modules/fancyzones/lib/FancyZonesData.cpp b/src/modules/fancyzones/lib/FancyZonesData.cpp index 281cb2fa91..7880714642 100644 --- a/src/modules/fancyzones/lib/FancyZonesData.cpp +++ b/src/modules/fancyzones/lib/FancyZonesData.cpp @@ -5,8 +5,7 @@ #include "ZoneSet.h" #include "Settings.h" -#include -#include +#include #include #include @@ -15,6 +14,7 @@ #include #include #include +#include // Non-localizable strings namespace NonLocalizable diff --git a/src/modules/fancyzones/lib/FancyZonesData.h b/src/modules/fancyzones/lib/FancyZonesData.h index 74babcd3cd..d825e43ee9 100644 --- a/src/modules/fancyzones/lib/FancyZonesData.h +++ b/src/modules/fancyzones/lib/FancyZonesData.h @@ -2,8 +2,8 @@ #include "JsonHelpers.h" -#include -#include +#include +#include #include #include diff --git a/src/modules/fancyzones/lib/FancyZonesDataTypes.h b/src/modules/fancyzones/lib/FancyZonesDataTypes.h index c2221fb6ce..51eccfb4c6 100644 --- a/src/modules/fancyzones/lib/FancyZonesDataTypes.h +++ b/src/modules/fancyzones/lib/FancyZonesDataTypes.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include diff --git a/src/modules/fancyzones/lib/FancyZonesLib.vcxproj b/src/modules/fancyzones/lib/FancyZonesLib.vcxproj index e462a72887..63bf8e2948 100644 --- a/src/modules/fancyzones/lib/FancyZonesLib.vcxproj +++ b/src/modules/fancyzones/lib/FancyZonesLib.vcxproj @@ -15,7 +15,6 @@ StaticLibrary - @@ -28,18 +27,15 @@ - $(SolutionDir)$(Platform)\$(Configuration)\modules\FancyZones\ - _LIB;%(PreprocessorDefinitions) ..\;..\..\..\common\inc;..\..\..\common\Telemetry;..\..\;..\..\..\;%(AdditionalIncludeDirectories) - @@ -70,6 +66,7 @@ + Create @@ -84,9 +81,11 @@ - + + {1d5be09d-78c0-4fd7-af00-ae7c1af7c525} + diff --git a/src/modules/fancyzones/lib/FancyZonesLib.vcxproj.filters b/src/modules/fancyzones/lib/FancyZonesLib.vcxproj.filters index c1cfb674ec..4dcb504920 100644 --- a/src/modules/fancyzones/lib/FancyZonesLib.vcxproj.filters +++ b/src/modules/fancyzones/lib/FancyZonesLib.vcxproj.filters @@ -131,6 +131,9 @@ Source Files + + Source Files + diff --git a/src/modules/fancyzones/lib/JsonHelpers.h b/src/modules/fancyzones/lib/JsonHelpers.h index cf3dceb578..81f5911391 100644 --- a/src/modules/fancyzones/lib/JsonHelpers.h +++ b/src/modules/fancyzones/lib/JsonHelpers.h @@ -2,7 +2,7 @@ #include "FancyZonesDataTypes.h" -#include +#include #include #include diff --git a/src/common/on_thread_executor.cpp b/src/modules/fancyzones/lib/OnThreadExecutor.cpp similarity index 100% rename from src/common/on_thread_executor.cpp rename to src/modules/fancyzones/lib/OnThreadExecutor.cpp diff --git a/src/modules/fancyzones/lib/Settings.cpp b/src/modules/fancyzones/lib/Settings.cpp index b782d926af..04a6b59086 100644 --- a/src/modules/fancyzones/lib/Settings.cpp +++ b/src/modules/fancyzones/lib/Settings.cpp @@ -1,12 +1,11 @@ #include "pch.h" -#include -#include +#include +#include + #include "lib/Settings.h" #include "lib/FancyZones.h" #include "trace.h" -extern "C" IMAGE_DOS_HEADER __ImageBase; - // Non-Localizable strings namespace NonLocalizable { @@ -43,20 +42,26 @@ namespace NonLocalizable struct FancyZonesSettings : winrt::implements { public: - FancyZonesSettings(HINSTANCE hinstance, PCWSTR name, PCWSTR key) - : m_hinstance(hinstance), + FancyZonesSettings(HINSTANCE hinstance, PCWSTR name, PCWSTR key) : + m_hinstance(hinstance), m_moduleName(name), m_moduleKey(key) { LoadSettings(name, true); } - IFACEMETHODIMP_(void) SetCallback(IFancyZonesCallback* callback) { m_callback = callback; } - IFACEMETHODIMP_(void) ResetCallback() { m_callback = nullptr; } - IFACEMETHODIMP_(bool) GetConfig(_Out_ PWSTR buffer, _Out_ int *buffer_sizeg) noexcept; - IFACEMETHODIMP_(void) SetConfig(PCWSTR config) noexcept; - IFACEMETHODIMP_(void) CallCustomAction(PCWSTR action) noexcept; - IFACEMETHODIMP_(const Settings*) GetSettings() const noexcept { return &m_settings; } + IFACEMETHODIMP_(void) + SetCallback(IFancyZonesCallback* callback) { m_callback = callback; } + IFACEMETHODIMP_(void) + ResetCallback() { m_callback = nullptr; } + IFACEMETHODIMP_(bool) + GetConfig(_Out_ PWSTR buffer, _Out_ int* buffer_sizeg) noexcept; + IFACEMETHODIMP_(void) + SetConfig(PCWSTR config) noexcept; + IFACEMETHODIMP_(void) + CallCustomAction(PCWSTR action) noexcept; + IFACEMETHODIMP_(const Settings*) + GetSettings() const noexcept { return &m_settings; } private: void LoadSettings(PCWSTR config, bool fromFile) noexcept; @@ -74,7 +79,8 @@ private: PCWSTR name; bool* value; int resourceId; - } m_configBools[14 /* 15 */] = { // "Turning FLASHING_ZONE option off" + } m_configBools[14 /* 15 */] = { + // "Turning FLASHING_ZONE option off" { NonLocalizable::ShiftDragID, &m_settings.shiftDrag, IDS_SETTING_DESCRIPTION_SHIFTDRAG }, { NonLocalizable::MouseSwitchID, &m_settings.mouseSwitch, IDS_SETTING_DESCRIPTION_MOUSESWITCH }, { NonLocalizable::OverrideSnapHotKeysID, &m_settings.overrideSnapHotkeys, IDS_SETTING_DESCRIPTION_OVERRIDE_SNAP_HOTKEYS }, @@ -89,14 +95,14 @@ private: { NonLocalizable::OpenWindowOnActiveMonitorID, &m_settings.openWindowOnActiveMonitor, IDS_SETTING_DESCRIPTION_OPEN_WINDOW_ON_ACTIVE_MONITOR }, { NonLocalizable::RestoreSizeID, &m_settings.restoreSize, IDS_SETTING_DESCRIPTION_RESTORESIZE }, { NonLocalizable::UseCursorPosEditorStartupScreenID, &m_settings.use_cursorpos_editor_startupscreen, IDS_SETTING_DESCRIPTION_USE_CURSORPOS_EDITOR_STARTUPSCREEN }, - { NonLocalizable::ShowOnAllMonitorsID, &m_settings.showZonesOnAllMonitors, IDS_SETTING_DESCRIPTION_SHOW_FANCY_ZONES_ON_ALL_MONITORS}, + { NonLocalizable::ShowOnAllMonitorsID, &m_settings.showZonesOnAllMonitors, IDS_SETTING_DESCRIPTION_SHOW_FANCY_ZONES_ON_ALL_MONITORS }, { NonLocalizable::SpanZonesAcrossMonitorsID, &m_settings.spanZonesAcrossMonitors, IDS_SETTING_DESCRIPTION_SPAN_ZONES_ACROSS_MONITORS }, - { NonLocalizable::MakeDraggedWindowTransparentID, &m_settings.makeDraggedWindowTransparent, IDS_SETTING_DESCRIPTION_MAKE_DRAGGED_WINDOW_TRANSPARENT}, + { NonLocalizable::MakeDraggedWindowTransparentID, &m_settings.makeDraggedWindowTransparent, IDS_SETTING_DESCRIPTION_MAKE_DRAGGED_WINDOW_TRANSPARENT }, }; - }; -IFACEMETHODIMP_(bool) FancyZonesSettings::GetConfig(_Out_ PWSTR buffer, _Out_ int *buffer_size) noexcept +IFACEMETHODIMP_(bool) +FancyZonesSettings::GetConfig(_Out_ PWSTR buffer, _Out_ int* buffer_size) noexcept { PowerToysSettings::Settings settings(m_hinstance, m_moduleName); @@ -112,8 +118,7 @@ IFACEMETHODIMP_(bool) FancyZonesSettings::GetConfig(_Out_ PWSTR buffer, _Out_ in NonLocalizable::ToggleEditorActionID, // action name. IDS_SETTING_LAUNCH_EDITOR_LABEL, IDS_SETTING_LAUNCH_EDITOR_BUTTON, - IDS_SETTING_LAUNCH_EDITOR_DESCRIPTION - ); + IDS_SETTING_LAUNCH_EDITOR_DESCRIPTION); settings.add_hotkey(NonLocalizable::EditorHotkeyID, IDS_SETTING_LAUNCH_EDITOR_HOTKEY_LABEL, m_settings.editorHotkey); for (auto const& setting : m_configBools) @@ -132,7 +137,8 @@ IFACEMETHODIMP_(bool) FancyZonesSettings::GetConfig(_Out_ PWSTR buffer, _Out_ in return settings.serialize_to_buffer(buffer, buffer_size); } -IFACEMETHODIMP_(void) FancyZonesSettings::SetConfig(PCWSTR serializedPowerToysSettingsJson) noexcept +IFACEMETHODIMP_(void) +FancyZonesSettings::SetConfig(PCWSTR serializedPowerToysSettingsJson) noexcept { LoadSettings(serializedPowerToysSettingsJson, false /*fromFile*/); SaveSettings(); @@ -143,7 +149,8 @@ IFACEMETHODIMP_(void) FancyZonesSettings::SetConfig(PCWSTR serializedPowerToysSe Trace::SettingsChanged(m_settings); } -IFACEMETHODIMP_(void) FancyZonesSettings::CallCustomAction(PCWSTR action) noexcept +IFACEMETHODIMP_(void) +FancyZonesSettings::CallCustomAction(PCWSTR action) noexcept { try { @@ -173,8 +180,8 @@ void FancyZonesSettings::LoadSettings(PCWSTR config, bool fromFile) noexcept try { PowerToysSettings::PowerToyValues values = fromFile ? - PowerToysSettings::PowerToyValues::load_from_settings_file(m_moduleKey) : - PowerToysSettings::PowerToyValues::from_json_string(config, m_moduleKey); + PowerToysSettings::PowerToyValues::load_from_settings_file(m_moduleKey) : + PowerToysSettings::PowerToyValues::from_json_string(config, m_moduleKey); for (auto const& setting : m_configBools) { diff --git a/src/modules/fancyzones/lib/Settings.h b/src/modules/fancyzones/lib/Settings.h index 973348ad5a..b0c762330d 100644 --- a/src/modules/fancyzones/lib/Settings.h +++ b/src/modules/fancyzones/lib/Settings.h @@ -1,6 +1,6 @@ #pragma once -#include +#include // Zoned window properties are not localized. namespace ZonedWindowProperties @@ -49,4 +49,4 @@ interface __declspec(uuid("{BA4E77C4-6F44-4C5D-93D3-CBDE880495C2}")) IFancyZones IFACEMETHOD_(const Settings*, GetSettings)() const = 0; }; -winrt::com_ptr MakeFancyZonesSettings(HINSTANCE hinstance, PCWSTR name, PCWSTR key) noexcept; \ No newline at end of file +winrt::com_ptr MakeFancyZonesSettings(HINSTANCE hinstance, PCWSTR name, PCWSTR key) noexcept; diff --git a/src/modules/fancyzones/lib/WindowMoveHandler.cpp b/src/modules/fancyzones/lib/WindowMoveHandler.cpp index ee2361ffa7..55ef38ec36 100644 --- a/src/modules/fancyzones/lib/WindowMoveHandler.cpp +++ b/src/modules/fancyzones/lib/WindowMoveHandler.cpp @@ -1,18 +1,17 @@ #include "pch.h" #include "WindowMoveHandler.h" -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "FancyZonesData.h" #include "Settings.h" #include "ZoneWindow.h" #include "util.h" -extern "C" IMAGE_DOS_HEADER __ImageBase; - // Non-Localizable strings namespace NonLocalizable { @@ -301,6 +300,7 @@ void WindowMoveHandler::WarnIfElevationIsRequired(HWND window) noexcept { using namespace notifications; using namespace NonLocalizable; + using namespace FancyZonesUtils; static bool warning_shown = false; if (!is_process_elevated() && IsProcessOfWindowElevated(window)) diff --git a/src/modules/fancyzones/lib/Zone.cpp b/src/modules/fancyzones/lib/Zone.cpp index b6493933e2..47da31fc3d 100644 --- a/src/modules/fancyzones/lib/Zone.cpp +++ b/src/modules/fancyzones/lib/Zone.cpp @@ -3,8 +3,8 @@ #include -#include -#include +#include +#include #include "Zone.h" #include "Settings.h" #include "util.h" diff --git a/src/modules/fancyzones/lib/ZoneSet.cpp b/src/modules/fancyzones/lib/ZoneSet.cpp index 42a697b4e6..e70336c382 100644 --- a/src/modules/fancyzones/lib/ZoneSet.cpp +++ b/src/modules/fancyzones/lib/ZoneSet.cpp @@ -8,7 +8,7 @@ #include "Zone.h" #include "util.h" -#include +#include #include #include diff --git a/src/modules/fancyzones/lib/ZoneSet.h b/src/modules/fancyzones/lib/ZoneSet.h index 48f4de4afe..d7bdf6b3fd 100644 --- a/src/modules/fancyzones/lib/ZoneSet.h +++ b/src/modules/fancyzones/lib/ZoneSet.h @@ -171,4 +171,4 @@ struct ZoneSetConfig int SensitivityRadius; }; -winrt::com_ptr MakeZoneSet(ZoneSetConfig const& config) noexcept; \ No newline at end of file +winrt::com_ptr MakeZoneSet(ZoneSetConfig const& config) noexcept; diff --git a/src/modules/fancyzones/lib/ZoneWindow.cpp b/src/modules/fancyzones/lib/ZoneWindow.cpp index fde97a0049..165926ddc7 100644 --- a/src/modules/fancyzones/lib/ZoneWindow.cpp +++ b/src/modules/fancyzones/lib/ZoneWindow.cpp @@ -1,7 +1,6 @@ #include "pch.h" -#include -#include +#include #include "FancyZonesData.h" #include "FancyZonesDataTypes.h" @@ -9,6 +8,7 @@ #include "ZoneWindowDrawing.h" #include "trace.h" #include "util.h" +#include "on_thread_executor.h" #include "Settings.h" #include @@ -195,7 +195,7 @@ IFACEMETHODIMP ZoneWindow::MoveSizeUpdate(POINT const& ptScreen, bool dragEnable { m_zoneWindowDrawing->DrawActiveZoneSet(m_activeZoneSet->GetZones(), m_highlightZone, m_host); } - + return S_OK; } diff --git a/src/modules/fancyzones/lib/fancyzones.base.rc b/src/modules/fancyzones/lib/fancyzones.base.rc index 097910d703..6eaa430477 100644 --- a/src/modules/fancyzones/lib/fancyzones.base.rc +++ b/src/modules/fancyzones/lib/fancyzones.base.rc @@ -1,6 +1,6 @@ #include #include "resource.h" -#include "../../../../common/version.h" +#include "../../../../common/version/version.h" #define APSTUDIO_READONLY_SYMBOLS #include "winres.h" diff --git a/src/common/on_thread_executor.h b/src/modules/fancyzones/lib/on_thread_executor.h similarity index 100% rename from src/common/on_thread_executor.h rename to src/modules/fancyzones/lib/on_thread_executor.h diff --git a/src/modules/fancyzones/lib/util.cpp b/src/modules/fancyzones/lib/util.cpp index 80159f92a4..8d7be193d4 100644 --- a/src/modules/fancyzones/lib/util.cpp +++ b/src/modules/fancyzones/lib/util.cpp @@ -2,12 +2,14 @@ #include "util.h" #include "Settings.h" -#include -#include +#include +#include +#include #include #include #include +#include #include @@ -18,6 +20,20 @@ namespace NonLocalizable const wchar_t PowerToysAppFZEditor[] = L"FANCYZONESEDITOR.EXE"; } +bool find_app_name_in_path(const std::wstring& where, const std::vector& what) +{ + for (const auto& row : what) + { + const auto pos = where.rfind(row); + const auto last_slash = where.rfind('\\'); + //Check that row occurs in where, and its last occurrence contains in itself the first character after the last backslash. + if (pos != std::wstring::npos && pos <= last_slash + 1 && pos + row.length() > last_slash) + { + return true; + } + } + return false; +} namespace { bool IsZonableByProcessPath(const std::wstring& processPath, const std::vector& excludedApps) @@ -65,7 +81,7 @@ namespace FancyZonesUtils return defaultDeviceId; } } - + std::optional ParseDeviceId(const std::wstring& str) { FancyZonesDataTypes::DeviceIdData data; @@ -93,7 +109,7 @@ namespace FancyZonesUtils data.deviceName += L"#" + temp; } - else if(std::getline(wss, temp, L'_') && !temp.empty()) + else if (std::getline(wss, temp, L'_') && !temp.empty()) { data.deviceName = temp; } @@ -153,7 +169,7 @@ namespace FancyZonesUtils return data; } - + typedef BOOL(WINAPI* GetDpiForMonitorInternalFunc)(HMONITOR, UINT, UINT*, UINT*); std::wstring GetDisplayDeviceId(const std::wstring& device, std::unordered_map& displayDeviceIdxMap) { @@ -618,7 +634,7 @@ namespace FancyZonesUtils const double eccentricity = 2.0; auto rectCenter = [](RECT rect) { - return complex { + return complex{ 0.5 * rect.left + 0.5 * rect.right, 0.5 * rect.top + 0.5 * rect.bottom }; @@ -732,4 +748,33 @@ namespace FancyZonesUtils return windowRect; } + + bool IsProcessOfWindowElevated(HWND window) + { + DWORD pid = 0; + GetWindowThreadProcessId(window, &pid); + if (!pid) + { + return false; + } + + wil::unique_handle hProcess{ OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, + FALSE, + pid) }; + + wil::unique_handle token; + bool elevated = false; + + if (OpenProcessToken(hProcess.get(), TOKEN_QUERY, &token)) + { + TOKEN_ELEVATION elevation; + DWORD size; + if (GetTokenInformation(token.get(), TokenElevation, &elevation, sizeof(elevation), &size)) + { + return elevation.TokenIsElevated != 0; + } + } + return false; + } + } diff --git a/src/modules/fancyzones/lib/util.h b/src/modules/fancyzones/lib/util.h index a72442a85d..bb09722770 100644 --- a/src/modules/fancyzones/lib/util.h +++ b/src/modules/fancyzones/lib/util.h @@ -1,8 +1,7 @@ #pragma once #include "gdiplus.h" -#include -#include +#include namespace FancyZonesDataTypes { @@ -95,7 +94,7 @@ namespace FancyZonesUtils inline COLORREF HexToRGB(std::wstring_view hex, const COLORREF fallbackColor = RGB(255, 255, 255)) { hex = left_trim(trim(hex), L"#"); - + try { const long long tmp = std::stoll(hex.data(), nullptr, 16); @@ -115,6 +114,50 @@ namespace FancyZonesUtils return static_cast(opacity * 2.55); } + template + std::vector> GetAllMonitorRects() + { + using result_t = std::vector>; + result_t result; + + auto enumMonitors = [](HMONITOR monitor, HDC hdc, LPRECT pRect, LPARAM param) -> BOOL { + MONITORINFOEX mi; + mi.cbSize = sizeof(mi); + result_t& result = *reinterpret_cast(param); + if (GetMonitorInfo(monitor, &mi)) + { + result.push_back({ monitor, mi.*member }); + } + + return TRUE; + }; + + EnumDisplayMonitors(NULL, NULL, enumMonitors, reinterpret_cast(&result)); + return result; + } + + template + std::vector> GetAllMonitorInfo() + { + using result_t = std::vector>; + result_t result; + + auto enumMonitors = [](HMONITOR monitor, HDC hdc, LPRECT pRect, LPARAM param) -> BOOL { + MONITORINFOEX mi; + mi.cbSize = sizeof(mi); + result_t& result = *reinterpret_cast(param); + if (GetMonitorInfo(monitor, &mi)) + { + result.push_back({ monitor, mi }); + } + + return TRUE; + }; + + EnumDisplayMonitors(NULL, NULL, enumMonitors, reinterpret_cast(&result)); + return result; + } + template RECT GetAllMonitorsCombinedRect() { @@ -168,4 +211,7 @@ namespace FancyZonesUtils RECT PrepareRectForCycling(RECT windowRect, RECT zoneWindowRect, DWORD vkCode) noexcept; size_t ChooseNextZoneByPosition(DWORD vkCode, RECT windowRect, const std::vector& zoneRects) noexcept; + + // If HWND is already dead, we assume it wasn't elevated + bool IsProcessOfWindowElevated(HWND window); } diff --git a/src/modules/fancyzones/tests/UnitTests/FancyZonesSettings.Spec.cpp b/src/modules/fancyzones/tests/UnitTests/FancyZonesSettings.Spec.cpp index 1ea486e326..ef5c050ab4 100644 --- a/src/modules/fancyzones/tests/UnitTests/FancyZonesSettings.Spec.cpp +++ b/src/modules/fancyzones/tests/UnitTests/FancyZonesSettings.Spec.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include using namespace Microsoft::VisualStudio::CppUnitTestFramework; diff --git a/src/modules/fancyzones/tests/UnitTests/UnitTests-FancyZones.rc b/src/modules/fancyzones/tests/UnitTests/UnitTests-FancyZones.rc index 5bbc01965c..5946d04f47 100644 --- a/src/modules/fancyzones/tests/UnitTests/UnitTests-FancyZones.rc +++ b/src/modules/fancyzones/tests/UnitTests/UnitTests-FancyZones.rc @@ -1,6 +1,6 @@ #include #include "resource.h" -#include "../../../../common/version.h" +#include "../../../../common/version/version.h" 1 VERSIONINFO FILEVERSION FILE_VERSION diff --git a/src/modules/fancyzones/tests/UnitTests/UnitTests.vcxproj b/src/modules/fancyzones/tests/UnitTests/UnitTests.vcxproj index 9796ca8054..a84dee3a95 100644 --- a/src/modules/fancyzones/tests/UnitTests/UnitTests.vcxproj +++ b/src/modules/fancyzones/tests/UnitTests/UnitTests.vcxproj @@ -39,7 +39,6 @@ gdiplus.lib;dwmapi.lib;shlwapi.lib;uxtheme.lib;shcore.lib;%(AdditionalDependencies) - @@ -59,8 +58,8 @@ - - {74485049-c722-400f-abe5-86ac52d929b3} + + {caba8dfb-823b-4bf2-93ac-3f31984150d9} {f9c68edf-ac74-4b77-9af1-005d9c9f6a99} diff --git a/src/modules/fancyzones/tests/UnitTests/ZoneSet.Spec.cpp b/src/modules/fancyzones/tests/UnitTests/ZoneSet.Spec.cpp index c0982166dd..7c4460c066 100644 --- a/src/modules/fancyzones/tests/UnitTests/ZoneSet.Spec.cpp +++ b/src/modules/fancyzones/tests/UnitTests/ZoneSet.Spec.cpp @@ -8,7 +8,7 @@ #include #include "Util.h" -#include +#include #include using namespace Microsoft::VisualStudio::CppUnitTestFramework; diff --git a/src/modules/fancyzones/tests/UnitTests/ZoneWindow.Spec.cpp b/src/modules/fancyzones/tests/UnitTests/ZoneWindow.Spec.cpp index 7a42d78380..baba9c16fb 100644 --- a/src/modules/fancyzones/tests/UnitTests/ZoneWindow.Spec.cpp +++ b/src/modules/fancyzones/tests/UnitTests/ZoneWindow.Spec.cpp @@ -2,7 +2,6 @@ #include -#include #include #include #include @@ -12,6 +11,8 @@ #include #include "Util.h" +#include + using namespace Microsoft::VisualStudio::CppUnitTestFramework; namespace FancyZonesUnitTests @@ -62,7 +63,7 @@ namespace FancyZonesUnitTests const std::wstring m_deviceId = L"\\\\?\\DISPLAY#DELA026#5&10a58c63&0&UID16777488#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}"; const std::wstring m_virtualDesktopId = L"MyVirtualDesktopId"; - TEST_CLASS(ZoneWindowCreationUnitTests) + TEST_CLASS (ZoneWindowCreationUnitTests) { std::wstringstream m_parentUniqueId; std::wstringstream m_uniqueId; @@ -83,110 +84,134 @@ namespace FancyZonesUnitTests } TEST_METHOD_INITIALIZE(Init) - { - m_hInst = (HINSTANCE)GetModuleHandleW(nullptr); - - m_monitor = MonitorFromPoint(POINT{ 0, 0 }, MONITOR_DEFAULTTOPRIMARY); - m_monitorInfo.cbSize = sizeof(m_monitorInfo); - Assert::AreNotEqual(0, GetMonitorInfoW(m_monitor, &m_monitorInfo)); - - m_parentUniqueId << L"DELA026#5&10a58c63&0&UID16777488_" << m_monitorInfo.rcMonitor.right << "_" << m_monitorInfo.rcMonitor.bottom << "_{61FA9FC0-26A6-4B37-A834-491C148DFC57}"; - m_uniqueId << L"DELA026#5&10a58c63&0&UID16777488_" << m_monitorInfo.rcMonitor.right << "_" << m_monitorInfo.rcMonitor.bottom << "_{39B25DD2-130D-4B5D-8851-4791D66B1539}"; - - m_fancyZonesData.SetSettingsModulePath(L"FancyZonesUnitTests"); - m_fancyZonesData.clear_data(); - - auto guid = Helpers::StringToGuid(L"{39B25DD2-130D-4B5D-8851-4791D66B1539}"); - Assert::IsTrue(guid.has_value()); - m_virtualDesktopGuid = *guid; - } - - TEST_METHOD(CreateZoneWindow) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - testZoneWindow(zoneWindow); - - auto* activeZoneSet{ zoneWindow->ActiveZoneSet() }; - Assert::IsNotNull(activeZoneSet); - Assert::AreEqual(static_cast(activeZoneSet->LayoutType()), static_cast(FancyZonesDataTypes::ZoneSetLayoutType::PriorityGrid)); - Assert::AreEqual(activeZoneSet->GetZones().size(), static_cast(3)); - } - - TEST_METHOD(CreateZoneWindowNoHinst) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), {}, m_monitor, m_uniqueId.str(), {}); - testZoneWindow(zoneWindow); - - auto* activeZoneSet{ zoneWindow->ActiveZoneSet() }; - Assert::IsNotNull(activeZoneSet); - Assert::AreEqual(static_cast(activeZoneSet->LayoutType()), static_cast(FancyZonesDataTypes::ZoneSetLayoutType::PriorityGrid)); - Assert::AreEqual(activeZoneSet->GetZones().size(), static_cast(3)); - } - - TEST_METHOD(CreateZoneWindowNoHinstFlashZones) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), {}, m_monitor, m_uniqueId.str(), {}); - testZoneWindow(zoneWindow); - - auto* activeZoneSet{ zoneWindow->ActiveZoneSet() }; - Assert::IsNotNull(activeZoneSet); - Assert::AreEqual(static_cast(activeZoneSet->LayoutType()), static_cast(FancyZonesDataTypes::ZoneSetLayoutType::PriorityGrid)); - Assert::AreEqual(activeZoneSet->GetZones().size(), static_cast(3)); - } - - TEST_METHOD(CreateZoneWindowNoMonitor) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, {}, m_uniqueId.str(), {}); - testZoneWindow(zoneWindow); - } - - TEST_METHOD(CreateZoneWindowNoDeviceId) - { - // Generate unique id without device id - std::wstring uniqueId = FancyZonesUtils::GenerateUniqueId(m_monitor, {}, m_virtualDesktopId); - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, uniqueId, {}); - - const std::wstring expectedWorkArea = std::to_wstring(m_monitorInfo.rcMonitor.right) + L"_" + std::to_wstring(m_monitorInfo.rcMonitor.bottom); - const std::wstring expectedUniqueId = L"FallbackDevice_" + std::to_wstring(m_monitorInfo.rcMonitor.right) + L"_" + std::to_wstring(m_monitorInfo.rcMonitor.bottom) + L"_" + m_virtualDesktopId; - - Assert::IsNotNull(zoneWindow.get()); - Assert::AreEqual(expectedUniqueId.c_str(), zoneWindow->UniqueId().c_str()); - - auto* activeZoneSet{ zoneWindow->ActiveZoneSet() }; - Assert::IsNotNull(activeZoneSet); - Assert::AreEqual(static_cast(activeZoneSet->LayoutType()), static_cast(FancyZonesDataTypes::ZoneSetLayoutType::PriorityGrid)); - Assert::AreEqual(activeZoneSet->GetZones().size(), static_cast(3)); - } - - TEST_METHOD(CreateZoneWindowNoDesktopId) - { - // Generate unique id without virtual desktop id - std::wstring uniqueId = FancyZonesUtils::GenerateUniqueId(m_monitor, m_deviceId, {}); - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, uniqueId, {}); - - const std::wstring expectedWorkArea = std::to_wstring(m_monitorInfo.rcMonitor.right) + L"_" + std::to_wstring(m_monitorInfo.rcMonitor.bottom); - Assert::IsNotNull(zoneWindow.get()); - Assert::IsTrue(zoneWindow->UniqueId().empty()); - - auto* activeZoneSet{ zoneWindow->ActiveZoneSet() }; - Assert::IsNotNull(activeZoneSet); - Assert::AreEqual(static_cast(activeZoneSet->LayoutType()), static_cast(FancyZonesDataTypes::ZoneSetLayoutType::PriorityGrid)); - Assert::AreEqual(activeZoneSet->GetZones().size(), static_cast(3)); - } - - TEST_METHOD(CreateZoneWindowWithActiveZoneTmpFile) - { - using namespace FancyZonesDataTypes; - - const auto activeZoneSetTempPath = m_fancyZonesData.activeZoneSetTmpFileName; - - for (int type = static_cast(ZoneSetLayoutType::Focus); type < static_cast(ZoneSetLayoutType::Custom); type++) { - const auto expectedZoneSet = ZoneSetData{ Helpers::CreateGuidString(), static_cast(type) }; + m_hInst = (HINSTANCE)GetModuleHandleW(nullptr); + + m_monitor = MonitorFromPoint(POINT{ 0, 0 }, MONITOR_DEFAULTTOPRIMARY); + m_monitorInfo.cbSize = sizeof(m_monitorInfo); + Assert::AreNotEqual(0, GetMonitorInfoW(m_monitor, &m_monitorInfo)); + + m_parentUniqueId << L"DELA026#5&10a58c63&0&UID16777488_" << m_monitorInfo.rcMonitor.right << "_" << m_monitorInfo.rcMonitor.bottom << "_{61FA9FC0-26A6-4B37-A834-491C148DFC57}"; + m_uniqueId << L"DELA026#5&10a58c63&0&UID16777488_" << m_monitorInfo.rcMonitor.right << "_" << m_monitorInfo.rcMonitor.bottom << "_{39B25DD2-130D-4B5D-8851-4791D66B1539}"; + + m_fancyZonesData.SetSettingsModulePath(L"FancyZonesUnitTests"); + m_fancyZonesData.clear_data(); + + auto guid = Helpers::StringToGuid(L"{39B25DD2-130D-4B5D-8851-4791D66B1539}"); + Assert::IsTrue(guid.has_value()); + m_virtualDesktopGuid = *guid; + } + + TEST_METHOD (CreateZoneWindow) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + testZoneWindow(zoneWindow); + + auto* activeZoneSet{ zoneWindow->ActiveZoneSet() }; + Assert::IsNotNull(activeZoneSet); + Assert::AreEqual(static_cast(activeZoneSet->LayoutType()), static_cast(FancyZonesDataTypes::ZoneSetLayoutType::PriorityGrid)); + Assert::AreEqual(activeZoneSet->GetZones().size(), static_cast(3)); + } + + TEST_METHOD (CreateZoneWindowNoHinst) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), {}, m_monitor, m_uniqueId.str(), {}); + testZoneWindow(zoneWindow); + + auto* activeZoneSet{ zoneWindow->ActiveZoneSet() }; + Assert::IsNotNull(activeZoneSet); + Assert::AreEqual(static_cast(activeZoneSet->LayoutType()), static_cast(FancyZonesDataTypes::ZoneSetLayoutType::PriorityGrid)); + Assert::AreEqual(activeZoneSet->GetZones().size(), static_cast(3)); + } + + TEST_METHOD (CreateZoneWindowNoHinstFlashZones) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), {}, m_monitor, m_uniqueId.str(), {}); + testZoneWindow(zoneWindow); + + auto* activeZoneSet{ zoneWindow->ActiveZoneSet() }; + Assert::IsNotNull(activeZoneSet); + Assert::AreEqual(static_cast(activeZoneSet->LayoutType()), static_cast(FancyZonesDataTypes::ZoneSetLayoutType::PriorityGrid)); + Assert::AreEqual(activeZoneSet->GetZones().size(), static_cast(3)); + } + + TEST_METHOD (CreateZoneWindowNoMonitor) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, {}, m_uniqueId.str(), {}); + testZoneWindow(zoneWindow); + } + + TEST_METHOD (CreateZoneWindowNoDeviceId) + { + // Generate unique id without device id + std::wstring uniqueId = FancyZonesUtils::GenerateUniqueId(m_monitor, {}, m_virtualDesktopId); + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, uniqueId, {}); + + const std::wstring expectedWorkArea = std::to_wstring(m_monitorInfo.rcMonitor.right) + L"_" + std::to_wstring(m_monitorInfo.rcMonitor.bottom); + const std::wstring expectedUniqueId = L"FallbackDevice_" + std::to_wstring(m_monitorInfo.rcMonitor.right) + L"_" + std::to_wstring(m_monitorInfo.rcMonitor.bottom) + L"_" + m_virtualDesktopId; + + Assert::IsNotNull(zoneWindow.get()); + Assert::AreEqual(expectedUniqueId.c_str(), zoneWindow->UniqueId().c_str()); + + auto* activeZoneSet{ zoneWindow->ActiveZoneSet() }; + Assert::IsNotNull(activeZoneSet); + Assert::AreEqual(static_cast(activeZoneSet->LayoutType()), static_cast(FancyZonesDataTypes::ZoneSetLayoutType::PriorityGrid)); + Assert::AreEqual(activeZoneSet->GetZones().size(), static_cast(3)); + } + + TEST_METHOD (CreateZoneWindowNoDesktopId) + { + // Generate unique id without virtual desktop id + std::wstring uniqueId = FancyZonesUtils::GenerateUniqueId(m_monitor, m_deviceId, {}); + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, uniqueId, {}); + + const std::wstring expectedWorkArea = std::to_wstring(m_monitorInfo.rcMonitor.right) + L"_" + std::to_wstring(m_monitorInfo.rcMonitor.bottom); + Assert::IsNotNull(zoneWindow.get()); + Assert::IsTrue(zoneWindow->UniqueId().empty()); + + auto* activeZoneSet{ zoneWindow->ActiveZoneSet() }; + Assert::IsNotNull(activeZoneSet); + Assert::AreEqual(static_cast(activeZoneSet->LayoutType()), static_cast(FancyZonesDataTypes::ZoneSetLayoutType::PriorityGrid)); + Assert::AreEqual(activeZoneSet->GetZones().size(), static_cast(3)); + } + + TEST_METHOD (CreateZoneWindowWithActiveZoneTmpFile) + { + using namespace FancyZonesDataTypes; + + const auto activeZoneSetTempPath = m_fancyZonesData.activeZoneSetTmpFileName; + + for (int type = static_cast(ZoneSetLayoutType::Focus); type < static_cast(ZoneSetLayoutType::Custom); type++) + { + const auto expectedZoneSet = ZoneSetData{ Helpers::CreateGuidString(), static_cast(type) }; + const auto data = DeviceInfoData{ expectedZoneSet, true, 16, 3 }; + const auto deviceInfo = JSONHelpers::DeviceInfoJSON{ m_uniqueId.str(), data }; + const auto json = JSONHelpers::DeviceInfoJSON::ToJson(deviceInfo); + json::to_file(activeZoneSetTempPath, json); + + m_fancyZonesData.ParseDeviceInfoFromTmpFile(activeZoneSetTempPath); + + //temp file read on initialization + auto actual = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + + testZoneWindow(actual); + + Assert::IsNotNull(actual->ActiveZoneSet()); + } + } + + TEST_METHOD (CreateZoneWindowWithActiveCustomZoneTmpFile) + { + using namespace FancyZonesDataTypes; + + const auto activeZoneSetTempPath = m_fancyZonesData.activeZoneSetTmpFileName; + + const ZoneSetLayoutType type = ZoneSetLayoutType::Custom; + const auto expectedZoneSet = ZoneSetData{ Helpers::CreateGuidString(), type }; const auto data = DeviceInfoData{ expectedZoneSet, true, 16, 3 }; - const auto deviceInfo = JSONHelpers::DeviceInfoJSON{ m_uniqueId.str(), data }; - const auto json = JSONHelpers::DeviceInfoJSON::ToJson(deviceInfo); - json::to_file(activeZoneSetTempPath, json); + JSONHelpers::TDeviceInfoMap deviceInfoMap; + deviceInfoMap.insert(std::make_pair(m_uniqueId.str(), data)); + JSONHelpers::SerializeDeviceInfoToTmpFile(deviceInfoMap, m_virtualDesktopGuid, activeZoneSetTempPath); m_fancyZonesData.ParseDeviceInfoFromTmpFile(activeZoneSetTempPath); @@ -195,233 +220,209 @@ namespace FancyZonesUnitTests testZoneWindow(actual); + //custom zone needs temp file for applied zone Assert::IsNotNull(actual->ActiveZoneSet()); + const auto actualZoneSet = actual->ActiveZoneSet()->GetZones(); + Assert::AreEqual((size_t)0, actualZoneSet.size()); } - } - TEST_METHOD(CreateZoneWindowWithActiveCustomZoneTmpFile) - { - using namespace FancyZonesDataTypes; + TEST_METHOD (CreateZoneWindowWithActiveCustomZoneAppliedTmpFile) + { + using namespace FancyZonesDataTypes; - const auto activeZoneSetTempPath = m_fancyZonesData.activeZoneSetTmpFileName; + //save required data + const auto activeZoneSetTempPath = m_fancyZonesData.activeZoneSetTmpFileName; + const auto appliedZoneSetTempPath = m_fancyZonesData.appliedZoneSetTmpFileName; - const ZoneSetLayoutType type = ZoneSetLayoutType::Custom; - const auto expectedZoneSet = ZoneSetData{ Helpers::CreateGuidString(), type }; - const auto data = DeviceInfoData{ expectedZoneSet, true, 16, 3 }; - JSONHelpers::TDeviceInfoMap deviceInfoMap; - deviceInfoMap.insert(std::make_pair(m_uniqueId.str(), data)); - JSONHelpers::SerializeDeviceInfoToTmpFile(deviceInfoMap, m_virtualDesktopGuid, activeZoneSetTempPath); + const ZoneSetLayoutType type = ZoneSetLayoutType::Custom; + const auto customSetGuid = Helpers::CreateGuidString(); + const auto expectedZoneSet = ZoneSetData{ customSetGuid, type }; + const auto data = DeviceInfoData{ expectedZoneSet, true, 16, 3 }; + JSONHelpers::TDeviceInfoMap deviceInfoMap; + deviceInfoMap.insert(std::make_pair(m_uniqueId.str(), data)); + JSONHelpers::SerializeDeviceInfoToTmpFile(deviceInfoMap, m_virtualDesktopGuid, activeZoneSetTempPath); - m_fancyZonesData.ParseDeviceInfoFromTmpFile(activeZoneSetTempPath); + const auto info = CanvasLayoutInfo{ + 100, 100, std::vector{ CanvasLayoutInfo::Rect{ 0, 0, 100, 100 } } + }; + const auto customZoneData = CustomZoneSetData{ L"name", CustomLayoutType::Canvas, info }; + auto customZoneJson = JSONHelpers::CustomZoneSetJSON::ToJson(JSONHelpers::CustomZoneSetJSON{ customSetGuid, customZoneData }); + JSONHelpers::TCustomZoneSetsMap customZoneSets; + customZoneSets.insert(std::make_pair(customSetGuid, customZoneData)); + JSONHelpers::SerializeCustomZoneSetsToTmpFile(customZoneSets, appliedZoneSetTempPath); + m_fancyZonesData.ParseDeviceInfoFromTmpFile(activeZoneSetTempPath); + m_fancyZonesData.ParseCustomZoneSetsFromTmpFile(appliedZoneSetTempPath); - //temp file read on initialization - auto actual = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + //temp file read on initialization + auto actual = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - testZoneWindow(actual); + testZoneWindow(actual); - //custom zone needs temp file for applied zone - Assert::IsNotNull(actual->ActiveZoneSet()); - const auto actualZoneSet = actual->ActiveZoneSet()->GetZones(); - Assert::AreEqual((size_t)0, actualZoneSet.size()); - } + //custom zone needs temp file for applied zone + Assert::IsNotNull(actual->ActiveZoneSet()); + const auto actualZoneSet = actual->ActiveZoneSet()->GetZones(); + Assert::AreEqual((size_t)1, actualZoneSet.size()); + } - TEST_METHOD(CreateZoneWindowWithActiveCustomZoneAppliedTmpFile) - { - using namespace FancyZonesDataTypes; + TEST_METHOD (CreateZoneWindowWithActiveCustomZoneAppliedTmpFileWithDeletedCustomZones) + { + using namespace FancyZonesDataTypes; - //save required data - const auto activeZoneSetTempPath = m_fancyZonesData.activeZoneSetTmpFileName; - const auto appliedZoneSetTempPath = m_fancyZonesData.appliedZoneSetTmpFileName; + //save required data + const auto activeZoneSetTempPath = m_fancyZonesData.activeZoneSetTmpFileName; + const auto appliedZoneSetTempPath = m_fancyZonesData.appliedZoneSetTmpFileName; + const auto deletedZonesTempPath = m_fancyZonesData.deletedCustomZoneSetsTmpFileName; - const ZoneSetLayoutType type = ZoneSetLayoutType::Custom; - const auto customSetGuid = Helpers::CreateGuidString(); - const auto expectedZoneSet = ZoneSetData{ customSetGuid, type }; - const auto data = DeviceInfoData{ expectedZoneSet, true, 16, 3 }; - JSONHelpers::TDeviceInfoMap deviceInfoMap; - deviceInfoMap.insert(std::make_pair(m_uniqueId.str(), data)); - JSONHelpers::SerializeDeviceInfoToTmpFile(deviceInfoMap, m_virtualDesktopGuid, activeZoneSetTempPath); - - const auto info = CanvasLayoutInfo{ - 100, 100, std::vector{ CanvasLayoutInfo::Rect{ 0, 0, 100, 100 } } - }; - const auto customZoneData = CustomZoneSetData{ L"name", CustomLayoutType::Canvas, info }; - auto customZoneJson = JSONHelpers::CustomZoneSetJSON::ToJson(JSONHelpers::CustomZoneSetJSON{ customSetGuid, customZoneData }); - JSONHelpers::TCustomZoneSetsMap customZoneSets; - customZoneSets.insert(std::make_pair(customSetGuid, customZoneData)); - JSONHelpers::SerializeCustomZoneSetsToTmpFile(customZoneSets, appliedZoneSetTempPath); - m_fancyZonesData.ParseDeviceInfoFromTmpFile(activeZoneSetTempPath); - m_fancyZonesData.ParseCustomZoneSetsFromTmpFile(appliedZoneSetTempPath); + const ZoneSetLayoutType type = ZoneSetLayoutType::Custom; + const auto customSetGuid = Helpers::CreateGuidString(); + const auto expectedZoneSet = ZoneSetData{ customSetGuid, type }; + const auto data = DeviceInfoData{ expectedZoneSet, true, 16, 3 }; + JSONHelpers::TDeviceInfoMap deviceInfoMap; + deviceInfoMap.insert(std::make_pair(m_uniqueId.str(), data)); + JSONHelpers::SerializeDeviceInfoToTmpFile(deviceInfoMap, m_virtualDesktopGuid, activeZoneSetTempPath); - //temp file read on initialization - auto actual = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + const auto info = CanvasLayoutInfo{ + 100, 100, std::vector{ CanvasLayoutInfo::Rect{ 0, 0, 100, 100 } } + }; + const auto customZoneData = CustomZoneSetData{ L"name", CustomLayoutType::Canvas, info }; + const auto customZoneSet = JSONHelpers::CustomZoneSetJSON{ customSetGuid, customZoneData }; + auto customZoneJson = JSONHelpers::CustomZoneSetJSON::ToJson(customZoneSet); + JSONHelpers::TCustomZoneSetsMap customZoneSets; + customZoneSets.insert(std::make_pair(customSetGuid, customZoneData)); + JSONHelpers::SerializeCustomZoneSetsToTmpFile(customZoneSets, appliedZoneSetTempPath); - testZoneWindow(actual); + //save same zone as deleted + json::JsonObject deletedCustomZoneSets = {}; + json::JsonArray zonesArray{}; + zonesArray.Append(json::JsonValue::CreateStringValue(customZoneSet.uuid.substr(1, customZoneSet.uuid.size() - 2).c_str())); + deletedCustomZoneSets.SetNamedValue(L"deleted-custom-zone-sets", zonesArray); + json::to_file(deletedZonesTempPath, deletedCustomZoneSets); - //custom zone needs temp file for applied zone - Assert::IsNotNull(actual->ActiveZoneSet()); - const auto actualZoneSet = actual->ActiveZoneSet()->GetZones(); - Assert::AreEqual((size_t)1, actualZoneSet.size()); - } + m_fancyZonesData.ParseDeviceInfoFromTmpFile(activeZoneSetTempPath); + m_fancyZonesData.ParseDeletedCustomZoneSetsFromTmpFile(deletedZonesTempPath); + m_fancyZonesData.ParseCustomZoneSetsFromTmpFile(appliedZoneSetTempPath); - TEST_METHOD(CreateZoneWindowWithActiveCustomZoneAppliedTmpFileWithDeletedCustomZones) - { - using namespace FancyZonesDataTypes; + //temp file read on initialization + auto actual = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - //save required data - const auto activeZoneSetTempPath = m_fancyZonesData.activeZoneSetTmpFileName; - const auto appliedZoneSetTempPath = m_fancyZonesData.appliedZoneSetTmpFileName; - const auto deletedZonesTempPath = m_fancyZonesData.deletedCustomZoneSetsTmpFileName; + testZoneWindow(actual); - const ZoneSetLayoutType type = ZoneSetLayoutType::Custom; - const auto customSetGuid = Helpers::CreateGuidString(); - const auto expectedZoneSet = ZoneSetData{ customSetGuid, type }; - const auto data = DeviceInfoData{ expectedZoneSet, true, 16, 3 }; - JSONHelpers::TDeviceInfoMap deviceInfoMap; - deviceInfoMap.insert(std::make_pair(m_uniqueId.str(), data)); - JSONHelpers::SerializeDeviceInfoToTmpFile(deviceInfoMap, m_virtualDesktopGuid, activeZoneSetTempPath); + Assert::IsNotNull(actual->ActiveZoneSet()); + const auto actualZoneSet = actual->ActiveZoneSet()->GetZones(); + Assert::AreEqual((size_t)1, actualZoneSet.size()); + } - const auto info = CanvasLayoutInfo{ - 100, 100, std::vector{ CanvasLayoutInfo::Rect{ 0, 0, 100, 100 } } - }; - const auto customZoneData = CustomZoneSetData{ L"name", CustomLayoutType::Canvas, info }; - const auto customZoneSet = JSONHelpers::CustomZoneSetJSON{ customSetGuid, customZoneData }; - auto customZoneJson = JSONHelpers::CustomZoneSetJSON::ToJson(customZoneSet); - JSONHelpers::TCustomZoneSetsMap customZoneSets; - customZoneSets.insert(std::make_pair(customSetGuid, customZoneData)); - JSONHelpers::SerializeCustomZoneSetsToTmpFile(customZoneSets, appliedZoneSetTempPath); + TEST_METHOD (CreateZoneWindowWithActiveCustomZoneAppliedTmpFileWithUnusedDeletedCustomZones) + { + using namespace FancyZonesDataTypes; - //save same zone as deleted - json::JsonObject deletedCustomZoneSets = {}; - json::JsonArray zonesArray{}; - zonesArray.Append(json::JsonValue::CreateStringValue(customZoneSet.uuid.substr(1, customZoneSet.uuid.size() - 2).c_str())); - deletedCustomZoneSets.SetNamedValue(L"deleted-custom-zone-sets", zonesArray); - json::to_file(deletedZonesTempPath, deletedCustomZoneSets); + //save required data + const auto activeZoneSetTempPath = m_fancyZonesData.activeZoneSetTmpFileName; + const auto appliedZoneSetTempPath = m_fancyZonesData.appliedZoneSetTmpFileName; + const auto deletedZonesTempPath = m_fancyZonesData.deletedCustomZoneSetsTmpFileName; - m_fancyZonesData.ParseDeviceInfoFromTmpFile(activeZoneSetTempPath); - m_fancyZonesData.ParseDeletedCustomZoneSetsFromTmpFile(deletedZonesTempPath); - m_fancyZonesData.ParseCustomZoneSetsFromTmpFile(appliedZoneSetTempPath); + const ZoneSetLayoutType type = ZoneSetLayoutType::Custom; + const auto customSetGuid = Helpers::CreateGuidString(); + const auto expectedZoneSet = ZoneSetData{ customSetGuid, type }; + const auto data = DeviceInfoData{ expectedZoneSet, true, 16, 3 }; + JSONHelpers::TDeviceInfoMap deviceInfoMap; + deviceInfoMap.insert(std::make_pair(m_uniqueId.str(), data)); + JSONHelpers::SerializeDeviceInfoToTmpFile(deviceInfoMap, m_virtualDesktopGuid, activeZoneSetTempPath); - //temp file read on initialization - auto actual = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + const auto info = CanvasLayoutInfo{ + 100, 100, std::vector{ CanvasLayoutInfo::Rect{ 0, 0, 100, 100 } } + }; + const auto customZoneData = CustomZoneSetData{ L"name", CustomLayoutType::Canvas, info }; + const auto customZoneSet = JSONHelpers::CustomZoneSetJSON{ customSetGuid, customZoneData }; + auto customZoneJson = JSONHelpers::CustomZoneSetJSON::ToJson(customZoneSet); + JSONHelpers::TCustomZoneSetsMap customZoneSets; + customZoneSets.insert(std::make_pair(customSetGuid, customZoneData)); + JSONHelpers::SerializeCustomZoneSetsToTmpFile(customZoneSets, appliedZoneSetTempPath); - testZoneWindow(actual); + //save different zone as deleted + json::JsonObject deletedCustomZoneSets = {}; + json::JsonArray zonesArray{}; + const auto uuid = Helpers::CreateGuidString(); + zonesArray.Append(json::JsonValue::CreateStringValue(uuid.substr(1, uuid.size() - 2).c_str())); + deletedCustomZoneSets.SetNamedValue(L"deleted-custom-zone-sets", zonesArray); + json::to_file(deletedZonesTempPath, deletedCustomZoneSets); - Assert::IsNotNull(actual->ActiveZoneSet()); - const auto actualZoneSet = actual->ActiveZoneSet()->GetZones(); - Assert::AreEqual((size_t)1, actualZoneSet.size()); - } + m_fancyZonesData.ParseDeviceInfoFromTmpFile(activeZoneSetTempPath); + m_fancyZonesData.ParseDeletedCustomZoneSetsFromTmpFile(deletedZonesTempPath); + m_fancyZonesData.ParseCustomZoneSetsFromTmpFile(appliedZoneSetTempPath); - TEST_METHOD(CreateZoneWindowWithActiveCustomZoneAppliedTmpFileWithUnusedDeletedCustomZones) - { - using namespace FancyZonesDataTypes; + //temp file read on initialization + auto actual = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - //save required data - const auto activeZoneSetTempPath = m_fancyZonesData.activeZoneSetTmpFileName; - const auto appliedZoneSetTempPath = m_fancyZonesData.appliedZoneSetTmpFileName; - const auto deletedZonesTempPath = m_fancyZonesData.deletedCustomZoneSetsTmpFileName; + testZoneWindow(actual); - const ZoneSetLayoutType type = ZoneSetLayoutType::Custom; - const auto customSetGuid = Helpers::CreateGuidString(); - const auto expectedZoneSet = ZoneSetData{ customSetGuid, type }; - const auto data = DeviceInfoData{ expectedZoneSet, true, 16, 3 }; - JSONHelpers::TDeviceInfoMap deviceInfoMap; - deviceInfoMap.insert(std::make_pair(m_uniqueId.str(), data)); - JSONHelpers::SerializeDeviceInfoToTmpFile(deviceInfoMap, m_virtualDesktopGuid, activeZoneSetTempPath); + Assert::IsNotNull(actual->ActiveZoneSet()); + const auto actualZoneSet = actual->ActiveZoneSet()->GetZones(); + Assert::AreEqual((size_t)1, actualZoneSet.size()); + } - const auto info = CanvasLayoutInfo{ - 100, 100, std::vector{ CanvasLayoutInfo::Rect{ 0, 0, 100, 100 } } - }; - const auto customZoneData = CustomZoneSetData{ L"name", CustomLayoutType::Canvas, info }; - const auto customZoneSet = JSONHelpers::CustomZoneSetJSON{ customSetGuid, customZoneData }; - auto customZoneJson = JSONHelpers::CustomZoneSetJSON::ToJson(customZoneSet); - JSONHelpers::TCustomZoneSetsMap customZoneSets; - customZoneSets.insert(std::make_pair(customSetGuid, customZoneData)); - JSONHelpers::SerializeCustomZoneSetsToTmpFile(customZoneSets, appliedZoneSetTempPath); + TEST_METHOD (CreateZoneWindowClonedFromParent) + { + using namespace FancyZonesDataTypes; - //save different zone as deleted - json::JsonObject deletedCustomZoneSets = {}; - json::JsonArray zonesArray{}; - const auto uuid = Helpers::CreateGuidString(); - zonesArray.Append(json::JsonValue::CreateStringValue(uuid.substr(1, uuid.size() - 2).c_str())); - deletedCustomZoneSets.SetNamedValue(L"deleted-custom-zone-sets", zonesArray); - json::to_file(deletedZonesTempPath, deletedCustomZoneSets); + const ZoneSetLayoutType type = ZoneSetLayoutType::PriorityGrid; + const int spacing = 10; + const int zoneCount = 5; + const auto customSetGuid = Helpers::CreateGuidString(); + const auto parentZoneSet = ZoneSetData{ customSetGuid, type }; + const auto parentDeviceInfo = DeviceInfoData{ parentZoneSet, true, spacing, zoneCount }; + m_fancyZonesData.SetDeviceInfo(m_parentUniqueId.str(), parentDeviceInfo); - m_fancyZonesData.ParseDeviceInfoFromTmpFile(activeZoneSetTempPath); - m_fancyZonesData.ParseDeletedCustomZoneSetsFromTmpFile(deletedZonesTempPath); - m_fancyZonesData.ParseCustomZoneSetsFromTmpFile(appliedZoneSetTempPath); + winrt::com_ptr zoneWindowHost = winrt::make_self(); + auto parentZoneWindow = MakeZoneWindow(zoneWindowHost.get(), m_hInst, m_monitor, m_parentUniqueId.str(), {}); + zoneWindowHost->m_zoneWindow = parentZoneWindow.get(); - //temp file read on initialization - auto actual = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + // newWorkArea = true - zoneWindow will be cloned from parent + auto actualZoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), m_parentUniqueId.str()); - testZoneWindow(actual); + Assert::IsNotNull(actualZoneWindow->ActiveZoneSet()); + const auto actualZoneSet = actualZoneWindow->ActiveZoneSet()->GetZones(); + Assert::AreEqual((size_t)zoneCount, actualZoneSet.size()); - Assert::IsNotNull(actual->ActiveZoneSet()); - const auto actualZoneSet = actual->ActiveZoneSet()->GetZones(); - Assert::AreEqual((size_t)1, actualZoneSet.size()); - } + Assert::IsTrue(m_fancyZonesData.GetDeviceInfoMap().contains(m_uniqueId.str())); + auto currentDeviceInfo = m_fancyZonesData.GetDeviceInfoMap().at(m_uniqueId.str()); + Assert::AreEqual(zoneCount, currentDeviceInfo.zoneCount); + Assert::AreEqual(spacing, currentDeviceInfo.spacing); + Assert::AreEqual(static_cast(type), static_cast(currentDeviceInfo.activeZoneSet.type)); + } - TEST_METHOD (CreateZoneWindowClonedFromParent) - { - using namespace FancyZonesDataTypes; + TEST_METHOD (CreateZoneWindowNotClonedFromParent) + { + using namespace FancyZonesDataTypes; - const ZoneSetLayoutType type = ZoneSetLayoutType::PriorityGrid; - const int spacing = 10; - const int zoneCount = 5; - const auto customSetGuid = Helpers::CreateGuidString(); - const auto parentZoneSet = ZoneSetData{ customSetGuid, type }; - const auto parentDeviceInfo = DeviceInfoData{ parentZoneSet, true, spacing, zoneCount }; - m_fancyZonesData.SetDeviceInfo(m_parentUniqueId.str(), parentDeviceInfo); + const ZoneSetLayoutType type = ZoneSetLayoutType::PriorityGrid; + const int spacing = 10; + const int zoneCount = 5; + const auto customSetGuid = Helpers::CreateGuidString(); + const auto parentZoneSet = ZoneSetData{ customSetGuid, type }; + const auto parentDeviceInfo = DeviceInfoData{ parentZoneSet, true, spacing, zoneCount }; + m_fancyZonesData.SetDeviceInfo(m_parentUniqueId.str(), parentDeviceInfo); - winrt::com_ptr zoneWindowHost = winrt::make_self(); - auto parentZoneWindow = MakeZoneWindow(zoneWindowHost.get(), m_hInst, m_monitor, m_parentUniqueId.str(), {}); - zoneWindowHost->m_zoneWindow = parentZoneWindow.get(); + winrt::com_ptr zoneWindowHost = winrt::make_self(); + auto parentZoneWindow = MakeZoneWindow(zoneWindowHost.get(), m_hInst, m_monitor, m_parentUniqueId.str(), {}); + zoneWindowHost->m_zoneWindow = parentZoneWindow.get(); - // newWorkArea = true - zoneWindow will be cloned from parent - auto actualZoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), m_parentUniqueId.str()); + // newWorkArea = false - zoneWindow won't be cloned from parent + auto actualZoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - Assert::IsNotNull(actualZoneWindow->ActiveZoneSet()); - const auto actualZoneSet = actualZoneWindow->ActiveZoneSet()->GetZones(); - Assert::AreEqual((size_t)zoneCount, actualZoneSet.size()); + Assert::IsNotNull(actualZoneWindow->ActiveZoneSet()); - Assert::IsTrue(m_fancyZonesData.GetDeviceInfoMap().contains(m_uniqueId.str())); - auto currentDeviceInfo = m_fancyZonesData.GetDeviceInfoMap().at(m_uniqueId.str()); - Assert::AreEqual(zoneCount, currentDeviceInfo.zoneCount); - Assert::AreEqual(spacing, currentDeviceInfo.spacing); - Assert::AreEqual(static_cast(type), static_cast(currentDeviceInfo.activeZoneSet.type)); - } - - TEST_METHOD (CreateZoneWindowNotClonedFromParent) - { - using namespace FancyZonesDataTypes; - - const ZoneSetLayoutType type = ZoneSetLayoutType::PriorityGrid; - const int spacing = 10; - const int zoneCount = 5; - const auto customSetGuid = Helpers::CreateGuidString(); - const auto parentZoneSet = ZoneSetData{ customSetGuid, type }; - const auto parentDeviceInfo = DeviceInfoData{ parentZoneSet, true, spacing, zoneCount }; - m_fancyZonesData.SetDeviceInfo(m_parentUniqueId.str(), parentDeviceInfo); - - winrt::com_ptr zoneWindowHost = winrt::make_self(); - auto parentZoneWindow = MakeZoneWindow(zoneWindowHost.get(), m_hInst, m_monitor, m_parentUniqueId.str(), {}); - zoneWindowHost->m_zoneWindow = parentZoneWindow.get(); - - // newWorkArea = false - zoneWindow won't be cloned from parent - auto actualZoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - - Assert::IsNotNull(actualZoneWindow->ActiveZoneSet()); - - Assert::IsTrue(m_fancyZonesData.GetDeviceInfoMap().contains(m_uniqueId.str())); - auto currentDeviceInfo = m_fancyZonesData.GetDeviceInfoMap().at(m_uniqueId.str()); - // default values - Assert::AreEqual(true, currentDeviceInfo.showSpacing); - Assert::AreEqual(3, currentDeviceInfo.zoneCount); - Assert::AreEqual(16, currentDeviceInfo.spacing); - Assert::AreEqual(static_cast(ZoneSetLayoutType::PriorityGrid), static_cast(currentDeviceInfo.activeZoneSet.type)); - } + Assert::IsTrue(m_fancyZonesData.GetDeviceInfoMap().contains(m_uniqueId.str())); + auto currentDeviceInfo = m_fancyZonesData.GetDeviceInfoMap().at(m_uniqueId.str()); + // default values + Assert::AreEqual(true, currentDeviceInfo.showSpacing); + Assert::AreEqual(3, currentDeviceInfo.zoneCount); + Assert::AreEqual(16, currentDeviceInfo.spacing); + Assert::AreEqual(static_cast(ZoneSetLayoutType::PriorityGrid), static_cast(currentDeviceInfo.activeZoneSet.type)); + } }; - TEST_CLASS(ZoneWindowUnitTests) + TEST_CLASS (ZoneWindowUnitTests) { std::wstringstream m_uniqueId; @@ -432,293 +433,293 @@ namespace FancyZonesUnitTests FancyZonesData& m_fancyZonesData = FancyZonesDataInstance(); TEST_METHOD_INITIALIZE(Init) - { - m_hInst = (HINSTANCE)GetModuleHandleW(nullptr); + { + m_hInst = (HINSTANCE)GetModuleHandleW(nullptr); - m_monitor = MonitorFromPoint(POINT{ 0, 0 }, MONITOR_DEFAULTTOPRIMARY); - m_monitorInfo.cbSize = sizeof(m_monitorInfo); - Assert::AreNotEqual(0, GetMonitorInfoW(m_monitor, &m_monitorInfo)); + m_monitor = MonitorFromPoint(POINT{ 0, 0 }, MONITOR_DEFAULTTOPRIMARY); + m_monitorInfo.cbSize = sizeof(m_monitorInfo); + Assert::AreNotEqual(0, GetMonitorInfoW(m_monitor, &m_monitorInfo)); - m_uniqueId << L"DELA026#5&10a58c63&0&UID16777488_" << m_monitorInfo.rcMonitor.right << "_" << m_monitorInfo.rcMonitor.bottom << "_{39B25DD2-130D-4B5D-8851-4791D66B1539}"; + m_uniqueId << L"DELA026#5&10a58c63&0&UID16777488_" << m_monitorInfo.rcMonitor.right << "_" << m_monitorInfo.rcMonitor.bottom << "_{39B25DD2-130D-4B5D-8851-4791D66B1539}"; - m_fancyZonesData.SetSettingsModulePath(L"FancyZonesUnitTests"); - m_fancyZonesData.clear_data(); - } + m_fancyZonesData.SetSettingsModulePath(L"FancyZonesUnitTests"); + m_fancyZonesData.clear_data(); + } - public: - TEST_METHOD(MoveSizeEnter) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + public: + TEST_METHOD (MoveSizeEnter) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - const auto expected = S_OK; - const auto actual = zoneWindow->MoveSizeEnter(Mocks::Window()); + const auto expected = S_OK; + const auto actual = zoneWindow->MoveSizeEnter(Mocks::Window()); - Assert::AreEqual(expected, actual); - } + Assert::AreEqual(expected, actual); + } - TEST_METHOD(MoveSizeEnterTwice) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + TEST_METHOD (MoveSizeEnterTwice) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - const auto expected = S_OK; + const auto expected = S_OK; - zoneWindow->MoveSizeEnter(Mocks::Window()); - const auto actual = zoneWindow->MoveSizeEnter(Mocks::Window()); + zoneWindow->MoveSizeEnter(Mocks::Window()); + const auto actual = zoneWindow->MoveSizeEnter(Mocks::Window()); - Assert::AreEqual(expected, actual); - } + Assert::AreEqual(expected, actual); + } - TEST_METHOD(MoveSizeUpdate) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + TEST_METHOD (MoveSizeUpdate) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - const auto expected = S_OK; - const auto actual = zoneWindow->MoveSizeUpdate(POINT{ 0, 0 }, true, false); + const auto expected = S_OK; + const auto actual = zoneWindow->MoveSizeUpdate(POINT{ 0, 0 }, true, false); - Assert::AreEqual(expected, actual); - } + Assert::AreEqual(expected, actual); + } - TEST_METHOD(MoveSizeUpdatePointNegativeCoordinates) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + TEST_METHOD (MoveSizeUpdatePointNegativeCoordinates) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - const auto expected = S_OK; - const auto actual = zoneWindow->MoveSizeUpdate(POINT{ -10, -10 }, true, false); + const auto expected = S_OK; + const auto actual = zoneWindow->MoveSizeUpdate(POINT{ -10, -10 }, true, false); - Assert::AreEqual(expected, actual); - } + Assert::AreEqual(expected, actual); + } - TEST_METHOD(MoveSizeUpdatePointBigCoordinates) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + TEST_METHOD (MoveSizeUpdatePointBigCoordinates) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - const auto expected = S_OK; - const auto actual = zoneWindow->MoveSizeUpdate(POINT{ m_monitorInfo.rcMonitor.right + 1, m_monitorInfo.rcMonitor.bottom + 1 }, true, false); + const auto expected = S_OK; + const auto actual = zoneWindow->MoveSizeUpdate(POINT{ m_monitorInfo.rcMonitor.right + 1, m_monitorInfo.rcMonitor.bottom + 1 }, true, false); - Assert::AreEqual(expected, actual); - } + Assert::AreEqual(expected, actual); + } - TEST_METHOD(MoveSizeEnd) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + TEST_METHOD (MoveSizeEnd) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - const auto window = Mocks::Window(); - zoneWindow->MoveSizeEnter(window); + const auto window = Mocks::Window(); + zoneWindow->MoveSizeEnter(window); - const auto expected = S_OK; - const auto actual = zoneWindow->MoveSizeEnd(window, POINT{ 0, 0 }); - Assert::AreEqual(expected, actual); + const auto expected = S_OK; + const auto actual = zoneWindow->MoveSizeEnd(window, POINT{ 0, 0 }); + Assert::AreEqual(expected, actual); - const auto zoneSet = zoneWindow->ActiveZoneSet(); - zoneSet->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0); - const auto actualZoneIndexSet = zoneSet->GetZoneIndexSetFromWindow(window); - Assert::IsFalse(std::vector{} == actualZoneIndexSet); - } + const auto zoneSet = zoneWindow->ActiveZoneSet(); + zoneSet->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0); + const auto actualZoneIndexSet = zoneSet->GetZoneIndexSetFromWindow(window); + Assert::IsFalse(std::vector{} == actualZoneIndexSet); + } - TEST_METHOD(MoveSizeEndWindowNotAdded) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + TEST_METHOD (MoveSizeEndWindowNotAdded) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - const auto window = Mocks::Window(); - zoneWindow->MoveSizeEnter(window); + const auto window = Mocks::Window(); + zoneWindow->MoveSizeEnter(window); - const auto expected = S_OK; - const auto actual = zoneWindow->MoveSizeEnd(window, POINT{ -100, -100 }); - Assert::AreEqual(expected, actual); + const auto expected = S_OK; + const auto actual = zoneWindow->MoveSizeEnd(window, POINT{ -100, -100 }); + Assert::AreEqual(expected, actual); - const auto zoneSet = zoneWindow->ActiveZoneSet(); - const auto actualZoneIndexSet = zoneSet->GetZoneIndexSetFromWindow(window); - Assert::IsTrue(std::vector{} == actualZoneIndexSet); - } + const auto zoneSet = zoneWindow->ActiveZoneSet(); + const auto actualZoneIndexSet = zoneSet->GetZoneIndexSetFromWindow(window); + Assert::IsTrue(std::vector{} == actualZoneIndexSet); + } - TEST_METHOD(MoveSizeEndDifferentWindows) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + TEST_METHOD (MoveSizeEndDifferentWindows) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - const auto window = Mocks::Window(); - zoneWindow->MoveSizeEnter(window); + const auto window = Mocks::Window(); + zoneWindow->MoveSizeEnter(window); - const auto expected = E_INVALIDARG; - const auto actual = zoneWindow->MoveSizeEnd(Mocks::Window(), POINT{ 0, 0 }); + const auto expected = E_INVALIDARG; + const auto actual = zoneWindow->MoveSizeEnd(Mocks::Window(), POINT{ 0, 0 }); - Assert::AreEqual(expected, actual); - } + Assert::AreEqual(expected, actual); + } - TEST_METHOD(MoveSizeEndWindowNotSet) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + TEST_METHOD (MoveSizeEndWindowNotSet) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - const auto expected = E_INVALIDARG; - const auto actual = zoneWindow->MoveSizeEnd(Mocks::Window(), POINT{ 0, 0 }); + const auto expected = E_INVALIDARG; + const auto actual = zoneWindow->MoveSizeEnd(Mocks::Window(), POINT{ 0, 0 }); - Assert::AreEqual(expected, actual); - } + Assert::AreEqual(expected, actual); + } - TEST_METHOD(MoveSizeEndInvalidPoint) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + TEST_METHOD (MoveSizeEndInvalidPoint) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - const auto window = Mocks::Window(); - zoneWindow->MoveSizeEnter(window); + const auto window = Mocks::Window(); + zoneWindow->MoveSizeEnter(window); - const auto expected = S_OK; - const auto actual = zoneWindow->MoveSizeEnd(window, POINT{ -1, -1 }); - Assert::AreEqual(expected, actual); + const auto expected = S_OK; + const auto actual = zoneWindow->MoveSizeEnd(window, POINT{ -1, -1 }); + Assert::AreEqual(expected, actual); - const auto zoneSet = zoneWindow->ActiveZoneSet(); - zoneSet->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0); - const auto actualZoneIndex = zoneSet->GetZoneIndexSetFromWindow(window); - Assert::IsFalse(std::vector{} == actualZoneIndex); // with invalid point zone remains the same - } - - TEST_METHOD(MoveWindowIntoZoneByIndex) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - Assert::IsNotNull(zoneWindow->ActiveZoneSet()); - - zoneWindow->MoveWindowIntoZoneByIndex(Mocks::Window(), 0); - - const auto actual = zoneWindow->ActiveZoneSet(); - } - - TEST_METHOD(MoveWindowIntoZoneByDirectionAndIndex) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - Assert::IsNotNull(zoneWindow->ActiveZoneSet()); - - const auto window = Mocks::WindowCreate(m_hInst); - zoneWindow->MoveWindowIntoZoneByDirectionAndIndex(window, VK_RIGHT, true); - - const auto& actualAppZoneHistory = m_fancyZonesData.GetAppZoneHistoryMap(); - Assert::AreEqual((size_t)1, actualAppZoneHistory.size()); - const auto& appHistoryArray = actualAppZoneHistory.begin()->second; - Assert::AreEqual((size_t)1, appHistoryArray.size()); - Assert::IsTrue(std::vector{ 0 } == appHistoryArray[0].zoneIndexSet); - } - - TEST_METHOD(MoveWindowIntoZoneByDirectionManyTimes) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - Assert::IsNotNull(zoneWindow->ActiveZoneSet()); - - const auto window = Mocks::WindowCreate(m_hInst); - zoneWindow->MoveWindowIntoZoneByDirectionAndIndex(window, VK_RIGHT, true); - zoneWindow->MoveWindowIntoZoneByDirectionAndIndex(window, VK_RIGHT, true); - zoneWindow->MoveWindowIntoZoneByDirectionAndIndex(window, VK_RIGHT, true); - - const auto& actualAppZoneHistory = m_fancyZonesData.GetAppZoneHistoryMap(); - Assert::AreEqual((size_t)1, actualAppZoneHistory.size()); - const auto& appHistoryArray = actualAppZoneHistory.begin()->second; - Assert::AreEqual((size_t)1, appHistoryArray.size()); - Assert::IsTrue(std::vector{ 2 } == appHistoryArray[0].zoneIndexSet); - } - - TEST_METHOD(SaveWindowProcessToZoneIndexNullptrWindow) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - Assert::IsNotNull(zoneWindow->ActiveZoneSet()); - - zoneWindow->SaveWindowProcessToZoneIndex(nullptr); - - const auto actualAppZoneHistory = m_fancyZonesData.GetAppZoneHistoryMap(); - Assert::IsTrue(actualAppZoneHistory.empty()); - } - - TEST_METHOD(SaveWindowProcessToZoneIndexNoWindowAdded) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - Assert::IsNotNull(zoneWindow->ActiveZoneSet()); - - auto window = Mocks::WindowCreate(m_hInst); - auto zone = MakeZone(RECT{ 0, 0, 100, 100 }, 1); - zoneWindow->ActiveZoneSet()->AddZone(zone); - - zoneWindow->SaveWindowProcessToZoneIndex(window); - - const auto actualAppZoneHistory = m_fancyZonesData.GetAppZoneHistoryMap(); - Assert::IsTrue(actualAppZoneHistory.empty()); - } - - TEST_METHOD(SaveWindowProcessToZoneIndexNoWindowAddedWithFilledAppZoneHistory) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - Assert::IsNotNull(zoneWindow->ActiveZoneSet()); - - const auto window = Mocks::WindowCreate(m_hInst); - const auto processPath = get_process_path(window); - const auto deviceId = zoneWindow->UniqueId(); - const auto zoneSetId = zoneWindow->ActiveZoneSet()->Id(); - - // fill app zone history map - Assert::IsTrue(m_fancyZonesData.SetAppLastZones(window, deviceId, Helpers::GuidToString(zoneSetId), { 0 })); - Assert::AreEqual((size_t)1, m_fancyZonesData.GetAppZoneHistoryMap().size()); - const auto& appHistoryArray1 = m_fancyZonesData.GetAppZoneHistoryMap().at(processPath); - Assert::AreEqual((size_t)1, appHistoryArray1.size()); - Assert::IsTrue(std::vector{ 0 } == appHistoryArray1[0].zoneIndexSet); - - // add zone without window - const auto zone = MakeZone(RECT{ 0, 0, 100, 100 }, 1); - zoneWindow->ActiveZoneSet()->AddZone(zone); - - zoneWindow->SaveWindowProcessToZoneIndex(window); - Assert::AreEqual((size_t)1, m_fancyZonesData.GetAppZoneHistoryMap().size()); - const auto& appHistoryArray2 = m_fancyZonesData.GetAppZoneHistoryMap().at(processPath); - Assert::AreEqual((size_t)1, appHistoryArray2.size()); - Assert::IsTrue(std::vector{ 0 } == appHistoryArray2[0].zoneIndexSet); - } - - TEST_METHOD(SaveWindowProcessToZoneIndexWindowAdded) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - Assert::IsNotNull(zoneWindow->ActiveZoneSet()); - - auto window = Mocks::WindowCreate(m_hInst); - const auto processPath = get_process_path(window); - const auto deviceId = zoneWindow->UniqueId(); - const auto zoneSetId = zoneWindow->ActiveZoneSet()->Id(); - - auto zone = MakeZone(RECT{ 0, 0, 100, 100 }, 1); - zoneWindow->ActiveZoneSet()->AddZone(zone); - zoneWindow->MoveWindowIntoZoneByIndex(window, 0); - - //fill app zone history map - Assert::IsTrue(m_fancyZonesData.SetAppLastZones(window, deviceId, Helpers::GuidToString(zoneSetId), { 2 })); - Assert::AreEqual((size_t)1, m_fancyZonesData.GetAppZoneHistoryMap().size()); - const auto& appHistoryArray = m_fancyZonesData.GetAppZoneHistoryMap().at(processPath); - Assert::AreEqual((size_t)1, appHistoryArray.size()); - Assert::IsTrue(std::vector{ 2 } == appHistoryArray[0].zoneIndexSet); - - zoneWindow->SaveWindowProcessToZoneIndex(window); - - const auto& actualAppZoneHistory = m_fancyZonesData.GetAppZoneHistoryMap(); - Assert::AreEqual((size_t)1, actualAppZoneHistory.size()); - const auto& expected = zoneWindow->ActiveZoneSet()->GetZoneIndexSetFromWindow(window); - const auto& actual = appHistoryArray[0].zoneIndexSet; - Assert::IsTrue(expected == actual); - } - - TEST_METHOD(WhenWindowIsNotResizablePlacingItIntoTheZoneShouldNotResizeIt) - { - auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); - Assert::IsNotNull(zoneWindow->ActiveZoneSet()); - - auto window = Mocks::WindowCreate(m_hInst); - - int originalWidth = 450; - int originalHeight = 550; - - SetWindowPos(window, nullptr, 150, 150, originalWidth, originalHeight, SWP_SHOWWINDOW); - SetWindowLong(window, GWL_STYLE, GetWindowLong(window, GWL_STYLE) & ~WS_SIZEBOX); - - auto zone = MakeZone(RECT{ 50, 50, 300, 300 }, 1); - zoneWindow->ActiveZoneSet()->AddZone(zone); - - zoneWindow->MoveWindowIntoZoneByDirectionAndIndex(window, VK_LEFT, true); - - RECT inZoneRect; - GetWindowRect(window, &inZoneRect); - Assert::AreEqual(originalWidth, (int)inZoneRect.right - (int) inZoneRect.left); - Assert::AreEqual(originalHeight, (int)inZoneRect.bottom - (int)inZoneRect.top); - } + const auto zoneSet = zoneWindow->ActiveZoneSet(); + zoneSet->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0); + const auto actualZoneIndex = zoneSet->GetZoneIndexSetFromWindow(window); + Assert::IsFalse(std::vector{} == actualZoneIndex); // with invalid point zone remains the same + } + + TEST_METHOD (MoveWindowIntoZoneByIndex) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + Assert::IsNotNull(zoneWindow->ActiveZoneSet()); + + zoneWindow->MoveWindowIntoZoneByIndex(Mocks::Window(), 0); + + const auto actual = zoneWindow->ActiveZoneSet(); + } + + TEST_METHOD (MoveWindowIntoZoneByDirectionAndIndex) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + Assert::IsNotNull(zoneWindow->ActiveZoneSet()); + + const auto window = Mocks::WindowCreate(m_hInst); + zoneWindow->MoveWindowIntoZoneByDirectionAndIndex(window, VK_RIGHT, true); + + const auto& actualAppZoneHistory = m_fancyZonesData.GetAppZoneHistoryMap(); + Assert::AreEqual((size_t)1, actualAppZoneHistory.size()); + const auto& appHistoryArray = actualAppZoneHistory.begin()->second; + Assert::AreEqual((size_t)1, appHistoryArray.size()); + Assert::IsTrue(std::vector{ 0 } == appHistoryArray[0].zoneIndexSet); + } + + TEST_METHOD (MoveWindowIntoZoneByDirectionManyTimes) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + Assert::IsNotNull(zoneWindow->ActiveZoneSet()); + + const auto window = Mocks::WindowCreate(m_hInst); + zoneWindow->MoveWindowIntoZoneByDirectionAndIndex(window, VK_RIGHT, true); + zoneWindow->MoveWindowIntoZoneByDirectionAndIndex(window, VK_RIGHT, true); + zoneWindow->MoveWindowIntoZoneByDirectionAndIndex(window, VK_RIGHT, true); + + const auto& actualAppZoneHistory = m_fancyZonesData.GetAppZoneHistoryMap(); + Assert::AreEqual((size_t)1, actualAppZoneHistory.size()); + const auto& appHistoryArray = actualAppZoneHistory.begin()->second; + Assert::AreEqual((size_t)1, appHistoryArray.size()); + Assert::IsTrue(std::vector{ 2 } == appHistoryArray[0].zoneIndexSet); + } + + TEST_METHOD (SaveWindowProcessToZoneIndexNullptrWindow) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + Assert::IsNotNull(zoneWindow->ActiveZoneSet()); + + zoneWindow->SaveWindowProcessToZoneIndex(nullptr); + + const auto actualAppZoneHistory = m_fancyZonesData.GetAppZoneHistoryMap(); + Assert::IsTrue(actualAppZoneHistory.empty()); + } + + TEST_METHOD (SaveWindowProcessToZoneIndexNoWindowAdded) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + Assert::IsNotNull(zoneWindow->ActiveZoneSet()); + + auto window = Mocks::WindowCreate(m_hInst); + auto zone = MakeZone(RECT{ 0, 0, 100, 100 }, 1); + zoneWindow->ActiveZoneSet()->AddZone(zone); + + zoneWindow->SaveWindowProcessToZoneIndex(window); + + const auto actualAppZoneHistory = m_fancyZonesData.GetAppZoneHistoryMap(); + Assert::IsTrue(actualAppZoneHistory.empty()); + } + + TEST_METHOD (SaveWindowProcessToZoneIndexNoWindowAddedWithFilledAppZoneHistory) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + Assert::IsNotNull(zoneWindow->ActiveZoneSet()); + + const auto window = Mocks::WindowCreate(m_hInst); + const auto processPath = get_process_path(window); + const auto deviceId = zoneWindow->UniqueId(); + const auto zoneSetId = zoneWindow->ActiveZoneSet()->Id(); + + // fill app zone history map + Assert::IsTrue(m_fancyZonesData.SetAppLastZones(window, deviceId, Helpers::GuidToString(zoneSetId), { 0 })); + Assert::AreEqual((size_t)1, m_fancyZonesData.GetAppZoneHistoryMap().size()); + const auto& appHistoryArray1 = m_fancyZonesData.GetAppZoneHistoryMap().at(processPath); + Assert::AreEqual((size_t)1, appHistoryArray1.size()); + Assert::IsTrue(std::vector{ 0 } == appHistoryArray1[0].zoneIndexSet); + + // add zone without window + const auto zone = MakeZone(RECT{ 0, 0, 100, 100 }, 1); + zoneWindow->ActiveZoneSet()->AddZone(zone); + + zoneWindow->SaveWindowProcessToZoneIndex(window); + Assert::AreEqual((size_t)1, m_fancyZonesData.GetAppZoneHistoryMap().size()); + const auto& appHistoryArray2 = m_fancyZonesData.GetAppZoneHistoryMap().at(processPath); + Assert::AreEqual((size_t)1, appHistoryArray2.size()); + Assert::IsTrue(std::vector{ 0 } == appHistoryArray2[0].zoneIndexSet); + } + + TEST_METHOD (SaveWindowProcessToZoneIndexWindowAdded) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + Assert::IsNotNull(zoneWindow->ActiveZoneSet()); + + auto window = Mocks::WindowCreate(m_hInst); + const auto processPath = get_process_path(window); + const auto deviceId = zoneWindow->UniqueId(); + const auto zoneSetId = zoneWindow->ActiveZoneSet()->Id(); + + auto zone = MakeZone(RECT{ 0, 0, 100, 100 }, 1); + zoneWindow->ActiveZoneSet()->AddZone(zone); + zoneWindow->MoveWindowIntoZoneByIndex(window, 0); + + //fill app zone history map + Assert::IsTrue(m_fancyZonesData.SetAppLastZones(window, deviceId, Helpers::GuidToString(zoneSetId), { 2 })); + Assert::AreEqual((size_t)1, m_fancyZonesData.GetAppZoneHistoryMap().size()); + const auto& appHistoryArray = m_fancyZonesData.GetAppZoneHistoryMap().at(processPath); + Assert::AreEqual((size_t)1, appHistoryArray.size()); + Assert::IsTrue(std::vector{ 2 } == appHistoryArray[0].zoneIndexSet); + + zoneWindow->SaveWindowProcessToZoneIndex(window); + + const auto& actualAppZoneHistory = m_fancyZonesData.GetAppZoneHistoryMap(); + Assert::AreEqual((size_t)1, actualAppZoneHistory.size()); + const auto& expected = zoneWindow->ActiveZoneSet()->GetZoneIndexSetFromWindow(window); + const auto& actual = appHistoryArray[0].zoneIndexSet; + Assert::IsTrue(expected == actual); + } + + TEST_METHOD (WhenWindowIsNotResizablePlacingItIntoTheZoneShouldNotResizeIt) + { + auto zoneWindow = MakeZoneWindow(winrt::make_self().get(), m_hInst, m_monitor, m_uniqueId.str(), {}); + Assert::IsNotNull(zoneWindow->ActiveZoneSet()); + + auto window = Mocks::WindowCreate(m_hInst); + + int originalWidth = 450; + int originalHeight = 550; + + SetWindowPos(window, nullptr, 150, 150, originalWidth, originalHeight, SWP_SHOWWINDOW); + SetWindowLong(window, GWL_STYLE, GetWindowLong(window, GWL_STYLE) & ~WS_SIZEBOX); + + auto zone = MakeZone(RECT{ 50, 50, 300, 300 }, 1); + zoneWindow->ActiveZoneSet()->AddZone(zone); + + zoneWindow->MoveWindowIntoZoneByDirectionAndIndex(window, VK_LEFT, true); + + RECT inZoneRect; + GetWindowRect(window, &inZoneRect); + Assert::AreEqual(originalWidth, (int)inZoneRect.right - (int)inZoneRect.left); + Assert::AreEqual(originalHeight, (int)inZoneRect.bottom - (int)inZoneRect.top); + } }; } diff --git a/src/modules/imageresizer/dll/ContextMenuHandler.cpp b/src/modules/imageresizer/dll/ContextMenuHandler.cpp index a1d4632a49..6674cffa57 100644 --- a/src/modules/imageresizer/dll/ContextMenuHandler.cpp +++ b/src/modules/imageresizer/dll/ContextMenuHandler.cpp @@ -4,7 +4,10 @@ #include "ContextMenuHandler.h" #include "HDropIterator.h" #include "Settings.h" -#include +#include +#include +#include + #include "trace.h" extern HINSTANCE g_hInst_imageResizer; diff --git a/src/modules/imageresizer/dll/ImageResizerExt.base.rc b/src/modules/imageresizer/dll/ImageResizerExt.base.rc index a71939136c..09109a980a 100644 --- a/src/modules/imageresizer/dll/ImageResizerExt.base.rc +++ b/src/modules/imageresizer/dll/ImageResizerExt.base.rc @@ -1,7 +1,7 @@ // Microsoft Visual C++ generated resource script. // #include "resource.h" -#include "../../../../common/version.h" +#include "../../../../common/version/version.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// diff --git a/src/modules/imageresizer/dll/ImageResizerExt.vcxproj b/src/modules/imageresizer/dll/ImageResizerExt.vcxproj index 03100c3420..5be7a3cc3d 100644 --- a/src/modules/imageresizer/dll/ImageResizerExt.vcxproj +++ b/src/modules/imageresizer/dll/ImageResizerExt.vcxproj @@ -73,7 +73,7 @@ 0x0409 $(IntDir);%(AdditionalIncludeDirectories) NDEBUG;%(PreprocessorDefinitions) - + @@ -122,8 +122,11 @@ - - {74485049-c722-400f-abe5-86ac52d929b3} + + {6955446d-23f7-4023-9bb3-8657f904af99} + + + {98537082-0fdb-40de-abd8-0dc5a4269bab} diff --git a/src/modules/imageresizer/dll/ImageResizerExt.vcxproj.filters b/src/modules/imageresizer/dll/ImageResizerExt.vcxproj.filters index 966269dbd9..bbd3a2437c 100644 --- a/src/modules/imageresizer/dll/ImageResizerExt.vcxproj.filters +++ b/src/modules/imageresizer/dll/ImageResizerExt.vcxproj.filters @@ -72,6 +72,9 @@ Generated Files + + Header Files + diff --git a/src/modules/imageresizer/dll/Settings.cpp b/src/modules/imageresizer/dll/Settings.cpp index 634e3965ce..6d57db94f1 100644 --- a/src/modules/imageresizer/dll/Settings.cpp +++ b/src/modules/imageresizer/dll/Settings.cpp @@ -1,8 +1,8 @@ #include "pch.h" #include "Settings.h" -#include -#include +#include +#include #include #include #include diff --git a/src/modules/imageresizer/dll/dllmain.cpp b/src/modules/imageresizer/dll/dllmain.cpp index f7ea349167..f369445c52 100644 --- a/src/modules/imageresizer/dll/dllmain.cpp +++ b/src/modules/imageresizer/dll/dllmain.cpp @@ -3,11 +3,11 @@ #include "ImageResizerExt_i.h" #include "dllmain.h" #include -#include +#include +#include #include "Settings.h" #include "trace.h" -#include -#include +#include CImageResizerExtModule _AtlModule; HINSTANCE g_hInst_imageResizer = 0; diff --git a/src/modules/imageresizer/ui/ImageResizerUI.csproj b/src/modules/imageresizer/ui/ImageResizerUI.csproj index 2d95951209..a6f631cfcc 100644 --- a/src/modules/imageresizer/ui/ImageResizerUI.csproj +++ b/src/modules/imageresizer/ui/ImageResizerUI.csproj @@ -76,7 +76,7 @@ - + diff --git a/src/modules/keyboardmanager/common/Helpers.cpp b/src/modules/keyboardmanager/common/Helpers.cpp index 97b91cfece..ce9bfd49fd 100644 --- a/src/modules/keyboardmanager/common/Helpers.cpp +++ b/src/modules/keyboardmanager/common/Helpers.cpp @@ -1,13 +1,16 @@ #include "pch.h" #include "Helpers.h" #include -#include "../common/shared_constants.h" + +#include +#include +#include +#include + #include -#include "../../common/common.h" #include "keyboardmanager/dll/Generated Files/resource.h" -#include "../common/keyboard_layout.h" +#include #include "KeyboardManagerConstants.h" -extern "C" IMAGE_DOS_HEADER __ImageBase; using namespace winrt::Windows::Foundation; @@ -196,7 +199,7 @@ namespace KeyboardManagerHelper } keyEventArray[index].ki.dwExtraInfo = extraInfo; - // Set wScan to the value from MapVirtualKey as some applications may use the scan code for handling input, for instance, Windows Terminal ignores non-character input which has scancode set to 0. + // Set wScan to the value from MapVirtualKey as some applications may use the scan code for handling input, for instance, Windows Terminal ignores non-character input which has scancode set to 0. // MapVirtualKey returns 0 if the key code does not correspond to a physical key (such as unassigned/reserved keys). More details at https://github.com/microsoft/PowerToys/pull/7143#issue-498877747 keyEventArray[index].ki.wScan = (WORD)MapVirtualKey(keyCode, MAPVK_VK_TO_VSC); } diff --git a/src/modules/keyboardmanager/common/KeyDelay.h b/src/modules/keyboardmanager/common/KeyDelay.h index 5c59a180dc..7ac3606122 100644 --- a/src/modules/keyboardmanager/common/KeyDelay.h +++ b/src/modules/keyboardmanager/common/KeyDelay.h @@ -4,7 +4,7 @@ #include #include -#include +#include // Available states for the KeyDelay state machine. enum class KeyDelayState { diff --git a/src/modules/keyboardmanager/common/KeyboardManagerCommon.vcxproj b/src/modules/keyboardmanager/common/KeyboardManagerCommon.vcxproj index 49b6a5c36b..4e5f68b554 100644 --- a/src/modules/keyboardmanager/common/KeyboardManagerCommon.vcxproj +++ b/src/modules/keyboardmanager/common/KeyboardManagerCommon.vcxproj @@ -31,20 +31,20 @@ _CONSOLE;%(PreprocessorDefinitions) - ..\;..\..\..\common;..\..\..\common\telemetry;..\..\;%(AdditionalIncludeDirectories) + ..\;..\..\..\;..\..\..\common\telemetry;..\..\;%(AdditionalIncludeDirectories) true 4002 %(AdditionalOptions) /Zm200 shlwapi.lib;%(AdditionalDependencies) - + Console - + @@ -68,8 +68,11 @@ - - {74485049-c722-400f-abe5-86ac52d929b3} + + {7319089e-46d6-4400-bc65-e39bdf1416ee} + + + {caba8dfb-823b-4bf2-93ac-3f31984150d9} diff --git a/src/modules/keyboardmanager/common/KeyboardManagerCommon.vcxproj.filters b/src/modules/keyboardmanager/common/KeyboardManagerCommon.vcxproj.filters index 30542a6afb..d1b09a87a6 100644 --- a/src/modules/keyboardmanager/common/KeyboardManagerCommon.vcxproj.filters +++ b/src/modules/keyboardmanager/common/KeyboardManagerCommon.vcxproj.filters @@ -36,6 +36,9 @@ Source Files + + Source Files + diff --git a/src/modules/keyboardmanager/common/KeyboardManagerConstants.h b/src/modules/keyboardmanager/common/KeyboardManagerConstants.h index 8d475230bb..9cdd70f8ea 100644 --- a/src/modules/keyboardmanager/common/KeyboardManagerConstants.h +++ b/src/modules/keyboardmanager/common/KeyboardManagerConstants.h @@ -1,9 +1,8 @@ #pragma once #include #include -#include "../../common/common.h" +#include #include "keyboardmanager/dll/Generated Files/resource.h" -extern "C" IMAGE_DOS_HEADER __ImageBase; namespace KeyboardManagerConstants { diff --git a/src/modules/keyboardmanager/common/KeyboardManagerState.cpp b/src/modules/keyboardmanager/common/KeyboardManagerState.cpp index c2061b5ac8..919c53fa51 100644 --- a/src/modules/keyboardmanager/common/KeyboardManagerState.cpp +++ b/src/modules/keyboardmanager/common/KeyboardManagerState.cpp @@ -2,7 +2,7 @@ #include "KeyboardManagerState.h" #include "Shortcut.h" #include "RemapShortcut.h" -#include <../common/settings_helpers.h> +#include #include "KeyDelay.h" #include "Helpers.h" diff --git a/src/modules/keyboardmanager/common/KeyboardManagerState.h b/src/modules/keyboardmanager/common/KeyboardManagerState.h index 70969de2d5..a22c15d6a5 100644 --- a/src/modules/keyboardmanager/common/KeyboardManagerState.h +++ b/src/modules/keyboardmanager/common/KeyboardManagerState.h @@ -1,8 +1,8 @@ #pragma once #include #include "KeyboardManagerConstants.h" -#include "../common/keyboard_layout.h" -#include "../common/LowlevelKeyboardEvent.h" +#include +#include "../common/hooks/LowlevelKeyboardEvent.h" #include #include #include "Shortcut.h" diff --git a/src/modules/keyboardmanager/common/Shortcut.cpp b/src/modules/keyboardmanager/common/Shortcut.cpp index 26542dc4e1..f87e2377e2 100644 --- a/src/modules/keyboardmanager/common/Shortcut.cpp +++ b/src/modules/keyboardmanager/common/Shortcut.cpp @@ -1,7 +1,7 @@ #include "pch.h" #include "Shortcut.h" -#include "../common/keyboard_layout.h" -#include "../common/shared_constants.h" +#include +#include #include "Helpers.h" #include "InputInterface.h" diff --git a/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp b/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp index 45d446c5a6..2fd9d4e137 100644 --- a/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp +++ b/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp @@ -2,7 +2,7 @@ #include "KeyboardEventHandlers.h" #include "keyboardmanager/common/Shortcut.h" #include "keyboardmanager/common/RemapShortcut.h" -#include "../common/shared_constants.h" +#include #include #include #include diff --git a/src/modules/keyboardmanager/dll/KeyboardEventHandlers.h b/src/modules/keyboardmanager/dll/KeyboardEventHandlers.h index 8780899651..a00c4f1d7b 100644 --- a/src/modules/keyboardmanager/dll/KeyboardEventHandlers.h +++ b/src/modules/keyboardmanager/dll/KeyboardEventHandlers.h @@ -3,7 +3,7 @@ #include #include "keyboardmanager/common/KeyboardManagerConstants.h" -#include +#include class InputInterface; class KeyboardManagerState; diff --git a/src/modules/keyboardmanager/dll/KeyboardManager.base.rc b/src/modules/keyboardmanager/dll/KeyboardManager.base.rc index 49cd57cb98..488a93ed9e 100644 --- a/src/modules/keyboardmanager/dll/KeyboardManager.base.rc +++ b/src/modules/keyboardmanager/dll/KeyboardManager.base.rc @@ -1,6 +1,6 @@ #include #include "resource.h" -#include "../../../../common/version.h" +#include "../../../../common/version/version.h" #define APSTUDIO_READONLY_SYMBOLS #include "winres.h" diff --git a/src/modules/keyboardmanager/dll/KeyboardManager.vcxproj b/src/modules/keyboardmanager/dll/KeyboardManager.vcxproj index 169b5bdb6d..fcb38725fc 100644 --- a/src/modules/keyboardmanager/dll/KeyboardManager.vcxproj +++ b/src/modules/keyboardmanager/dll/KeyboardManager.vcxproj @@ -58,8 +58,8 @@ - - {74485049-c722-400f-abe5-86ac52d929b3} + + {6955446d-23f7-4023-9bb3-8657f904af99} {8affa899-0b73-49ec-8c50-0fadda57b2fc} diff --git a/src/modules/keyboardmanager/dll/dllmain.cpp b/src/modules/keyboardmanager/dll/dllmain.cpp index b7937ecddf..6aa1287f41 100644 --- a/src/modules/keyboardmanager/dll/dllmain.cpp +++ b/src/modules/keyboardmanager/dll/dllmain.cpp @@ -1,7 +1,7 @@ #include "pch.h" #include -#include -#include +#include +#include #include "Generated Files/resource.h" #include #include @@ -9,15 +9,14 @@ #include #include #include -#include #include +#include +#include #include #include #include "KeyboardEventHandlers.h" #include "Input.h" -extern "C" IMAGE_DOS_HEADER __ImageBase; - BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) diff --git a/src/modules/keyboardmanager/test/AppSpecificShortcutRemappingTests.cpp b/src/modules/keyboardmanager/test/AppSpecificShortcutRemappingTests.cpp index cde59ed4cd..486c7377d9 100644 --- a/src/modules/keyboardmanager/test/AppSpecificShortcutRemappingTests.cpp +++ b/src/modules/keyboardmanager/test/AppSpecificShortcutRemappingTests.cpp @@ -4,14 +4,14 @@ #include #include #include "TestHelpers.h" -#include +#include using namespace Microsoft::VisualStudio::CppUnitTestFramework; namespace RemappingLogicTests { TEST_CLASS (AppSpecificShortcutRemappingTests) - + { private: MockedInput mockedInputHandler; diff --git a/src/modules/keyboardmanager/test/BufferValidationTests.cpp b/src/modules/keyboardmanager/test/BufferValidationTests.cpp index 05e841c1d5..d6c2a30a11 100644 --- a/src/modules/keyboardmanager/test/BufferValidationTests.cpp +++ b/src/modules/keyboardmanager/test/BufferValidationTests.cpp @@ -2,8 +2,8 @@ #include "CppUnitTest.h" #include #include "TestHelpers.h" -#include -#include +#include +#include #include using namespace Microsoft::VisualStudio::CppUnitTestFramework; diff --git a/src/modules/keyboardmanager/test/KeyboardManagerHelperTests.cpp b/src/modules/keyboardmanager/test/KeyboardManagerHelperTests.cpp index 468962731d..271db07e46 100644 --- a/src/modules/keyboardmanager/test/KeyboardManagerHelperTests.cpp +++ b/src/modules/keyboardmanager/test/KeyboardManagerHelperTests.cpp @@ -2,7 +2,7 @@ #include "CppUnitTest.h" #include #include "TestHelpers.h" -#include +#include using namespace Microsoft::VisualStudio::CppUnitTestFramework; diff --git a/src/modules/keyboardmanager/test/KeyboardManagerTest.rc b/src/modules/keyboardmanager/test/KeyboardManagerTest.rc index a08ecc180a..3bee3499c3 100644 --- a/src/modules/keyboardmanager/test/KeyboardManagerTest.rc +++ b/src/modules/keyboardmanager/test/KeyboardManagerTest.rc @@ -1,6 +1,6 @@ #include #include "resource.h" -#include "../../../common/version.h" +#include "../../../common/version/version.h" 1 VERSIONINFO FILEVERSION FILE_VERSION diff --git a/src/modules/keyboardmanager/test/KeyboardManagerTest.vcxproj b/src/modules/keyboardmanager/test/KeyboardManagerTest.vcxproj index a783c59006..dd94d82d06 100644 --- a/src/modules/keyboardmanager/test/KeyboardManagerTest.vcxproj +++ b/src/modules/keyboardmanager/test/KeyboardManagerTest.vcxproj @@ -64,6 +64,9 @@ + + {6955446d-23f7-4023-9bb3-8657f904af99} + {8affa899-0b73-49ec-8c50-0fadda57b2fc} diff --git a/src/modules/keyboardmanager/test/LoadingAndSavingRemappingTests.cpp b/src/modules/keyboardmanager/test/LoadingAndSavingRemappingTests.cpp index c30bf03838..bead8f33aa 100644 --- a/src/modules/keyboardmanager/test/LoadingAndSavingRemappingTests.cpp +++ b/src/modules/keyboardmanager/test/LoadingAndSavingRemappingTests.cpp @@ -3,7 +3,7 @@ #include #include #include "TestHelpers.h" -#include "../common/shared_constants.h" +#include using namespace Microsoft::VisualStudio::CppUnitTestFramework; diff --git a/src/modules/keyboardmanager/test/MockedInput.h b/src/modules/keyboardmanager/test/MockedInput.h index 054a9b5687..f9d61d0ae6 100644 --- a/src/modules/keyboardmanager/test/MockedInput.h +++ b/src/modules/keyboardmanager/test/MockedInput.h @@ -3,7 +3,7 @@ #include #include -#include +#include // Class for mocked keyboard input class MockedInput : diff --git a/src/modules/keyboardmanager/test/OSLevelShortcutRemappingTests.cpp b/src/modules/keyboardmanager/test/OSLevelShortcutRemappingTests.cpp index 5705bbfa5c..8c00d1e350 100644 --- a/src/modules/keyboardmanager/test/OSLevelShortcutRemappingTests.cpp +++ b/src/modules/keyboardmanager/test/OSLevelShortcutRemappingTests.cpp @@ -4,7 +4,7 @@ #include #include #include "TestHelpers.h" -#include "../common/shared_constants.h" +#include using namespace Microsoft::VisualStudio::CppUnitTestFramework; diff --git a/src/modules/keyboardmanager/test/ShortcutTests.cpp b/src/modules/keyboardmanager/test/ShortcutTests.cpp index 591d3aa444..5908650f74 100644 --- a/src/modules/keyboardmanager/test/ShortcutTests.cpp +++ b/src/modules/keyboardmanager/test/ShortcutTests.cpp @@ -3,7 +3,7 @@ #include #include #include "TestHelpers.h" -#include "../common/keyboard_layout.h" +#include using namespace Microsoft::VisualStudio::CppUnitTestFramework; diff --git a/src/modules/keyboardmanager/test/SingleKeyRemappingTests.cpp b/src/modules/keyboardmanager/test/SingleKeyRemappingTests.cpp index 1c713afeb8..4c14d35cb1 100644 --- a/src/modules/keyboardmanager/test/SingleKeyRemappingTests.cpp +++ b/src/modules/keyboardmanager/test/SingleKeyRemappingTests.cpp @@ -4,7 +4,7 @@ #include #include #include "TestHelpers.h" -#include "../common/shared_constants.h" +#include using namespace Microsoft::VisualStudio::CppUnitTestFramework; diff --git a/src/modules/keyboardmanager/test/pch.cpp b/src/modules/keyboardmanager/test/pch.cpp index 64b7eef6d6..1d9f38c57d 100644 --- a/src/modules/keyboardmanager/test/pch.cpp +++ b/src/modules/keyboardmanager/test/pch.cpp @@ -1,5 +1 @@ -// pch.cpp: source file corresponding to the pre-compiled header - #include "pch.h" - -// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. diff --git a/src/modules/keyboardmanager/test/pch.h b/src/modules/keyboardmanager/test/pch.h index 56f36a4f2b..63e4abf8b5 100644 --- a/src/modules/keyboardmanager/test/pch.h +++ b/src/modules/keyboardmanager/test/pch.h @@ -1,7 +1,7 @@ #pragma once #pragma comment(lib, "shlwapi.lib") #define WIN32_LEAN_AND_MEAN -#include +#include #include #include #include diff --git a/src/modules/keyboardmanager/ui/BufferValidationHelpers.cpp b/src/modules/keyboardmanager/ui/BufferValidationHelpers.cpp index 7f63d5a9dc..0ee4eff695 100644 --- a/src/modules/keyboardmanager/ui/BufferValidationHelpers.cpp +++ b/src/modules/keyboardmanager/ui/BufferValidationHelpers.cpp @@ -1,7 +1,7 @@ #include "pch.h" #include "BufferValidationHelpers.h" #include -#include +#include #include namespace BufferValidationHelpers diff --git a/src/modules/keyboardmanager/ui/Dialog.cpp b/src/modules/keyboardmanager/ui/Dialog.cpp index a2a464f51f..86d23bfa68 100644 --- a/src/modules/keyboardmanager/ui/Dialog.cpp +++ b/src/modules/keyboardmanager/ui/Dialog.cpp @@ -1,9 +1,8 @@ #include "pch.h" #include "Dialog.h" #include -#include #include "keyboardmanager/dll/Generated Files/resource.h" -extern "C" IMAGE_DOS_HEADER __ImageBase; +#include using namespace winrt::Windows::Foundation; diff --git a/src/modules/keyboardmanager/ui/EditKeyboardWindow.cpp b/src/modules/keyboardmanager/ui/EditKeyboardWindow.cpp index 11287b6923..b1affa89be 100644 --- a/src/modules/keyboardmanager/ui/EditKeyboardWindow.cpp +++ b/src/modules/keyboardmanager/ui/EditKeyboardWindow.cpp @@ -6,17 +6,15 @@ #include #include #include -#include -#include -#include +#include +#include #include "Styles.h" #include "Dialog.h" #include -#include "../common/shared_constants.h" +#include #include "keyboardmanager/common/KeyboardManagerState.h" #include "LoadingAndSavingRemappingHelper.h" #include "UIHelpers.h" -extern "C" IMAGE_DOS_HEADER __ImageBase; using namespace winrt::Windows::Foundation; diff --git a/src/modules/keyboardmanager/ui/EditShortcutsWindow.cpp b/src/modules/keyboardmanager/ui/EditShortcutsWindow.cpp index af1b10926e..ece2a1005f 100644 --- a/src/modules/keyboardmanager/ui/EditShortcutsWindow.cpp +++ b/src/modules/keyboardmanager/ui/EditShortcutsWindow.cpp @@ -5,16 +5,14 @@ #include "XamlBridge.h" #include #include -#include -#include -#include +#include +#include #include "Styles.h" #include "Dialog.h" #include #include #include "LoadingAndSavingRemappingHelper.h" #include "UIHelpers.h" -extern "C" IMAGE_DOS_HEADER __ImageBase; using namespace winrt::Windows::Foundation; diff --git a/src/modules/keyboardmanager/ui/KeyDropDownControl.cpp b/src/modules/keyboardmanager/ui/KeyDropDownControl.cpp index 1bb9b582f5..431bd72211 100644 --- a/src/modules/keyboardmanager/ui/KeyDropDownControl.cpp +++ b/src/modules/keyboardmanager/ui/KeyDropDownControl.cpp @@ -3,9 +3,9 @@ #include "keyboardmanager/common/Helpers.h" #include #include "BufferValidationHelpers.h" -#include -#include -#include +#include +#include +#include // Initialized to null KeyboardManagerState* KeyDropDownControl::keyboardManagerState = nullptr; @@ -143,7 +143,7 @@ std::pair KeyDropDownControl::ValidateSho uint32_t dropDownIndex = -1; bool dropDownFound = parent.Children().IndexOf(currentDropDown, dropDownIndex); std::pair validationResult = std::make_pair(KeyboardManagerHelper::ErrorType::NoError, BufferValidationHelpers::DropDownAction::NoAction); - + uint32_t rowIndex; bool controlIindexFound = table.Children().IndexOf(row, rowIndex); if (controlIindexFound) @@ -368,7 +368,7 @@ void KeyDropDownControl::SetDropDownError(ComboBox currentDropDown, hstring mess } // Function to add a shortcut to the UI control as combo boxes -void KeyDropDownControl::AddShortcutToControl(Shortcut shortcut, StackPanel table, StackPanel parent, KeyboardManagerState& keyboardManagerState, const int colIndex, std::vector>& keyDropDownControlObjects, RemapBuffer& remapBuffer, StackPanel row, TextBox targetApp, bool isHybridControl, bool isSingleKeyWindow) +void KeyDropDownControl::AddShortcutToControl(Shortcut shortcut, StackPanel table, StackPanel parent, KeyboardManagerState& keyboardManagerState, const int colIndex, std::vector>& keyDropDownControlObjects, RemapBuffer& remapBuffer, StackPanel row, TextBox targetApp, bool isHybridControl, bool isSingleKeyWindow) { // Delete the existing drop down menus parent.Children().Clear(); diff --git a/src/modules/keyboardmanager/ui/KeyboardManagerUI.vcxproj b/src/modules/keyboardmanager/ui/KeyboardManagerUI.vcxproj index a7a8a9a251..07adc69169 100644 --- a/src/modules/keyboardmanager/ui/KeyboardManagerUI.vcxproj +++ b/src/modules/keyboardmanager/ui/KeyboardManagerUI.vcxproj @@ -75,8 +75,8 @@ - - {8affa899-0b73-49ec-8c50-0fadda57b2fc} + + {98537082-0fdb-40de-abd8-0dc5a4269bab} diff --git a/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp b/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp index 690f946726..f6d4ca508b 100644 --- a/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp +++ b/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp @@ -1,7 +1,7 @@ #include "pch.h" #include "LoadingAndSavingRemappingHelper.h" #include -#include "../common/shared_constants.h" +#include #include #include diff --git a/src/modules/keyboardmanager/ui/ShortcutControl.cpp b/src/modules/keyboardmanager/ui/ShortcutControl.cpp index a4bc28c16d..0a5b13ff22 100644 --- a/src/modules/keyboardmanager/ui/ShortcutControl.cpp +++ b/src/modules/keyboardmanager/ui/ShortcutControl.cpp @@ -3,10 +3,8 @@ #include "KeyDropDownControl.h" #include "keyboardmanager/common/KeyboardManagerState.h" #include "keyboardmanager/common/Helpers.h" -#include #include "keyboardmanager/dll/Generated Files/resource.h" -#include -extern "C" IMAGE_DOS_HEADER __ImageBase; +#include //Both static members are initialized to null HWND ShortcutControl::EditShortcutsWindowHandle = nullptr; @@ -76,8 +74,8 @@ void ShortcutControl::AddNewShortcutControlRow(StackPanel& parent, std::vector(parent, row, 0, targetAppTextBox)); newrow.emplace_back(std::make_unique(parent, row, 1, targetAppTextBox)); keyboardRemapControlObjects.push_back(std::move(newrow)); - - row.Padding({10, 10, 10, 10}); + + row.Padding({ 10, 10, 10, 10 }); row.Orientation(Orientation::Horizontal); auto brush = Windows::UI::Xaml::Application::Current().Resources().Lookup(box_value(L"SystemControlBackgroundListLowBrush")).as(); if (keyboardRemapControlObjects.size() % 2) @@ -124,7 +122,7 @@ void ShortcutControl::AddNewShortcutControlRow(StackPanel& parent, std::vector= keyboardRemapControlObjects.size()) { @@ -206,9 +204,7 @@ void ShortcutControl::AddNewShortcutControlRow(StackPanel& parent, std::vector(); StackPanel targetCol = row.Children().GetAt(2).as(); - TextBox targetApp = row.Children().GetAt(3).as() - .Children().GetAt(0).as() - .Children().GetAt(0).as(); + TextBox targetApp = row.Children().GetAt(3).as().Children().GetAt(0).as().Children().GetAt(0).as(); Button delButton = row.Children().GetAt(4).as().Children().GetAt(0).as