diff --git a/reference/win32service/constants.xml b/reference/win32service/constants.xml
index b99fc49a8d..e3a54b2154 100644
--- a/reference/win32service/constants.xml
+++ b/reference/win32service/constants.xml
@@ -127,6 +127,18 @@
Notifies a paused service that it should resume.
+
+ WIN32_SERVICE_CONTROL_DEVICEEVENT
+ 0x0000000B
+
+
+
+
+ WIN32_SERVICE_CONTROL_HARDWAREPROFILECHANGE
+ 0x0000000C
+
+
+ WIN32_SERVICE_CONTROL_INTERROGATE0x00000004
@@ -135,6 +147,41 @@
to the service control manager.
+
+ WIN32_SERVICE_CONTROL_NETBINDADD
+ 0x00000007
+
+ Notifies a network service that there is a new component for binding.
+
+
+
+ WIN32_SERVICE_CONTROL_NETBINDDISABLE
+ 0x0000000A
+
+ Notifies a network service that one of its bindings has been disabled.
+
+
+
+ WIN32_SERVICE_CONTROL_NETBINDENABLE
+ 0x00000009
+
+ Notifies a network service that a disabled binding has been enabled.
+
+
+
+ WIN32_SERVICE_CONTROL_NETBINDREMOVE
+ 0x00000008
+
+ Notifies a network service that a component for binding has been removed.
+
+
+
+ WIN32_SERVICE_CONTROL_PARAMCHANGE
+ 0x00000006
+
+ Notifies a service that its startup parameters have changed.
+
+ WIN32_SERVICE_CONTROL_PAUSE0x00000002
@@ -142,6 +189,12 @@
Notifies a service that it should pause.
+
+ WIN32_SERVICE_CONTROL_POWEREVENT
+ 0x0000000D
+
+
+ WIN32_SERVICE_CONTROL_PRESHUTDOWN0x0000000F
@@ -152,6 +205,12 @@
by Windows Server 2003 and Windows XP/2000.
+
+ WIN32_SERVICE_CONTROL_SESSIONCHANGE
+ 0x0000000E
+
+
+ WIN32_SERVICE_CONTROL_SHUTDOWN0x00000005
@@ -186,6 +245,38 @@
+
+ WIN32_SERVICE_ACCEPT_HARDWAREPROFILECHANGE
+ 0x00000020
+
+ The service is notified when the computer's hardware profile has changed.
+ This enables the system to send
+ WIN32_SERVICE_CONTROL_HARDWAREPROFILECHANGE
+ notifications to the service.
+
+
+
+ WIN32_SERVICE_ACCEPT_NETBINDCHANGE
+ 0x00000010
+
+ The service is a network component that can accept changes in its
+ binding without being stopped and restarted.
+ This control code allows the service to receive
+ WIN32_SERVICE_CONTROL_NETBINDADD,
+ WIN32_SERVICE_CONTROL_NETBINDREMOVE,
+ WIN32_SERVICE_CONTROL_NETBINDENABLE, and
+ WIN32_SERVICE_CONTROL_NETBINDDISABLE notifications.
+
+
+
+ WIN32_SERVICE_ACCEPT_PARAMCHANGE
+ 0x00000008
+
+ The service can reread its startup parameters without being stopped and restarted.
+ This control code allows the service to receive
+ WIN32_SERVICE_CONTROL_PARAMCHANGE notifications.
+
+ WIN32_SERVICE_ACCEPT_PAUSE_CONTINUE0x00000002
@@ -195,6 +286,16 @@
WIN32_SERVICE_CONTROL_CONTINUE notifications.
+
+ WIN32_SERVICE_ACCEPT_POWEREVENT
+ 0x00000040
+
+ The service is notified when the computer's power status has changed.
+ This enables the system to send
+ WIN32_SERVICE_CONTROL_POWEREVENT notifications
+ to the service.
+
+ WIN32_SERVICE_ACCEPT_PRESHUTDOWN0x00000100
@@ -205,6 +306,17 @@
Windows XP/2000.
+
+ WIN32_SERVICE_ACCEPT_SESSIONCHANGE
+ 0x00000080
+
+ The service is notified when the computer's session status has changed.
+ This enables the system to send
+ WIN32_SERVICE_CONTROL_SESSIONCHANGE notifications
+ to the service.
+ Windows 2000: This value is not supported
+
+ WIN32_SERVICE_ACCEPT_SHUTDOWN0x00000004
@@ -222,6 +334,28 @@
receive WIN32_SERVICE_CONTROL_STOP notifications.
+
+ WIN32_SERVICE_ACCEPT_TIMECHANGE
+ 0x00000200
+
+ The service is notified when the system time has changed.
+ This enables the system to send
+ WIN32_SERVICE_CONTROL_TIMECHANGE notifications to the service.
+ Windows Server 2008, Windows Vista, Windows Server 2003,
+ and Windows XP/2000: This control code is not supported.
+
+
+
+ WIN32_SERVICE_ACCEPT_TRIGGEREVENT
+ 0x00000400
+
+ The service is notified when an event for which the service has registered occurs.
+ This enables the system to send
+ WIN32_SERVICE_CONTROL_TRIGGEREVENT notifications to the service.
+ Windows Server 2008, Windows Vista, Windows Server 2003,
+ and Windows XP/2000: This control code is not supported.
+
+
@@ -239,6 +373,20 @@
+
+ WIN32_SERVICE_BOOT_START
+ 0x00000000
+
+ A device driver started by the system loader. This value is valid only for driver services.
+
+
+
+ WIN32_SERVICE_SYSTEM_START
+ 0x00000001
+
+ A device driver started by the IoInitSystem function. This value is valid only for driver services.
+
+ WIN32_SERVICE_AUTO_START0x00000002
@@ -295,6 +443,26 @@
startup operation.
+
+ WIN32_SERVICE_ERROR_SEVERE
+ 0x00000002
+
+ The startup program logs the error in the event log.
+ If the last-known-good configuration is being started, the startup
+ operation continues. Otherwise, the system is restarted with the
+ last-known-good configuration.
+
+
+
+ WIN32_SERVICE_ERROR_CRITICAL
+ 0x00000003
+
+ The startup program logs the error in the event log, if possible.
+ If the last-known-good configuration is being started, the startup
+ operation fails. Otherwise, the system is restarted with the
+ last-known good configuration.
+
+
@@ -554,6 +722,13 @@
The system is shutting down; this function cannot be called.
+
+ WIN32_ERROR_SERVICE_SPECIFIC_ERROR
+ 0x0000042A
+
+ The service has returned a service-specific error code.
+
+ WIN32_NO_ERROR0x00000000
@@ -640,6 +815,70 @@
+
+
+
+ &reftitle.errors;
+
+ If SAPI is not "cli", this function emits an E_ERROR level error.
+
+
&reftitle.changelog;
@@ -70,6 +77,8 @@
win32_start_service_ctrl_dispatcherwin32_set_service_status
+ win32_set_service_exit_mode
+ win32_set_service_exit_codeWin32Service Service Control Message Constants
diff --git a/reference/win32service/functions/win32-pause-service.xml b/reference/win32service/functions/win32-pause-service.xml
index 4c75b12f71..d14eebc5de 100644
--- a/reference/win32service/functions/win32-pause-service.xml
+++ b/reference/win32service/functions/win32-pause-service.xml
@@ -82,6 +82,7 @@
win32_start_servicewin32_stop_servicewin32_continue_service
+ win32_send_custom_controlWin32 Error Codes
diff --git a/reference/win32service/functions/win32-query-service-status.xml b/reference/win32service/functions/win32-query-service-status.xml
index 7a8b40a0a3..1b6b0b6418 100644
--- a/reference/win32service/functions/win32-query-service-status.xml
+++ b/reference/win32service/functions/win32-query-service-status.xml
@@ -79,7 +79,11 @@
Win32ExitCode
- If the service exited, the return code from the process.
+ If the service exited, the return code from the process. This value is equal to
+ WIN32_ERROR_SERVICE_SPECIFIC_ERROR
+ if the exit mode is not gracefuly. See
+ Win32Service error codes and
+ win32_set_service_exit_mode
@@ -88,7 +92,8 @@
If the service exited with an error condition, the service specific
- code that is logged in the event log is visible here.
+ code that is logged in the event log is visible here. This value is equal
+ to the value defined by win32_set_service_exit_code
diff --git a/reference/win32service/functions/win32-send-custom-control.xml b/reference/win32service/functions/win32-send-custom-control.xml
new file mode 100644
index 0000000000..1f4dbdc0f6
--- /dev/null
+++ b/reference/win32service/functions/win32-send-custom-control.xml
@@ -0,0 +1,102 @@
+
+
+
+
+
+ win32_send_custom_control
+ Send a custom control to the service
+
+
+
+ &reftitle.description;
+
+ intwin32_send_custom_control
+ stringservicename
+ intcontrol
+ stringmachine
+
+
+
+ See Microsoft ControlService function for more details
+
+
+
+
+
+ &reftitle.parameters;
+
+
+ servicename
+
+
+ The short name of the service.
+
+
+
+
+ control
+
+
+ The custom contole value between 128 and 255.
+
+
+
+
+ machine
+
+
+ Optional machine name. If omitted, the local machine is used.
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ &win32service.noerror.false.error;
+
+
+
+
+ &reftitle.errors;
+
+ If the control value is not between 128 and 255, this function emits an
+ E_ERROR level error.
+
+
+
+
+ &reftitle.seealso;
+
+ win32_start_service
+ win32_stop_service
+ win32_pause_service
+ win32_continue_service
+ Win32 Error Codes
+
+
+
+
+
+
\ No newline at end of file
diff --git a/reference/win32service/functions/win32-set-service-exit-code.xml b/reference/win32service/functions/win32-set-service-exit-code.xml
new file mode 100644
index 0000000000..84946a27ed
--- /dev/null
+++ b/reference/win32service/functions/win32-set-service-exit-code.xml
@@ -0,0 +1,91 @@
+
+
+
+
+
+ win32_set_service_exit_code
+ Define or return the exit code for the current running service
+
+
+
+ &reftitle.description;
+
+ intwin32_set_service_exit_code
+ intexitCode1
+
+
+ Change or return the exit code. The exit code is used only if the exit mode is not graceful.
+ If the value is not zero, the recovery configuration can be used after
+ service fail. See
+ Microsoft system error codes
+ for more details
+
+
+
+
+ This function work only in "cli" SAPI. On other SAPI
+ this function is disabled.
+
+
+
+
+
+ &reftitle.parameters;
+
+
+ exitCode
+
+
+ The return code used on exit.
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Return the current or old exit code.
+
+
+
+
+ &reftitle.errors;
+
+ If SAPI is not "cli", this function emits an
+ E_ERROR level error.
+
+
+
+
+ &reftitle.seealso;
+
+ win32_start_service_ctrl_dispatcher
+ win32_set_service_status
+ win32_set_service_exit_mode
+
+
+
+
+
+
\ No newline at end of file
diff --git a/reference/win32service/functions/win32-set-service-exit-mode.xml b/reference/win32service/functions/win32-set-service-exit-mode.xml
new file mode 100644
index 0000000000..594395e62f
--- /dev/null
+++ b/reference/win32service/functions/win32-set-service-exit-mode.xml
@@ -0,0 +1,89 @@
+
+
+
+
+
+ win32_set_service_exit_mode
+ Define or return the exit mode for the current running service
+
+
+
+ &reftitle.description;
+
+ boolwin32_set_service_exit_mode
+ boolgracefulModetrue
+
+
+ If gracefulMode parameter is provided, the exit mode
+is changed. When the exit mode is not gracefuly, the exit code used can be set
+with the win32_set_service_exit_code function.
+
+
+
+
+ This function work only in "cli" SAPI. On other SAPI
+ this function is disabled.
+
+
+
+
+
+ &reftitle.parameters;
+
+
+ gracefulMode
+
+
+ &true; for exit graceful. &false; for exit with error.
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Return the current or old exit mode.
+
+
+
+
+ &reftitle.errors;
+
+ If SAPI is not "cli", this function emits an
+ E_ERROR level error.
+
+
+
+
+ &reftitle.seealso;
+
+ win32_start_service_ctrl_dispatcher
+ win32_set_service_status
+ win32_set_service_exit_code
+
+
+
+
+
+
\ No newline at end of file
diff --git a/reference/win32service/functions/win32-set-service-status.xml b/reference/win32service/functions/win32-set-service-status.xml
index 7505104c13..263778585b 100644
--- a/reference/win32service/functions/win32-set-service-status.xml
+++ b/reference/win32service/functions/win32-set-service-status.xml
@@ -74,6 +74,13 @@
&win32service.success.false.error;
+
+
+ &reftitle.errors;
+
+ If SAPI is not "cli", this function emits an E_ERROR level error.
+
+
&reftitle.changelog;
@@ -105,6 +112,8 @@
win32_start_service_ctrl_dispatcherwin32_get_last_control_message
+ win32_set_service_exit_mode
+ win32_set_service_exit_codeWin32Service Service Status Constants
diff --git a/reference/win32service/functions/win32-start-service-ctrl-dispatcher.xml b/reference/win32service/functions/win32-start-service-ctrl-dispatcher.xml
index 3bf230e8ae..70cf5c4d98 100644
--- a/reference/win32service/functions/win32-start-service-ctrl-dispatcher.xml
+++ b/reference/win32service/functions/win32-start-service-ctrl-dispatcher.xml
@@ -11,6 +11,7 @@
mixedwin32_start_service_ctrl_dispatcherstringname
+ boolgracefulModetrue
@@ -53,6 +54,15 @@
+
+ gracefulMode
+
+
+ &true; for exit graceful. &false; for exit with error. See
+ win32_set_service_exit_mode for more details.
+
+
+
@@ -64,6 +74,13 @@
+
+ &reftitle.errors;
+
+ If SAPI is not "cli", this function emits an E_ERROR level error.
+
+
+
&reftitle.examples;
@@ -108,6 +125,12 @@ while (WIN32_SERVICE_CONTROL_STOP != win32_get_last_control_message()) {
+
+ 0.4.0
+
+ The parameter gracefulMode has been added.
+
+ 0.2.0
@@ -126,6 +149,8 @@ while (WIN32_SERVICE_CONTROL_STOP != win32_get_last_control_message()) {
win32_set_service_statuswin32_get_last_control_message
+ win32_set_service_exit_mode
+ win32_set_service_exit_codeWin32 Error Codes
diff --git a/reference/win32service/functions/win32-start-service.xml b/reference/win32service/functions/win32-start-service.xml
index d06272e7fc..42989c173c 100644
--- a/reference/win32service/functions/win32-start-service.xml
+++ b/reference/win32service/functions/win32-start-service.xml
@@ -82,6 +82,7 @@
win32_stop_servicewin32_pause_servicewin32_continue_service
+ win32_send_custom_controlWin32 Error Codes
diff --git a/reference/win32service/functions/win32-stop-service.xml b/reference/win32service/functions/win32-stop-service.xml
index 86cb9bbfea..ec087bcb56 100644
--- a/reference/win32service/functions/win32-stop-service.xml
+++ b/reference/win32service/functions/win32-stop-service.xml
@@ -82,6 +82,7 @@
win32_start_servicewin32_pause_servicewin32_continue_service
+ win32_send_custom_controlWin32 Error Codes
diff --git a/reference/win32service/versions.xml b/reference/win32service/versions.xml
index 2837f45e93..574f47e255 100644
--- a/reference/win32service/versions.xml
+++ b/reference/win32service/versions.xml
@@ -4,16 +4,19 @@
Do NOT translate this file
-->
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+