InstallShield 2012 Spring » InstallScript Language Reference

The ServiceStopService function stops the service that is specified by szServiceName.

This function waits for the service to stop before returning; it waits indefinitely as long as the service is updating the dwCheckPoint member of the SERVICE_IS_STATUS structure at least every dwWaitHint milliseconds. To force the function to return after a specific time interval, regardless of whether the service has stopped, you can change the nStopServiceWaitCount member of the structured variable SERVICE_IS_PARAMS to the appropriate time in seconds.


ServiceStopService ( szServiceName );


ServiceStopService Parameters




Specifies the name of the service.

Return Values

ServiceStopService Return Values

Return Value



Indicates that the function stopped the service.


Indicates that the function was unable to stop the service.

If this function fails, additional error information may be available by calling GetExtendedErrInfo and checking the value of its third argument. (This value typically indicates the result of internally calling the Windows API function GetLastError after a call to a Windows API function failed.)

You can obtain the error message text associated with a large negative return value—for example, -2147024891 (0x80070005)—by calling FormatMessage.

Additional Information

See Also