Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't uninstall #148

Closed
Unknow0059 opened this issue Apr 26, 2024 · 7 comments · Fixed by #172
Closed

Can't uninstall #148

Unknow0059 opened this issue Apr 26, 2024 · 7 comments · Fixed by #172
Labels
bug Something isn't working
Milestone

Comments

@Unknow0059
Copy link

Unknow0059 commented Apr 26, 2024

Describe the bug
I went to Programs and Features (appwiz.cpl) to uninstall ShellAnything and the uninstall process failed with an error dialog,

There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor.  

I also tried running the initial MSI file used to install it to uninstall it, same error.

Screenshots
image

Environment

  • Windows 10 Enterprise 2009 19045.4291

Additional context
The motive to uninstall ShellAnything is that it does not support #73 which is the reason I sought such a program.

@Unknow0059 Unknow0059 added the bug Something isn't working label Apr 26, 2024
@end2endzone
Copy link
Owner

Hi. Thank you for reporting this issue and letting me know why you did not like it.

The uninstaller will try to run regsvr32.exe (see WIX.extra.in, line 39) to unregister the shell extension before it can be uninstalled. This is mandatory because Windows File Explorer will have a hook/hold on ShellAnything's shell extension dll file. You must first force File Explorer to release the hook on the dll first. However, my expectations are that the Windows Installer should have detected this, and prevented the execution with a popup such as this:

image

Before running the uninstaller, you can manually unregister the shell extension following the uninstall instructions specified in INSTALL.md. If done correctly, you should also be able to uninstall without having to reboot your system.

To clean up your system's registry, I suggest that you reinstall the application and uninstall following the instructions in INSTALL.md.

Let me know how it went.
Close this issue if this has resolved your issue.

@Unknow0059
Copy link
Author

Before running the uninstaller, you can manually unregister the shell extension following the uninstall instructions specified in INSTALL.md

error at step 1

image

@end2endzone
Copy link
Owner

I think I have found why you are getting these error messages. I am able to reproduce this issue!
If you try to unregister the shell extension twice (or more), you get this error message. In other words, if you unregister while ShellAnything is not registered, you get an error message.

Reproducing steps:

  • Install the ShellAnything version 0.9.0. During installation, select "Register components". This will register the shell extension.
  • On File Explorer, right-click on a directory. This will "load the shell extension in File Explorer".
  • According to the uninstallation steps, if you do not want to have to reboot, you must :
    • Manually unregister the shell extension with unregister.bat.
    • Refresh all Windows File Explorer processes (with file_explorer_renew.exe) or with a log off/log on

At this point, if you try to run unregister.bat again, you will get the error popup mentioned in the previous post:

---------------------------
RegSvr32
---------------------------
The module "sa.shellextension.dll" was loaded but the call to DllUnregisterServer failed with error code 0x8002801c.

For more information about this problem, search online using the error code as a search term.
---------------------------
OK   
---------------------------

And if you proceed and uninstall ShellAnything from the "Add or remove programs", you will get the original error popup :

---------------------------
ShellAnything
---------------------------
There is a problem with this Windows Instaler package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor.
---------------------------
OK   
---------------------------

During the uninstall process, if you installed with the option "Register components", Windows Installer will need to "unregister" the shell extension. However, since the commands regsvr32 /u sa.shellanything.dll fails, the uninstaller also fails and reports an error.

@end2endzone
Copy link
Owner

@Unknow0059
This is quite annoying... and embarrassing... I try to test as must as possible with the installer but I see that I did not test as much as I could the uninstaller. Also I suggest in the INSTALL manual to "unregister manually before uninstallation" to allow uninstallation without reboot. If you proceed like this, it is a sure fail because of the double-unregistration. Man... I am sorry for this. Thank you for reporting this.

The issue was introduced with the partial fixes for #115 introduced somewhere between v0.8.0 and v0.9.0. I migrated my code from "do it yourself registration" to using Microsoft's ATL::CAtlDllModuleT<> template. It was supposed to be easier to manage registry modifications.

