Maximum waiting time for an instruction

50 views
Skip to first unread message

Otomatic

unread,
Apr 4, 2025, 9:35:23 AM4/4/25
to innosetup
Hi,
Pour exécuter une mise à jour d'un programme il est nécessaire que des services relatifs à ce programme soient arrêtés. Ceci est effectué dans l'installeur par:
Exec('net.exe', 'stop ' + ServiceToStop[Index], '', SW_HIDE, ewWaitUntilTerminated, CodErr);

In very rare cases, a service cannot be stopped and the installer waits indefinitely and the user does not know what is happening.

Would it be possible to define a maximum waiting time and display a dialog box at the end of this wait to warn the user and end the installation?
Thanks for your help.

Otomatic

unread,
Apr 4, 2025, 9:46:46 AM4/4/25
to innosetup
Sorry,
Translated, the first two lines are :
To carry out an update to a program, services relating to this program must be stopped. This is done in the installer by:

Bill Stewart

unread,
Apr 4, 2025, 11:02:18 AM4/4/25
to innosetup
On Friday, April 4, 2025 at 7:35:23 AM UTC-6 Otomatic wrote:

Would it be possible to define a maximum waiting time and display a dialog box at the end of this wait to warn the user and end the installation?
Thanks for your help.

I wrote a command-line tool called ServMan.exe that is able to stop a service and wait for it to stop up to a specified number of seconds:

ServMan servicename --stop --timeout 45

If the service stops within 45 seconds, ServMan.exe will exit with an exit code of zero. If the 45 seconds elapses and service still isn't stopped, it will return an exit code of 1053 (ERROR_SERVICE_REQUEST_TIMEOUT - English "The service did not respond to the start or control request in a timely fashion").



Otomatic

unread,
Apr 5, 2025, 5:37:55 AM4/5/25
to innosetup
Thank you very much for your time.
It works exactly the way I wanted it to!
Reply all
Reply to author
Forward
0 new messages