Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Stop services before InstallValidate

386 views
Skip to first unread message

Henning Krause [MVP - Exchange]

unread,
Jun 2, 2008, 3:26:40 AM6/2/08
to
Hello,

I'm installing some Windows Services using WIX. For that I've populated the
ServiceControl and ServiceInstall tables.

When installing an upgrade, the installer stops the services, replaces the
files and restarts the service. But since InstallValidate runs before
StopServices, the FileInUse table is populated with all the files the
services are using. Upon finishing the installation, the installer wants to
do a reboot.

How can I solve this? Should I stop the services from my setup bootstrapper
before calling the MSI?

Kind regards,
Henning Krause

Stephen Connolly

unread,
Jun 2, 2008, 6:24:14 AM6/2/08
to
The files in use dialog will generally show only locked files from
processes with a visible window, even though under the hood the 'full'
list of locked files shown in the log will include files locked by
services and other 'hidden' processes. Since the service processes
will be shut down by MSI before the files are overwritten, this is
quite appropriate.

However, if the locking process is not a service, then unless you want
to write custom actions to handle shutting down the process, you may
need to just take the hit.

You need to look through the logs to identify exactly what process is
locking your files when the installer tries to overwrite them. Just
look for the string 'in use' in the logs.

If the files are locked by a service running on the local machine,
then you need to add that service to the list of services being
controlled, by means of records in the ServiceControl table. Bear in
mind that shutting down a service may shut down dependent services,
but Windows Instaler will not restart the stopped dependencies unless
these are explicitly written to the ServiceControl table. In this
situation it might be easier to restart the machine and let the
service control manager sort out the start order for you :@); the
alternative involves enumerating all service dependencies and
dynamically authoring them into the table.

Henning Krause [MVP - Exchange]

unread,
Jun 2, 2008, 10:11:14 AM6/2/08
to
Hello Stephen,

the files are locked by the services I wish to upgrade.

The ServiceControl Table hast all three services listed with the Event
Column = 163 and Wait = 1

