Skip to content

Commit

Permalink
[PTRun]Remove unneeded registry key from installer (microsoft#27011)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimecbernardo authored Jun 23, 2023
1 parent a32d6a6 commit b8a253f
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 76 deletions.
9 changes: 0 additions & 9 deletions installer/PowerToysSetup/Run.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,6 @@
<?define PowerToysImagesCmpFilesPath=$(var.BinDir)modules\launcher\Plugins\PowerToys\Images\?>

<Fragment>
<Component Id="launcherShortcutComponent" Directory="LauncherInstallFolder" >
<!-- Toast Notification AUMID -->
<RegistryKey Root="$(var.RegistryScope)" Key="SOFTWARE\Classes\AppUserModelId\PowerToysRun">
<RegistryValue Type="string" Name="DisplayName" Value="PowerToys Run" />
<RegistryValue Type="string" Name="IconUri" Value="[LauncherImagesFolder]RunAsset.ico" />
</RegistryKey>
</Component>

<DirectoryRef Id="LauncherInstallFolder" FileSource="$(var.launcherFilesPath)">
<!-- Generated by generateFileComponents.ps1 -->
<!--launcherFiles_Component_Def-->
Expand Down Expand Up @@ -374,7 +366,6 @@
<RemoveFolder Id="RemoveFolderPowerToysPluginFolder" Directory="PowerToysPluginFolder" On="uninstall"/>
<RemoveFolder Id="RemoveFolderPowerToysImagesFolder" Directory="PowerToysImagesFolder" On="uninstall"/>
</Component>
<ComponentRef Id="launcherShortcutComponent" />
</ComponentGroup>
</Fragment>
</Wix>
63 changes: 0 additions & 63 deletions src/common/notifications/notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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<DWORD>((size(appName) + 1) * sizeof(wchar_t)))))
{
return false;
}

if (FAILED(RegSetKeyValueW(aumidKey.get(),
nullptr,
L"IconUri",
REG_SZ,
iconPath.data(),
static_cast<DWORD>((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<DWORD>((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(), &registryRoot);
if (!registryRoot)
{
return;
}
RegDeleteTreeW(registryRoot.get(), nullptr);
registryRoot.reset();
RegOpenKeyW(HKEY_CURRENT_USER, APPIDS_REGISTRY.data(), &registryRoot);
if (!registryRoot)
{
return;
}
RegDeleteKeyW(registryRoot.get(), APPLICATION_ID.data());
}

void notifications::override_application_id(const std::wstring_view appID)
{
APPLICATION_ID = appID;
Expand Down
3 changes: 0 additions & 3 deletions src/common/notifications/notifications.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion tools/BugReportTool/BugReportTool/RegistryUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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}" },
Expand Down

0 comments on commit b8a253f

Please sign in to comment.