[wix-users] FilesInUse event

Hoover, Jacob Jacob.Hoover at greenheck.com
Tue Oct 24 13:54:33 PDT 2017


You could write a CA that could scan for known running processes and then schedule it deferred, and if a process is found then invoke MsiProcessMessage to give the user an option to abort/retry/ignore.

https://msdn.microsoft.com/en-us/library/windows/desktop/aa370354(v=vs.85).aspx

MsiProcessMessage(hInstall, 
                  INSTALLMESSAGE(INSTALLMESSAGE_ERROR|MB_ABORTRETRYIGNORE|MB_ICONWARNING),
                  hRec);

Note, don't use a message box directly from the CA, as that could block on silent transactions.

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Blair Murri via wix-users
Sent: Tuesday, October 24, 2017 2:54 PM
To: Roland K via wix-users <wix-users at lists.wixtoolset.org>
Cc: Blair Murri <osito at live.com>
Subject: Re: [wix-users] FilesInUse event

Always reboot if you detect one of your applications running?



Sent from my Windows 10 phone



From: Roland K via wix-users<mailto:wix-users at lists.wixtoolset.org>
Sent: Monday, October 23, 2017 12:54 AM
To: Hoover, Jacob<mailto:Jacob.Hoover at greenheck.com>
Cc: Roland K<mailto:rolandkieslinger at gmail.com>; WiX Toolset Users Mailing List<mailto:wix-users at lists.wixtoolset.org>
Subject: Re: [wix-users] FilesInUse event



Thank you!

But as I said, it's impossible to automatically close our apps. There are some older apps, where a user can type in a lot of data in several hours without saving it. If we then have to close the app automatically, we don't know, which data he really wants to save and how he wants it to be saved.

I know we could implement something to save the data temporarily, but some apps are very old, and that would be too much work.

2017-10-19 17:21 GMT+02:00 Hoover, Jacob <Jacob.Hoover at greenheck.com>:

>   Register you applications with the restart manager. Use 
> util:CloseApplication to close the applications before installing an 
> upgrade.  Implement logic in your applications to respond to 
> WM_QUERYENDSESSION/WM_ENDSESSION.
>
>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On 
> Behalf Of Roland K via wix-users
> Sent: Thursday, October 19, 2017 4:25 AM
> To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
> Cc: Roland K <rolandkieslinger at gmail.com>
> Subject: Re: [wix-users] FilesInUse event
>
> I didn't know about the two different file lock types, so thanks for 
> explaining!
>
> Let me clarify my intent: If somebody tries to update an existing 
> installation and there are still apps started, which should be getting 
> updated, then I want the user to close the apps. This should release 
> the file locks, whatever they are soft or hard. To achieve this, I 
> thought I can use the "FilesInUse" event to get the locked files/apps 
> and then be able to notify the user. I can't close the apps 
> programmatically for various reasons.
>
> Is there another way to detect if there are some files soft/hard 
> locked, so I can notify the user and tell him, which apps he has to 
> close to continue with the update? Or can I change the behaviour of 
> the msi installation, to get the event raised on both lock types?
>
> There's one thing, I don't understand: I have a virtual machine with 
> only win 10 installed. If I install our setup and try an update on 
> that, I get the FileInUse event raised in about 20-30 % of the time. 
> So I really try to do the same on every test (resetting the virtual 
> machine to a checkpoint before), but sometimes I get the event, and sometimes not.
>
> 2017-10-18 19:17 GMT+02:00 Blair Murri via wix-users <
> wix-users at lists.wixtoolset.org>:
>
> > In Windows, there are basically two kinds of in-use file locks: soft 
> > (the file can be moved and deleted during next reboot) and hard 
> > (can't). If the file is soft-locked, then only that process needs to 
> > be recycled, not the entire system, thus eliminating the dreaded reboot.
> >
> >
> >
> > MSI does what it can to avoid reboots, because of the negative 
> > effect they have on customer satisfaction. If the file is 
> > hard-locked, the new version of the file will be written to a 
> > temporary location and will only replace the old file during the 
> > next reboot, while soft-locks allow for inplace replacement, where 
> > removal of the old file isn't critical. Thus, only hard-locks will 
> > result in FilesInUse
> prompts.
> >
> >
> >
> > If you need to ensure that your application processes are recycled 
> > during upgrades, it's recommend you register them with the restart 
> > manager (services should already be authored in such a way as to 
> > already be stopped and started as part of the upgrade sequence). WiX 
> > includes support for this registration.
> >
> >
> >
> > Blair Murri
> >
> >
> >
> > Sent from my Windows 10 phone
> >
> >
> >
> > From: Roland K via wix-users<mailto:wix-users at lists.wixtoolset.org>
> > Sent: Wednesday, October 11, 2017 6:52 AM
> > To:
> > wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org
> > >
> > Cc: Roland K<mailto:rolandkieslinger at gmail.com>
> > Subject: Re: [wix-users] FilesInUse event
> >
> >
> >
> > I found the following lines in the log:
> >
> > Aktion gestartet um 15:38:27: InstallValidate.
> > MSI (s) (DC:90) [15:38:27:724]: PROPERTY CHANGE: Deleting 
> > MsiRestartManagerSessionKey property. Its current value is 
> > '3c5e7e74b929e943bf1e2d63080c406c'.
> > ...
> > MSI (s) (DC:90) [15:38:32:404]: RESTART MANAGER: Did detect that a 
> > critical application holds file[s] in use, so a reboot will be necessary.
> > ...
> > Aktion gestartet um 15:38:35: RemoveExistingProducts. *(old msi is 
> > getting started - I'm doing MajorUpgrades with
> > Schedule="afterInstallInitialize")*
> > *...*
> > Aktion gestartet um 15:38:36: InstallValidate.
> > MSI (s) (DC:48) [15:38:36:696]: PROPERTY CHANGE: Deleting 
> > MsiRestartManagerSessionKey property. Its current value is 
> > 'f9337d59ae6e2247a247bae8eec8a76f'.
> > ...
> > MSI (s) (DC:48) [15:38:38:347]: RESTART MANAGER: Did detect that a 
> > critical application holds file[s] in use, so a reboot will be necessary.
> > ...
> > MSI (s) (DC:48) [15:38:48:084]: PROPERTY CHANGE: Adding 
> > ReplacedInUseFiles property. Its value is '1'.
> > MSI (s) (DC:48) [15:38:48:085]: PROPERTY CHANGE: Deleting 
> > UpdateStarted property. Its current value is '1'.
> > Aktion beendet um 15:38:48: InstallFinalize. Rückgabewert 1.
> >
> >
> > As we see here, the installer detected the replaced files, shouldn't 
> > it then raise the "FilesInUse" event in the parents bootstrapper?
> >
> > 2017-10-11 15:18 GMT+02:00 Roland K <rolandkieslinger at gmail.com>:
> >
> > > I have a custom bootstrapper with a msi inside.
> > >
> > > If I wanna update an existing installation, but there's still an 
> > > application open (or a file in use) which should be replaced, I 
> > > wanna
> > show
> > > a dialog, so the user can decide if he wants to retry, ignore or 
> > > cancel
> > it.
> > > Sometimes the "FilesInUse" event of BootstrapperApplication gets 
> > > raised
> > so
> > > I can show the dialog, but sometimes NOT.
> > >
> > > Why?
> > >
> > > What can be the reasons the event is not raised?
> > >
> > > Thanks in advance!
> > >
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant 
> > http://www.firegiant.com/
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant 
> > http://www.firegiant.com/
> >
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant 
> http://www.firegiant.com/
>

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/



More information about the wix-users mailing list