# win32_set_service_status

(PECL win32service >=0.1.0)

win32_set_service_status — Update the service status

### 说明

win32_set_service_status ( int `$status` [, int `$checkpoint` = 0 ] ) : bool

Informs the SCM of the current status of a running service. This call is only valid for a running service process.

Caution

Since version 0.2.0, this function work only in "cli" SAPI. On other SAPI this function is disabled.

### 参数

`status`

  The service status code, one of `WIN32_SERVICE_RUNNING`, `WIN32_SERVICE_STOPPED`, `WIN32_SERVICE_STOP_PENDING`, `WIN32_SERVICE_START_PENDING`, `WIN32_SERVICE_CONTINUE_PENDING`, `WIN32_SERVICE_PAUSE_PENDING`, `WIN32_SERVICE_PAUSED`.

`checkpoint`

  The checkpoint value the service increments periodically to report its progress during a lengthy start, stop, pause, or continue operation. For example, the service should increment this value as it completes each step of its initialization when it is starting up.

  The `checkpoint` is only valid when the `status` is one of `WIN32_SERVICE_STOP_PENDING`, `WIN32_SERVICE_START_PENDING`, `WIN32_SERVICE_CONTINUE_PENDING` or `WIN32_SERVICE_PAUSE_PENDING`.

### 返回值

成功时返回 `TRUE`，参数错误时返回 `FALSE`，或失败时返回一个 Win32 错误码。

### 错误／异常

If SAPI is not "cli", this function emits an `E_ERROR` level error.

### 更新日志

版本 | 说明
--- | ---
0.2.0 | This function works only in the "cli" SAPI.

### 参见

- win32_start_service_ctrl_dispatcher() - Registers the script with the SCM, so that it can act as the service with the given name
- win32_get_last_control_message() - Returns the last control message that was sent to this service
- win32_set_service_exit_mode() - Define or return the exit mode for the current running service
- win32_set_service_exit_code() - Define or return the exit code for the current running service
- Win32Service Service Status Constants