Right. So basically the Windows Installer/Restart Manager combo don't work very 
well for shell extensions that can be loaded in various processes.

Probably the best thing I can do is try to detect the user's response to the 
Restart Manager prompt run a ScheduleReboot action if the user has selected to 
not close the offending processes. Also if running in basic UI mode and the 
shell feature is installed.
Looking at the sources, I think I can do something like:
<InstallExecuteSequence>
  <ScheduleReboot After='InstallFinalize'>WixUIRMOption="DontUseRM" OR 
(UILevel=2 AND !MyFeature=3)</ScheduleReboot>
</InstallExecuteSequence>




---- Blair <os...@live.com> wrote: 
> Believe it or not, there is a saying oft repeated in the hallways at 
> Microsoft: "Reboots are evil". The current design in Windows Installer is to 
> request a reboot only when under no reasonable scenario can the reboot be 
> avoided (such as an upgrade of a running program when the program won't "die" 
> during the upgrade).
> 
> If a running program is holding a file in use, Windows Installer will 
> move/rename that file and mark it for removal upon the next reboot (the move 
> is into a hidden directory). If the move happens as a result of a removal 
> attempt, the file is considered to be "safe" for the program to continue to 
> use until it is shutdown by the user at their convenience (it is up to each 
> program to fail gracefully if some other file they didn't hold open is 
> suddenly missing or who's version/content suddenly changes). If, on the other 
> hand, the developer of the program knows that the program can't safely 
> continue to use the file(s), it is up to the developer to stop the running 
> instances of the program(s) or force a reboot, since Windows Installer cannot 
> possibly know who is good at defensive programming and who is not (even when 
> the program comes from the Windows team).
> 
> -----Original Message-----
> From: i...@roadrunner.com [mailto:i...@roadrunner.com] 
> Sent: Wednesday, July 14, 2010 12:16 PM
> To: General discussion for Windows Installer XML toolset.
> Cc: Blair
> Subject: Re: [WiX-users] Restart Manager (reboot after uninstall)
> 
> OK, so basically you are saying that the restart prompt is only supposed to 
> appear during an upgrade when a file is being replaced.
> In my case I'm always using a major upgrade, so the old version is 
> uninstalled first, then the new one is installed. No file is directly 
> "overwritten".
> 
> It is a bit weird that the system doesn't handle uninstalls or major 
> upgrades, but I can live with that. I don't have a problem if I'm getting the 
> intended behavior. My only concern is that I'm somehow breaking a feature I'm 
> supposed to get out of the box.
> 
> 
> ---- Blair <os...@live.com> wrote: 
> > In scenario #1, Windows Installer will not by default [prompt for] reboot.
> > In scenario #2, there are two possibilities:
> > 2.1 - RemoveExistingProducts is scheduled early and this is a major upgrade:
> > Removal of the old file occurs before writing of the new file: no [prompt
> > for] reboot (same as scenario #1).
> > 2.2 - all other cases (RemoveExistingProducts scheduled late or non-major
> > upgrade): File is overwritten (assuming that the component rules were
> > followed) and a prompt for reboot occurs.
> > 
> > For any other possibility you have to detect the situation yourself and ask
> > for the reboot prompt. The simplest way is to always ask for reboot except
> > for clean initial installation, or ask for reboot always (I assume that the
> > shell has to be restarted no matter what to start using a new shell
> > extension). The next simplest is to change your MsiRMFilesInUse dialog such
> > that the ignore button is either disabled, hidden or removed (thus the user
> > has no choice but to use the restart manager), although that won't help with
> > basic or silent installations. The third option is to add an embedded UI
> > (assuming your minimum MSI version is 4.5) or ensure that your transactions
> > are always under the control of a bootstrapper (hard to do, under the best
> > circumstances) and capture the MsiRMFilesInUse call to always return a code
> > for using the restart manager without ever showing the option to the user.
> > Next harder is to duplicate the files-in-use logic yourself and set a
> > property.
> > 
> > There may be some property that gets set when a file-in-use is detected, but
> > I have never seen it.
> > 
> > -----Original Message-----
> > From: Ivo Beltchev [mailto:i...@roadrunner.com] 
> > Sent: Wednesday, July 14, 2010 9:27 AM
> > To: General discussion for Windows Installer XML toolset.
> > Subject: Re: [WiX-users] Restart Manager (reboot after uninstall)
> > 
> > This is a shell extension and the DLL is used by the Explorer process.
> > There are two scenarios:
> > 1) Uninstall - no file is actually "replaced", simply deleted.
> > 2) Upgrade - the DLL is replaced by a new version.
> > 
> > The Restart Manager correctly identifies that the DLL is in use by 
> > Explorer and offers to close it.
> > If I choose to close it, everything works fine - The Explorer is closed, 
> > then restarted at the end of the install process.
> > If I choose not to close it at this time I expect a prompt to reboot the 
> > machine at the end. I don't get one. So the old version of the DLL is 
> > still loaded by Explorer, preventing the new version from showing up.
> > 
> > The thing gets a bit more complicated because the shell extension gets 
> > loaded in other processes that use the shell (pretty much every app that 
> > has a FileOpen box). That's why I want to rely on the Restart Manager to 
> > do its thing instead of trying to make a custom solution specifically 
> > for Explorer.exe.
> > 
> > 
> > Blair wrote:
> > > If you didn't replace one of the files that were discovered to be in use,
> > > then no, you won't get an automatic reboot prompt. Which file did you
> > > replace when you uninstalled your application?
> > >
> > > -----Original Message-----
> > > From: Ivo Beltchev [mailto:i...@roadrunner.com] 
> > > Sent: Wednesday, July 14, 2010 9:04 AM
> > > To: General discussion for Windows Installer XML toolset.
> > > Subject: Re: [WiX-users] Restart Manager (reboot after uninstall)
> > >
> > > But I don't want to restart unconditionally. Only when the user chooses 
> > > to stop the Restart Manager from closing the offending applications. Is 
> > > there a way to detect that?
> > >
> > > I'm reading the documentation for the REBOOT property here: 
> > > http://msdn.microsoft.com/en-us/library/aa371101(VS.85).aspx
> > > It says "For example, the installer automatically prompts for a restart 
> > > if it needs to replace any files in use during the installation." So I'm 
> > > thinking that I should get a reboot prompt at the end of the uninstall 
> > > or upgrade. But there isn't one. Am I reading the documentation correctly?
> > >
> > > Blair wrote:
> > >   
> > >> If you have code that causes the application(s) detected to shutdown
> > >> (including using the built-in actions to stop services you install) the
> > >> restart manager-related detection code doesn't always acknowledge that.
> > As
> > >>     
> > > a
> > >   
> > >> result the user is often told of a need for reboots that ultimately are
> > >> never required.
> > >>
> > >> If files-in-use are not replaced (just moved/marked for removal on next
> > >> reboot) then Windows Installer doesn't ask for a reboot unless a
> > >> reboot-related action or property are set indicating otherwise. In
> > >> uninstallations, that is often the case.
> > >>
> > >> You could try setting REBOOT=Force when you detect that you will be
> > >> uninstalling. That should cause a reboot prompt.
> > >>
> > >> The reason for reboot instead of logoff is that the system that removes
> > >> marked files system boot during isn't activated during logoff or logon,
> > so
> > >> the marked files are never actually removed until an actual reboot.
> > >>
> > >> -----Original Message-----
> > >> From: Ivo Beltchev [mailto:i...@roadrunner.com] 
> > >> Sent: Tuesday, July 13, 2010 8:55 PM
> > >> To: General discussion for Windows Installer XML toolset.
> > >> Subject: [WiX-users] Restart Manager (reboot after uninstall)
> > >>
> > >> Hi
> > >>
> > >> I have an uninstaller that uses the Restart Manager. When it detects 
> > >> that files are in use it shows one of two messages:
> > >>
> > >> 1) When uninstalling in quiet mode, there is a popup saying "...... a 
> > >> reboot will be required to complete the setup"
> > >>
> > >> 2) When uninstalling in UI mode, there is a list of processes with 2 
> > >> options: A) restart applications, B) Do not close applications. A reboot 
> > >> will be required.
> > >>
> > >> I am expecting that after the uninstaller is finished there will be a 
> > >> prompt to restart the computer, but I don't get one.
> > >>
> > >> Reading about MsiRMFilesInUse here: 
> > >> http://wix.sourceforge.net/manual-wix3/WixUI_dialogs.htm, I see "It 
> > >> allows the user to attempt to automatically close applications or ignore 
> > >> the prompt and result in the setup requiring a reboot after it 
> > >> completes." What does "result in requiring a reboot" mean? That the 
> > >> setup will ask the user to reboot, or that the user must remember to 
> > >> reboot manually?
> > >>
> > >> If there is no reboot prompt built in, how do I make one (basically how 
> > >> do I detect if the user has chosen not to close the applications)? And 
> > >> even better, if I can customize the prompt to do a log off instead of 
> > >> reboot.
> > >>
> > >>
> > >> Thanks
> > >> Ivo
> > >>
> > >>
> > >>
> > >>
> > >>     
> > >
> > ----------------------------------------------------------------------------
> > >   
> > >> --
> > >> This SF.net email is sponsored by Sprint
> > >> What will you do first with EVO, the first 4G phone?
> > >> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> > >> _______________________________________________
> > >> WiX-users mailing list
> > >> WiX-users@lists.sourceforge.net
> > >> https://lists.sourceforge.net/lists/listinfo/wix-users
> > >>
> > >>
> > >>
> > >>     
> > >
> > ----------------------------------------------------------------------------
> > > --
> > >   
> > >> This SF.net email is sponsored by Sprint
> > >> What will you do first with EVO, the first 4G phone?
> > >> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> > >> _______________________________________________
> > >> WiX-users mailing list
> > >> WiX-users@lists.sourceforge.net
> > >> https://lists.sourceforge.net/lists/listinfo/wix-users
> > >>
> > >>   
> > >>     
> > >
> > >
> > ----------------------------------------------------------------------------
> > > --
> > > This SF.net email is sponsored by Sprint
> > > What will you do first with EVO, the first 4G phone?
> > > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> > > _______________________________________________
> > > WiX-users mailing list
> > > WiX-users@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/wix-users
> > >
> > >
> > >
> > ----------------------------------------------------------------------------
> > --
> > > This SF.net email is sponsored by Sprint
> > > What will you do first with EVO, the first 4G phone?
> > > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> > > _______________________________________________
> > > WiX-users mailing list
> > > WiX-users@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/wix-users
> > >
> > >   
> > 
> > ----------------------------------------------------------------------------
> > --
> > This SF.net email is sponsored by Sprint
> > What will you do first with EVO, the first 4G phone?
> > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> > _______________________________________________
> > WiX-users mailing list
> > WiX-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> > 
> > 
> > ------------------------------------------------------------------------------
> > This SF.net email is sponsored by Sprint
> > What will you do first with EVO, the first 4G phone?
> > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> > _______________________________________________
> > WiX-users mailing list
> > WiX-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> 
> 
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to