From b8a253fda608cc69b5b7a924d41454cdafe684b9 Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Fri, 23 Jun 2023 20:49:01 +0100 Subject: [PATCH] [PTRun]Remove unneeded registry key from installer (#27011) --- installer/PowerToysSetup/Run.wxs | 9 --- src/common/notifications/notifications.cpp | 63 ------------------- src/common/notifications/notifications.h | 3 - .../BugReportTool/RegistryUtils.cpp | 1 - 4 files changed, 76 deletions(-) diff --git a/installer/PowerToysSetup/Run.wxs b/installer/PowerToysSetup/Run.wxs index 2f4f5a0b96..3186c17c31 100644 --- a/installer/PowerToysSetup/Run.wxs +++ b/installer/PowerToysSetup/Run.wxs @@ -106,14 +106,6 @@ - - - - - - - - @@ -374,7 +366,6 @@ - diff --git a/src/common/notifications/notifications.cpp b/src/common/notifications/notifications.cpp index f6d5dbb11b..c0bbd3ce80 100644 --- a/src/common/notifications/notifications.cpp +++ b/src/common/notifications/notifications.cpp @@ -49,7 +49,6 @@ namespace // Strings in this namespace should not be localized constexpr std::wstring_view TASK_NAME = L"PowerToysBackgroundNotificationsHandler"; 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\)"; std::wstring APPLICATION_ID = L"Microsoft.PowerToysWin32"; constexpr std::wstring_view DEFAULT_TOAST_GROUP = L"PowerToysToastTag"; @@ -132,68 +131,6 @@ void notifications::run_desktop_app_activator_loop() CoRevokeClassObject(token); } -bool notifications::register_application_id(const std::wstring_view appName, const std::wstring_view iconPath) -{ - std::wstring aumidPath{ APPIDS_REGISTRY }; - aumidPath += APPLICATION_ID; - wil::unique_hkey aumidKey; - if (FAILED(RegCreateKeyW(HKEY_CURRENT_USER, aumidPath.c_str(), &aumidKey))) - { - return false; - } - if (FAILED(RegSetKeyValueW(aumidKey.get(), - nullptr, - L"DisplayName", - REG_SZ, - appName.data(), - static_cast((size(appName) + 1) * sizeof(wchar_t))))) - { - return false; - } - - if (FAILED(RegSetKeyValueW(aumidKey.get(), - nullptr, - L"IconUri", - REG_SZ, - iconPath.data(), - static_cast((size(iconPath) + 1) * sizeof(wchar_t))))) - { - return false; - } - - const std::wstring_view iconColor = L"FFDDDDDD"; - if (FAILED(RegSetKeyValueW(aumidKey.get(), - nullptr, - L"IconBackgroundColor", - REG_SZ, - iconColor.data(), - static_cast((size(iconColor) + 1) * sizeof(wchar_t))))) - { - return false; - } - return true; -} - -void notifications::unregister_application_id() -{ - std::wstring aumidPath{ APPIDS_REGISTRY }; - aumidPath += APPLICATION_ID; - wil::unique_hkey registryRoot; - RegOpenKeyW(HKEY_CURRENT_USER, aumidPath.c_str(), ®istryRoot); - if (!registryRoot) - { - return; - } - RegDeleteTreeW(registryRoot.get(), nullptr); - registryRoot.reset(); - RegOpenKeyW(HKEY_CURRENT_USER, APPIDS_REGISTRY.data(), ®istryRoot); - if (!registryRoot) - { - return; - } - RegDeleteKeyW(registryRoot.get(), APPLICATION_ID.data()); -} - void notifications::override_application_id(const std::wstring_view appID) { APPLICATION_ID = appID; diff --git a/src/common/notifications/notifications.h b/src/common/notifications/notifications.h index 4f4247f159..e0048012a1 100644 --- a/src/common/notifications/notifications.h +++ b/src/common/notifications/notifications.h @@ -14,9 +14,6 @@ namespace notifications void override_application_id(const std::wstring_view appID); void run_desktop_app_activator_loop(); - bool register_application_id(const std::wstring_view appName, const std::wstring_view iconPath); - void unregister_application_id(); - struct snooze_duration { std::wstring label; diff --git a/tools/BugReportTool/BugReportTool/RegistryUtils.cpp b/tools/BugReportTool/BugReportTool/RegistryUtils.cpp index 1085d913bc..dba32b9b2b 100644 --- a/tools/BugReportTool/BugReportTool/RegistryUtils.cpp +++ b/tools/BugReportTool/BugReportTool/RegistryUtils.cpp @@ -23,7 +23,6 @@ namespace { HKEY_CLASSES_ROOT, L"CLSID\\{51B4D7E5-7568-4234-B4BB-47FB3C016A69}\\InprocServer32" }, { HKEY_CLASSES_ROOT, L"CLSID\\{0440049F-D1DC-4E46-B27B-98393D79486B}" }, { HKEY_CLASSES_ROOT, L"AllFileSystemObjects\\ShellEx\\ContextMenuHandlers\\PowerRenameExt" }, - { HKEY_CURRENT_USER, L"SOFTWARE\\Classes\\AppUserModelId\\PowerToysRun" }, { HKEY_CLASSES_ROOT, L".svg\\shellex\\{8895b1c6-b41f-4c1c-a562-0d564250836f}" }, { HKEY_CLASSES_ROOT, L".svg\\shellex\\{E357FCCD-A995-4576-B01F-234630154E96}" }, { HKEY_CLASSES_ROOT, L".md\\shellex\\{8895b1c6-b41f-4c1c-a562-0d564250836f}" },