1

I have an Inno Setup installer that needs to restart the explorer (in order to install a shell extension). During installation, I can start explorer.exe with ShellExecAsOriginalUser so that it doesn't start with admin privileges; this is important on Windows 8, because running explorer with admin privileges prevents Metro apps from running.

The trouble is that this function can't be called during uninstall, as stated in the documentation (I tried to do it anyway, but of course it fails). I don't understand why it's not possible. Any clue? Is there a workaround?

Thomas Levesque
  • 286,951
  • 70
  • 623
  • 758

1 Answers1

1

It cannot be called during uninstall because the Programs and Features control panel always starts the uninstaller with elevated permissions (when running a per-machine uninstaller, anyway); the "original user" is therefore still the admin user.

In this situation, probably the correct thing to do is to just use the latest version of Inno -- this includes Restart Manager functionality which should automatically sort Explorer out without you having to do anything.

Miral
  • 12,637
  • 4
  • 53
  • 93
  • Thanks for your answer. Actually I don't think it has anything to do with the control panel: the same happens if I start the uninstaller program directly. But I think you have a point, it's probably because the uninstaller starts with elevated privileges, so there's no way to revert to the original user. I tried to use the Restart Manager, but it caused so many issues that I eventually decided to do without... – Thomas Levesque Dec 21 '12 at 09:25
  • It would theoretically be possible to enable that functionality when the uninstall was run directly. But I suspect that the author of Inno didn't bother, since it would only work some of the time (and in the least common case, in fact), meaning that you couldn't rely on it anyway. – Miral Dec 24 '12 at 11:16