Skip to content

Remove context menu and shell entries for Pulsar during uninstallation#1403

Open
VeryUsual wants to merge 3 commits intopulsar-edit:masterfrom
VeryUsual:master
Open

Remove context menu and shell entries for Pulsar during uninstallation#1403
VeryUsual wants to merge 3 commits intopulsar-edit:masterfrom
VeryUsual:master

Conversation

@VeryUsual
Copy link
Copy Markdown

Fixes #274

@savetheclocktower
Copy link
Copy Markdown
Contributor

@confused-Techie, could use your help reviewing this one.

@confused-Techie
Copy link
Copy Markdown
Member

confused-Techie commented Mar 7, 2026

Thanks a ton @VeryUsual for your contribution! Sorry it's taken some time to get to reviewing it!

Taking a quick look at this one, I'm curious how this has preformed in testing for you, since I have a couple concerns that I'd have to test drive to see how they actually behave.

  1. Why did you decide to delete keys from HKCR? Since the only time Pulsar ever writes to HKCR instead of HKCU is for registering the atom:\\ protocol handler, which isn't considered in this PR. Was that used at some point in the past and I'm forgetting? Should've thought about this more. We don't need to touch HKCR at all here, since once we remove our set values from HKCU (since that's the only place we ever set them) the changes to HKCU will be merged back into HKCR right away. So touching both is unnecessary.
  2. The use of double backslashes is likely invalid, since we only need \\ when working with the string in JavaScript so the backslash isn't considered an escape character, when working with our strings in NSIS that's not necessary.
  3. According to the documentation each registery key provided to DeleteRegKey '...must end with a backslash... Otherwise the registry key cannot be removed'. So I'm curious how this has preformed during testing.
  4. Lastly, according to the same docs "The Error flag is set if the key could not be removed from the registry (or if it didn't exist to begin with)." Now I'm not too familiar with the behavior of the error flag in NSIS, but maybe it's non-blocking, otherwise maybe we should first ensure we check for the existence of these keys before attempting deletion. Since these keys are all optionally added by the user, so we can't be confident that they will actually exist.

Again I appreciate your contributions here! Gonna have to test this one out to see what's going on under the hood with these changes.


Otherwise as informational fluff, diving into this thought I'd spell out exactly where Pulsar writes to the registry for the purposes of Win10 context menus.

  • File Handler: HKCU \Software\Classes\Applications\Pulsar.exe\shell\open\command
  • File Context Menu: HKCU \Software\Classes\*\shell\Pulsar\command
  • Folder Context Menu: HKCU \Software\Classes\Directory\shell\Pulsar\command
  • Folder Background Context Menu: HKCU \Software\Classes\Directory\background\shell\Pulsar\command

@confused-Techie
Copy link
Copy Markdown
Member

confused-Techie commented Mar 7, 2026

I've whipped up a quick test installer NSI file to test what's going on here.
And while it seems that attempting to delete a non-existent key does produce errors, they are non-blocking and it should just keep on trucking.

But considering we are editing a users registry, we should really error on the side of safety, since we would really want to make sure we never cause any issues.

The following pattern would likely be our safest and most concise method to delete these values, while making sure to only delete anything that exist.

; Context Menu registry cleanup
ClearErrors

; File Context Menu
Var FileContextMenuRK
StrCpy $FileContextMenuRK "Software\Classes\*\shell\Pulsar\"

ReadRegStr $0 HKCU $FileContextMenuRK ""
${IfNot} ${Errors}
  DeleteRegKey HKCU $FileContextMenuRK
${EndIf}
ClearErrors

While this might be overkill, feels like the safest method for editing the users system just to ensure nothing ever goes wrong. And sure the variable isn't needed at all, but feels better than having to type it out twice.

@confused-Techie
Copy link
Copy Markdown
Member

Alright, ended up pushing my suggested changes to the PR since editing was enabled, and will test with a built bin once CI is done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Open With Pulsar" context option doesn't go away after uninstalling

3 participants