I will add this issue as part of the mandatory fixes for the next release.

@end2endzone end2endzone added this to the 0.10.0 milestone Aug 31, 2024
end2endzone added a commit that referenced this issue Sep 5, 2024
Now silencing error 0x8002801c if found and detecting that TypeLib is not already registered on system.
@end2endzone
Copy link
Owner

end2endzone commented Sep 5, 2024

The behavior observed above seems to be the default by Microsoft.
For example:

  1. Create a new ATL Project named MyATLProject2.
    • Check "Create directory for solution".
    • Check "Allow merging of proxy/stub code".
  2. Compile the project in Release x64 configuration.
  3. Open a command prompt with "administrative privileges".
  4. Change directory (cd) to $(SolutionDir)\x64\Release.
  5. Run regsvr32 /u MyATLProject2.dll.
    • --> You get The module "MyATLProject2.dll" was loaded but the call to DllUnregisterServer failed with error code 0x8002801c..

Here is something I do not understand. Why does regsvr32 /u MyATLProject2.dll succeeds again after a rebuild?
For example:

  1. Repeat the steps above (until you get the error message about 0x8002801c).
  2. Touch a source file (for example MyATLProject2\MyATLProject2.cpp).
  3. Compile the project in Release x64 configuration (again).
  4. Open a command prompt with "administrative privileges".
  5. Change directory (cd) to $(SolutionDir)\x64\Release.
  6. Run regsvr32 /u MyATLProject2.dll.
    • --> You get DllUnregisterServer in MyATLProject2.dll succeeded.

The first time you unregister a newly build dll, the command regsvr32 /u MyATLProject2.dll always succeeds. Obviously, the first time MyATLProject2.dll is build, there is nothing registered to the system. This means that the hypothesis that "DllUnregisterServer() returns error code 0x8002801c because there is nothing to unregister" is false.

EDIT: I have crossed out the 2nd paragraph which is invalid. I had VS2019 run in elevated privileges and new ATL projects are automatically registering the dll after compilation. That's why I was able to unregister successfully (but only once) after each new compilation.

 
 
So yeah, "DllUnregisterServer() returns error code 0x8002801c because there is nothing to unregister" is most probably true.

@Unknow0059
Copy link
Author

Unknow0059 commented Sep 26, 2024

I believe I must wait for a new release to benefit from or otherwise test this change.

@end2endzone
Copy link
Owner

I need apologies for this. I am still trying to figure out how the PR and the issue should be related. I understand that it would be preferable to wait for an official release before closing the issue. But then, how am I supposed to link the PR with this issue ? Through the CHANGES file ? Maybe I could create a label "close-at-release" or something like this. Anyway.

To answer your question, yes you should wait for the new release (which I plan to do in a few weeks). However, in the meantime, you can try the nightly builds. Installers are available at https://ci.appveyor.com/project/end2endzone/shellanything/build/artifacts.
The current builds on Github Action are working fine but the ones on AppVeyors are failing (hanging indefinitely). I am trying to figure this out as of right now. You can roll back in the history to get the latest working version.

