king_kobra
Posts: 8
Joined: Tue Feb 20, 2007 12:06 am

Force explorer to unload a dll during uninstall

Does anyone know of a good way to force explorer.exe to unload a namespace .dll at uninstall? I would like to avoid forcing a reboot.

Thanks,

Kobra
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi Kobra,

I don't find a good explanation regarding this. What I found is this:
http://msdn.microsoft.com/library/defau ... ugging.asp

Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
king_kobra
Posts: 8
Joined: Tue Feb 20, 2007 12:06 am

Thanks for the reply. The msdn link is talking about how to debug shell externsions without crashing the desktop and task bar. Although it doesn't explicitly state this, the explorer process that holds the shell extension dlls must still be killed manually by the developer.

I don't have a problem killing explorer manually while developing but I can't do this during a deployment update or reinstallation. I've seen a lot of posts out there regarding this exact issue but have yet to see a decent solution that allow the .dlls to be unloaded from explorer without having to restart the machine.

Thanks for your reply.

Kobra
InnovRick
Posts: 9
Joined: Wed May 22, 2013 4:16 pm

Re: Force explorer to unload a dll during uninstall

It's been more than 6 years since this was posted, and I can't seem to find an answer to this question either.

We have a shell extension (dll) which explorer.exe loads when we preview a file of a certain extension. Our MSI's uninstall old versions of our product and install the new one (upgrade). We also support would like to support downgrades but this is besides the point. If during the uninstallation phase, our shell extension is loaded by explorer.exe, we get a popup with the 2 following options:
  • Automatically close application and attempt to restart them after setup is complete
  • Do not close applications (a reboot will be required)
When we choose the first option, we next get the message "The setup was unable to automatically close all requested applications. Please ensure that the applications holding files in use are closed before continuing with the installation". It is obviously not an option for us to ask the user to close and restart windows explorer manually.

When we choose the second option, the installation completes but does not ask us to reboot at the end. After manual reboot, the shell extension loads properly. Perhaps there is a way to display a popup for the purpose of rebooting?

Basically, if there is a way for the first option to work, this would be our preferred way to handle this as we would prefer to not impose a reboot to our users. If there is no way to accomplish this, then we would like to have a popup which offers the user the opportunity to reboot after the installation is complete.

Thank you,

Eric
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Force explorer to unload a dll during uninstall

Hi Eric,

This is task to which nobody seems to have an exact solution. I've also seen in the last years similar questions on StackOverflow.com,
with no relevant answers unfortunately.

It seems the second option is what you need, we just need to solve the restart popup problem. First of all, have you checked your project is configured to allow the installer display restart prompts? This option in available in Install Parameters page, there you should have the combo Reboot Behavior set to Prompt for Reboot when required.

If this policy is set the installer should display you with the appropriate reboot dialog upon completion of the installation.

Best regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
InnovRick
Posts: 9
Joined: Wed May 22, 2013 4:16 pm

Re: Force explorer to unload a dll during uninstall

Thanks for your reply Bogdan.

After doing some tests, we found that using the reboot method was acceptable since our shell extension kept working even without a reboot since it seems a copy is made and kept in use until we reboot and the new one takes effect. Since our shell extension is forward compatible, this works just fine.

When it comes to the "MsiRMFilesInUse" dialog, we do not want to display it if "Windows Explorer" and/or "Preview Handler Surrogate Host" are the only applications using files that need updating. On the other hand, we would like to display it if other applications are using files that need updating. If one of these two applications and other applications are using files that need updating, we would like to remove these two applications from the list being displayed in the dialog. What is the best way to accomplish this? I've tried reading the "FileInUseProcess" property of the listbox in this dialog but to no avail.

Also, we do not want to give a choice to the user when this dialog is displayed. Either they close the applications, or the installer does not proceed. How can this be accomplished?

Thank you,

Eric
zwaa
Posts: 1
Joined: Sun Oct 18, 2015 10:19 am

Re: Force explorer to unload a dll during uninstall

http://www.codeproject.com/Articles/441 ... ell-Extens
Find
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\AlwaysUnloadDLL
and
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer

Then
http://www.addictivetips.com/windows-ti ... and-vista/
NOTE: CTRL+ALT+SHIFT+Cancel should be CTRL+ALT+SHIFT+ESCAPE

To find restart procedures for other versions of Windows, Google:
restart explorer.exe windows

Note: After restarting explorer.exe, if a program window doesn't minimize when clicking on it in the taskbar, close that window or program and reopen it.

Return to “Common Problems”