According to MSDN
(http://msdn.microsoft.com/en-us/library/aa371634(VS.85).aspx), 163 means:
1 = Starts the service during the StartServices action (install).
2 = Stops the service during the StopServices action (install).
32 = Stops the service during the StopServices action (uninstall).
128= Deletes the service during the DeleteServices action (uninstall).

I'm performing a major upgrade here.

Am I missing something?

Kind regards,
Henning Krause

"Stephen Connolly" <sm_s...@hotmail.com> wrote in message
news:2315d9a8-83fb-4dd8...@56g2000hsm.googlegroups.com...

Phil Wilson

unread,
Jun 2, 2008, 11:48:43 AM6/2/08
to
I don't know this for a documented fact, but I believe that Restart Manager
doesn't take account of the ServiceControl table until MSI 4.0. The Vista
MSI logs I've looked at say something about RM detecting services that will
be shutdown by ServiceControl, and I don't recall seeing anything like that
prior to MSI 4.0.
--
Phil Wilson

"Henning Krause [MVP - Exchange]" <newsgrou...@this.infinitec.de>
wrote in message news:OI8tHqLx...@TK2MSFTNGP02.phx.gbl...

Henning Krause [MVP - Exchange]

unread,
Jun 2, 2008, 1:48:22 PM6/2/08
to
Hi Phil,

so my only option here would be manually stopping the relevant services by
my setup bootstrapper?

Kind regards,
Henning Krause

"Phil Wilson" <pdjw...@nospam.cox.net> wrote in message
news:ObuqfbMx...@TK2MSFTNGP02.phx.gbl...

Phil Wilson

unread,
Jun 2, 2008, 8:14:33 PM6/2/08
to
I believe that's so, yes.

--
Phil Wilson
Definitive Guide to Windows Installer
http://www.apress.com/book/view/1590592972


"Henning Krause [MVP - Exchange]" <newsgrou...@this.infinitec.de>

wrote in message news:ehUfcjNx...@TK2MSFTNGP02.phx.gbl...

Stephen Connolly

unread,
Jun 3, 2008, 3:31:41 AM6/3/08
to
Are the locking service processes not shut down by the time
InstallFiles tries to overwrite the files. What is the problem here?
Files actually being locked or bad reporting by FilesInUse?

The FilesInUse dialog is a bit buggy IMO, as it appears to use some
kind of heuristic to guess whether a file is locked rather than
checking that it is actually locked by that process. We've had a
couple of cases where FilesInUse reports a file is locked by one
process when it is actually locked by another.

Phil Wilson

unread,
Jun 3, 2008, 12:41:00 PM6/3/08
to
I thought about that too, but the ServiceControl table entry has Wait=1, and
that means that the ServiceControl action to stop the service will not
complete until the service really is stopped. I suppose the service could be
stopped but the process still running, that's a scenario, but the
unpredictability of this type of scenario is what makes them a nuisance.

--
Phil Wilson
Definitive Guide to Windows Installer
http://www.apress.com/book/view/1590592972

"Stephen Connolly" <sm_s...@hotmail.com> wrote in message

news:bc5694c7-6df4-4765...@d77g2000hsb.googlegroups.com...

Henning Krause [MVP - Exchange]

unread,
Jun 3, 2008, 4:26:48 PM6/3/08
to
Hello,

that seems to be the case - the issue does no longer happen reproducible.

Thanks for all your help.

Kind regards,
Henning Krause

"Phil Wilson" <phil....@wonderware.something.com> wrote in message
news:O0kFciZx...@TK2MSFTNGP04.phx.gbl...

Dennis Bareis

unread,
Jun 4, 2008, 5:31:07 AM6/4/08
to
Hi,

On Mon, 2 Jun 2008 16:11:14 +0200, "Henning Krause [MVP - Exchange]" <newsgrou...@this.infinitec.de> wrote:

>the files are locked by the services I wish to upgrade.
>
>The ServiceControl Table hast all three services listed with the Event
>Column = 163 and Wait = 1
>
>According to MSDN
>(http://msdn.microsoft.com/en-us/library/aa371634(VS.85).aspx), 163 means:
>1 = Starts the service during the StartServices action (install).
>2 = Stops the service during the StopServices action (install).
>32 = Stops the service during the StopServices action (uninstall).
>128= Deletes the service during the DeleteServices action (uninstall).
>
>I'm performing a major upgrade here.

Just checking... Are they the same in the msi being replaced / uninstalled?

Bye,
Dennis

Dennis Bareis [Microsoft MVP] (dba...@KillSpam.gmail.com)
http://dennisbareis.com/
Freeware Windows Installer creation tool (+ "ORCA automation"):
http://makemsi.dennisbareis.com/

Henning Krause [MVP - Exchange]

unread,
Jun 4, 2008, 6:42:16 AM6/4/08
to
Hello Dennis,

> Just checking... Are they the same in the msi being replaced /
> uninstalled?

Yes.. all relevant services are being replaced with the update.

Kind regards,
Henning Krause

Dennis Bareis

unread,
Jun 5, 2008, 3:31:00 AM6/5/08
to
On Wed, 4 Jun 2008 12:42:16 +0200, "Henning Krause [MVP - Exchange]" <newsgrou...@this.infinitec.de> wrote:

>> Just checking... Are they the same in the msi being replaced /
>> uninstalled?
>
>Yes.. all relevant services are being replaced with the update.

I think you misunderstood, I was asking about the ServiceControl table in the msi being replaced.
Thats what matters during its uninstall.

Henning Krause [MVP - Exchange]

unread,
Jun 5, 2008, 8:07:24 AM6/5/08
to
Hello Dennis,

I've scheduled RemoveExistingProducts after InstallFinalize - so I don't see
the uninstall settings having any impact on this.

Or am I missing something here?

Kind regards,
Henning Krause

"Dennis Bareis" <dba...@newsgroups.nospam> wrote in message
news:8e5f44pfeuojs2ddk...@4ax.com...

0 new messages