1

I'm using Inno Setup 6.0.5 and I register two shell extension DLLs which are similar to the ones from ownCloud. One DLL registers a dynamic context menu, another DLL adds overlay icons.

I'm using the facilities Inno Setup provides to do this step. That means:

[Setup]
ChangesAssociations=true
ChangesEnvironment=true

[Files]
...
Source: "shell-integration\*"; DestDir: "{app}\shell-integration"; Flags: regserver 64bit; Check: IsAdminInstallMode;

What I observe is the following:

  • After the setup finished, the overlay icons are not active. They only are once I force-restart explorer.exe manually. There are sources like this which claim that this is possible by calling SHChangeNotify and SendMessageTimeoutW, but they are obviously wrong, since I am doing exactly that (see ChangesAssociations and ChangesEnvironment which are supposed to do this).
  • After uninstalling, the app directory is not deleted, because the 2 DLLs files are still locked. This also inhibits updating my application. Inno Setup is supposed to detect locked files and offer to close the apps that lock them, but that mechanism doesn't seem to work... Also, uninsrestartdelete flag is of no use, as this causes Inno Setup to delete the files only after a reboot, but I don't want to force the user to restart the machine in case they upgrade the application.

What am I supposed to do? The only solution I see is to do everything myself, and not rely on [Files] and regserver flag. Especially the uninstallation requires to first unregister the DLL, then force-restart explorer.exe, then actually delete the files and folders. I would do this in CurUninstallStepChanged in the if CurUninstallStep = usUninstall block. And to restart explorer.exe I would modify CurStepChanged in the if (CurStep = ssDone) block.

MShekow
  • 1,526
  • 2
  • 14
  • 28
  • Thank you for the clarification. Let me know if you see any other way to solve my problem, other than the one I suggested in the last paragraph of my post. – MShekow Sep 25 '20 at 11:21
  • The problem is the update process. AFAIK, Inno Setup normally just installs an application over the previous version, without invoking the uninstaller, correct? If I leave things like that, then indeed updating the application works - the installer, when invoked the 2nd time, detects that explorer.exe locks the DLLs and closes explorer.exe and restarts it. But if I manually add code in `CurStepChanged -> ssInstall` to first invoke the uninstaller (to get a clean slate), explorer.exe is not started by Inno Setup after the installation has finished. – MShekow Sep 25 '20 at 14:42
  • I went with https://stackoverflow.com/questions/62725866/how-do-you-close-then-restart-explorer-exe-in-inno-setup-uninstall-using-the-res to do a clean, reboot-free uninstallation of the DLLs. Restarting explorer by hand using `taskkill` and `start explorer.exe` was unreliable. – MShekow Sep 25 '20 at 17:08

0 Answers0