Hi all,
I have an Install Script custom action that simply starts a Windows service that gets installed at the end of the installation:
This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Service doesn't get started during Repair on Vista
Started by
RothmansUA
, Jun 10 2010 14:44
2 replies to this topic
Posted 10 June 2010 - 14:44
CODE |
function ExecServiceStart(hMSI) STRING szServiceName; NUMBER nvServiceState; begin szServiceName = "MyService"; ServiceGetServiceState(szServiceName, nvServiceState); if( nvServiceState != SERVICE_RUNNING )then SERVICE_IS_PARAMS.nStartServiceWaitCount = 10; ServiceStartService(szServiceName, ""); endif; end; |
(Synchronous (Ignores exit code), Immediate Execution)
(Install Exec Sequence After ISSelfRegisterFinalize After InstallFinalize)
As log shows, the CA gets called during normal installation and at the end of Repair procedure as well.
The problem is that the service gets started OK during normal installation and is not started after Repair (although the CA gets called). I can start the service manually right after installation.
And all this happens on Vista only (on XP works fine).
I have also tried the simplified CA version:
CODE |
function ExecServiceStart(hMSI) STRING szServiceName; NUMBER nvServiceState; begin szServiceName = "MyService"; SERVICE_IS_PARAMS.nStartServiceWaitCount = 10; ServiceStartService(szServiceName, ""); end; |
Doesn't help either.
I have no idea what the reason could be.
There is a UAC elevation screen at the beginning of the Repair as well as at the beginning of the normal installation. So I assume that the Repair runs with elevated priviliges.
The CA is located at the very end of the Execute sequence, even after InstallFinalize. May be at this point the installation process doesn't run in elevated mode any more and therefore the startup fails?
Does anybody have an idea of how could I make my CA work during Repair?
Posted 10 June 2010 - 15:40
All right, got it by myself.
My CA has to be defined as Deffered in System Context (and placed before InstallFinalize for that) in order to run with elevated priviliges during Repair.
During normal installation it run in elevated mode even as "Immeditate Execute" CA since probably it was inheriting this mode from the setup.exe process.
My CA has to be defined as Deffered in System Context (and placed before InstallFinalize for that) in order to run with elevated priviliges during Repair.
During normal installation it run in elevated mode even as "Immeditate Execute" CA since probably it was inheriting this mode from the setup.exe process.
Posted 11 June 2010 - 11:29
Yes, it depends when the UAC dialog is displayed - immediately when you launch setup.exe or after the dialogs (before the file copy starts)
Stefan Krüger
InstallSite.org twitter facebook