end2endzone added a commit that referenced this issue Oct 12, 2024
commit 2489b88
Merge: 29ba134 d0d1bfa
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Fri Oct 11 17:02:38 2024 -0400

    Merge pull request #179 from end2endzone/feature-issue177

    Feature issue177 (for #177 and #178)

commit d0d1bfa
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sun Sep 29 10:58:12 2024 -0400

    Fixed unit test `TestTools.testArgumentsDebugger()` in release configuration.

commit 23c7e36
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sun Sep 29 10:57:25 2024 -0400

    Renamed `KillShellAnythingArgumentsDebuggerProcess()` to `KillArgumentsDebuggerProcess()`.

commit b690f7f
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sun Sep 29 10:54:39 2024 -0400

    Removed references to `KillCalculatorProcess()` and `StartCalculatorProcess()`.

commit f49dda1
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sat Sep 28 15:30:31 2024 -0400

    Revert "Add code to trace execusion of test `TestPlugins.testProcess()` which hangs on AppVeyor."

    This reverts commit 6375f36.

commit 3872670
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sat Sep 28 15:24:34 2024 -0400

    Revert "Temporary modified TestPlugins.cpp for high debugging on AppVeyor."

    This reverts commit 25ca469.

commit 218d81c
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sat Sep 28 15:24:10 2024 -0400

    Revert "Temporary added verbose function logging for sa_plugin_process.cpp plugin."

    This reverts commit 444e17a.

commit c752c0f
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sat Sep 28 14:41:45 2024 -0400

    Replaced `calc.exe` example by `mspaint.exe` as per comment in #178

commit 6dd793b
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sat Sep 28 14:33:50 2024 -0400

    Now using mspaint.exe as default executable to start/stop while running tests. This is better than using calc.exe since calc.exe is a stub/sandbox application to start CalculatorApp.exe. When launching calc.exe, we are unable to properly detect the process id of CAlculatorApp.exe.
    Follow up to 319f594.

commit 10800f6
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sat Sep 28 14:25:53 2024 -0400

    Modified arguments.debugger to show the current directory.

commit 444e17a
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sat Sep 28 12:23:17 2024 -0400

    Temporary added verbose function logging for sa_plugin_process.cpp plugin.

commit 497a46c
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sat Sep 28 12:02:01 2024 -0400

    Fixed typo.

commit 77d23ba
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sat Sep 28 11:16:17 2024 -0400

    Fixed a small bug in ConsoleLoggerService

commit 25ca469
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sat Sep 28 10:13:30 2024 -0400

    Temporary modified TestPlugins.cpp for high debugging on AppVeyor.

commit 4a7afe8
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sat Sep 28 10:12:57 2024 -0400

    Created new ConsoleLoggerService that can be used for debugging on CI servers.

commit 6375f36
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sat Sep 28 09:12:23 2024 -0400

    Add code to trace execusion of test `TestPlugins.testProcess()` which hangs on AppVeyor.

commit 319f594
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Wed Sep 25 20:57:20 2024 -0400

    Modified tests that starts processes to use the new `console` attribute set to false to prevent window flicker while running tests.
    Modified tests that started/killed notepad.exe to use calc.exe instead. This change prevents killing potentially open/unsaved documents.

commit 0bbeb19
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Tue Sep 24 20:59:35 2024 -0400

    * Fixed issue #178: Exec action should expose the created process id.

commit d9ebea7
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Tue Sep 24 20:38:03 2024 -0400

    * Fixed issue #177: Execute a console program without showing a window.

commit ac0a788
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Tue Sep 24 20:37:55 2024 -0400

    Updated documentation for #177

commit 2374454
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Tue Sep 24 20:37:30 2024 -0400

    Implemented `console=false` attribute handling for ActionExecute.cpp. Added support for hidden console in WindowsProcessLauncherService. #177

commit fe0f6a7
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Tue Sep 24 19:47:59 2024 -0400

    Split code from `WindowsProcessLauncherService::StartProcess()` into `StartProcessFromShellExecute()` and `StartProcessFromCreateProcess()`.

commit 86151f4
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sun Sep 22 20:47:35 2024 -0400

    Added method `StartProcess()` to interface `IProcessLauncherService`.
    Moved code specific to Windows api to WindowsProcessLauncherService.
    Modified ActionExecute::Execute() to delegate to WindowsProcessLauncherService.

commit dd3656d
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sun Sep 22 14:45:03 2024 -0400

    Added more error messages in WindowsProcessLauncherService.cpp.

commit 8117efe
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sun Sep 22 14:19:45 2024 -0400

    Moved OS specific code from ActionOpen to WindowsProcessLauncherService implementation.

commit 45b1704
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sun Sep 22 12:26:06 2024 -0400

    Created dummy IProcessLauncherService interface in preparation for #177.

commit dcdb37b
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Sun Sep 22 11:48:40 2024 -0400

    Implemented support for `console` attribute for `<exec>` elements.

commit 29ba134
Merge: 7bdf6bd 9e709d3
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Wed Sep 11 22:59:13 2024 -0400

    Merge pull request #176 from end2endzone/feature-issue174 #174

    Added missing fixed properties to the documentation.

commit 9e709d3
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Wed Sep 11 22:58:12 2024 -0400

    Added missing fixed properties to the documentation.

commit 7bdf6bd
Merge: 9c20b9e 088f5aa
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Wed Sep 11 22:43:26 2024 -0400

    Merge pull request #175 from end2endzone/feature-issue161 #161

    Feature issue161

commit 088f5aa
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Wed Sep 11 22:24:00 2024 -0400

    Updated CHANGES

commit 182e1dc
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Wed Sep 11 22:19:32 2024 -0400

    Moved section `Windows icons preview images` from a subsection of `Icons` to section `Tools`. A hint note was left at the end of the Icons section about the `Windows icons preview images` tool. #161

commit 36e0572
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Wed Sep 11 22:04:04 2024 -0400

    Added a `Windows icon previews...` menu that links to icon preview images. #161

commit 4303f40
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Tue Sep 10 20:57:20 2024 -0400

    More Windows icons preview images.

commit 3b91188
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Tue Sep 10 20:54:30 2024 -0400

    Extracting more icons from Windows dll.

commit 07fc0ca
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Tue Sep 10 20:54:03 2024 -0400

    Packaging directory `/resources/Windows Icon Tables` to installation.

commit 36f8ce5
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Tue Sep 10 17:26:25 2024 -0400

    Fixed url for Windows icons preview section

commit 80f4d43
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Tue Sep 10 17:24:24 2024 -0400

    Updated documentation for #161

commit 18cdca4
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Tue Sep 10 17:05:54 2024 -0400

    Added icons tables for Windows 10 Home and Windows 11 Pro.

commit 11648b5
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Tue Sep 10 17:04:36 2024 -0400

    Created script for generating an icon preview table.

commit 9c20b9e
Merge: 8ca8c57 56f1420
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Thu Sep 5 20:22:44 2024 -0400

    Merge pull request #172 from end2endzone/feature-issue148 #148

    Feature issue 148

commit 56f1420
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Thu Sep 5 18:23:47 2024 -0400

    Added checks if TypeLib is registered on system or for current user. If TyleLib is not already registered, then we assume that we can silence error 0x8002801c (TYPE_E_REGISTRYACCESS).

commit 00add9a
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Wed Sep 4 22:28:08 2024 -0400

    Fixed formatting of file TypeLibHelper.cpp.

commit 9f73115
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Wed Sep 4 22:26:48 2024 -0400

    Also support SYS_WIN32 for SYSKIND in function IsTypeLibRegisteredOnSystem().

commit a50c851
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Wed Sep 4 22:24:38 2024 -0400

    * Fixed issue #148: Can't uninstall.
    Now silencing error 0x8002801c if found and detecting that TypeLib is not already registered on system.

commit 8dce952
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Wed Sep 4 21:55:09 2024 -0400

    Added TypeLibHelper.h/cpp which have utility functions for configuring Windows Registry for TypeLib com libraries.

commit e699716
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Wed Sep 4 21:21:19 2024 -0400

    Added Reg.h/Reg.cpp from Microsoft sample project https://github.com/microsoftarchive/msdn-code-gallery-microsoft/tree/master/OneCodeTeam/C%2B%2B%20Windows%20Shell%20context%20menu%20handler%20(CppShellExtContextMenuHandler)
    Modified project sa.shellextension to enable UNICODE support for the shell extension.

commit 0c65816
Author: Antoine Beauchamp <end2endzone@gmail.com>
Date:   Wed Sep 4 21:09:27 2024 -0400

    Added more ATTACH_HOOK_DEBUGGING macros to meaningful locations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants