document win32 service extension

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@196256 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Wez Furlong 2005-09-17 16:26:44 +00:00
parent e0fe293930
commit 6e04852458
11 changed files with 1562 additions and 0 deletions

View file

@ -0,0 +1,444 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.1 $ -->
<!-- Generated by xml_proto.php v2.3. Found in /scripts directory of phpdoc. -->
<section id="win32service.constants">
&reftitle.constants;
&extension.constants;
<variablelist>
<varlistentry>
<term>
<constant>WIN32_SERVICE_CONTROL_CONTINUE</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_CONTROL_INTERROGATE</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_CONTROL_PAUSE</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_CONTROL_STOP</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_CONTROL_HARDWAREPROFILECHANGE</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_CONTROL_POWEREVENT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_CONTROL_SESSIONCHANGE</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_ERROR_CALL_NOT_IMPLEMENTED</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_NO_ERROR</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_RUNNING</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_STOPPED</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_STOP_PENDING</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_WIN32_OWN_PROCESS</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_INTERACTIVE_PROCESS</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_STOPPED</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_START_PENDING</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_STOP_PENDING</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_RUNNING</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_CONTINUE_PENDING</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_PAUSE_PENDING</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_PAUSED</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_ACCEPT_NETBINDCHANGE</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_ACCEPT_PARAMCHANGE</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_ACCEPT_PAUSE_CONTINUE</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_ACCEPT_SHUTDOWN</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_ACCEPT_STOP</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_ACCEPT_HARDWAREPROFILECHANGE</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_ACCEPT_POWEREVENT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_ACCEPT_SESSIONCHANGE</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_FILE_SYSTEM_DRIVER</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_KERNEL_DRIVER</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_WIN32_SHARE_PROCESS</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>WIN32_SERVICE_RUNS_IN_SYSTEM_PROCESS</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
</variablelist>
</section>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,8 @@
&reference.win32service.functions.win32-create-service;
&reference.win32service.functions.win32-delete-service;
&reference.win32service.functions.win32-get-last-control-message;
&reference.win32service.functions.win32-query-service-status;
&reference.win32service.functions.win32-set-service-status;
&reference.win32service.functions.win32-start-service-ctrl-dispatcher;
&reference.win32service.functions.win32-start-service;
&reference.win32service.functions.win32-stop-service;

View file

@ -0,0 +1,202 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- Generated by xml_proto.php v2.3. Found in /scripts directory of phpdoc. -->
<refentry id="function.win32-create-service">
<refnamediv>
<refname>win32_create_service</refname>
<refpurpose>Creates a new service entry in the SCM database</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>long</type><methodname>win32_create_service</methodname>
<methodparam><type>array</type><parameter>details</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>machine</parameter></methodparam>
</methodsynopsis>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>details</parameter></term>
<listitem>
<para>
An array of service details:
<variablelist>
<varlistentry>
<term><parameter>service</parameter></term>
<listitem>
<para>The short name of the service. This is the name that you
will use to control the service using the <literal>net</literal>
command. The service must be unique (no two services can share the
same name), and, ideally, should avoid having spaces in the name.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>display</parameter></term>
<listitem>
<para>The display name of the service. This is the name that you
will see in the Services Applet.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>user</parameter></term>
<listitem>
<para>
The name of the user account under which you want the service to
run. If omitted, the service will run as the LocalSystem account.
If the username is specified, you must also provide a password.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>password</parameter></term>
<listitem>
<para>
The password the corresponds to the <parameter>user</parameter>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>path</parameter></term>
<listitem>
<para>
The full path to the executable module that will be launched when
the service is started. If omitted, the path to the current PHP
process will be used.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>params</parameter></term>
<listitem>
<para>
Command line parameters to pass to the service when it starts.
If you want to run a PHP script as the service, then the first
parameter should be the full path to the PHP script that you intend
to run.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>load_order</parameter></term>
<listitem>
<para>
Controls the load_order. This is not yet fully supported.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>svc_type</parameter></term>
<listitem>
<para>
Sets the service type. If omitted, the default value is
<constant>WIN32_SERVICE_WIN32_OWN_PROCESS</constant>.
Don't change this unless you know what you're doing.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>start_type</parameter></term>
<listitem>
<para>
Specifies how the service should be started. The default is
<constant>WIN32_SERVICE_AUTO_START</constant> which means the the
service will be launched when the machine starts up.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>error_control</parameter></term>
<listitem>
<para>
Informs the SCM what it should do when it detects a problem with
the service. The default is
<constant>WIN32_SERVER_ERROR_IGNORE</constant>. Changing this
value is not yet fully supported.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>machine</parameter></term>
<listitem>
<para>
The optional machine name on which you want to create a service.
If omitted, it will use the local machine.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; on success, otherwise returns a win32 error code.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>win32_create_service</function> example</title>
<para>
Any text that describes the purpose of the example, or
what goes on in the example should go here (inside the
<programlisting role="php">
<![CDATA[
<?php
$x = win32_create_service(array(
'service' => 'dummyphp',
'display' => 'sample dummy PHP service',
'params' => __FILE__ . ' run',
));
debug_zval_dump($x);
?>
]]>
</programlisting>
</para>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>win32_delete_service</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- Generated by xml_proto.php v2.3. Found in /scripts directory of phpdoc. -->
<refentry id="function.win32-delete-service">
<refnamediv>
<refname>win32_delete_service</refname>
<refpurpose>Deletes a service entry from the SCM database</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>long</type><methodname>win32_delete_service</methodname>
<methodparam><type>string</type><parameter>servicename</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>machine</parameter></methodparam>
</methodsynopsis>
<para>
Attempts to delete a service from the SCM database. Administrative
privileges are required for this to succeed.
</para>
<para>
This function really just marks the service for deletion. If other
processes (such as the Services Applet) are open, then the deletion will be
deferred until those applications are closed. If a service is marked for
deletion, further attempts to delete it will fail, and attempts to create a
new service with that name will also fail.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>servicename</parameter></term>
<listitem>
<para>
The short name of the service.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>machine</parameter></term>
<listitem>
<para>
The optional machine name. If omitted, the local machine will be used.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; on success, or a win32 error code on failure.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>win32_delete_service</function> example</title>
<para>
Deletes the dummyphp service.
</para>
<programlisting role="php">
<![CDATA[
<?php
win32_delete_service('dummyphp');
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<!-- refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>win32_strerror</function></member>
</simplelist>
</para>
</refsect1 -->
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.win32-get-last-control-message">
<refnamediv>
<refname>win32_get_last_control_message</refname>
<refpurpose>Returns the last control message that was sent to this service</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>long</type><methodname>win32_get_last_control_message</methodname>
<void/>
</methodsynopsis>
<para>
Returns the control code that was last sent to this service process.
When running as a service you should periodically check this to determine if
your service needs to stop running.
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a control constant; one of <constant>WIN32_SERVICE_CONTROL_CONTINUE</constant>,
<constant>WIN32_SERVICE_CONTROL_INTERROGATE</constant>,
<constant>WIN32_SERVICE_CONTROL_PAUSE</constant>,
<constant>WIN32_SERVICE_CONTROL_STOP</constant>,
<constant>WIN32_SERVICE_CONTROL_HARDWAREPROFILECHANGE</constant>,
<constant>WIN32_SERVICE_CONTROL_POWEREVENT</constant>,
<constant>WIN32_SERVICE_CONTROL_SESSIONCHANGE</constant>.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>win32_start_service_ctrl_dispatcher</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,238 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- Generated by xml_proto.php v2.3. Found in /scripts directory of phpdoc. -->
<refentry id="function.win32-query-service-status">
<refnamediv>
<refname>win32_query_service_status</refname>
<refpurpose>Queries the status of a service</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>win32_query_service_status</methodname>
<methodparam><type>string</type><parameter>servicename</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>machine</parameter></methodparam>
</methodsynopsis>
<para>
Queries the current status for a service, returning an array of
information.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>servicename</parameter></term>
<listitem>
<para>
The short name of the service.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>machine</parameter></term>
<listitem>
<para>
The optional machine name. If omitted, the local machine will be used.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &false; on failure, otherwise returns an array consisting of the
following information:
</para>
<para>
<variablelist>
<varlistentry>
<term><parameter>ServiceType</parameter></term>
<listitem>
<para>
The dwServiceType.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>CurrentState</parameter></term>
<listitem>
<para>
The dwCurrentState.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>ControlsAccepted</parameter></term>
<listitem>
<para>
Which service controls are accepted by the service.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>Win32ExitCode</parameter></term>
<listitem>
<para>
If the service exited, the return code from the process.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>ServiceSpecificExitCode</parameter></term>
<listitem>
<para>
If the service exited with an error condition, the service specific
code that is logged in the event log is visible here.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>CheckPoint</parameter></term>
<listitem>
<para>
If the service is shutting down, holds the current check point number.
This is used by the SCM as a kind of heart-beat to detect a wedged service
process. The value of the check point is best interpreted in
conjunction with the WaitHint value.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>WaitHint</parameter></term>
<listitem>
<para>
If the service is shutting down it will set WaitHint to a checkpoint
value that will indicate 100% completion. This can be used to
implement a progress indicator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>ProcessId</parameter></term>
<listitem>
<para>
The windows process identifier. If 0, the process is not running.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>ServiceFlags</parameter></term>
<listitem>
<para>
The dwServiceFlags.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<!-- Use when EXCEPTIONS exist
<refsect1 role="exceptions">
&reftitle.exceptions;
<para>
When does this function throw exceptions?
</para>
</refsect1>
-->
<!-- Use when a CHANGELOG exists
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>Enter the PHP version of change here</entry>
<entry>Description of change</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
-->
<!-- Use when examples exist
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>win32_query_service_status</function> example</title>
<para>
Any text that describes the purpose of the example, or
what goes on in the example should go here (inside the
<example> tag, not out
</para>
<programlisting role="php">
<![CDATA[
<?php
if ($anexample === true) {
echo 'Use the PEAR Coding Standards';
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Use the PEAR Coding Standards
]]>
</screen>
</example>
</para>
</refsect1>
-->
<!-- Use when adding See Also links
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function></function></member>
<member>Or <link linkend="somethingelse">something else</link></member>
</simplelist>
</para>
</refsect1>
-->
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- Generated by xml_proto.php v2.3. Found in /scripts directory of phpdoc. -->
<refentry id="function.win32-set-service-status">
<refnamediv>
<refname>win32_set_service_status</refname>
<refpurpose>Update the service status</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>win32_set_service_status</methodname>
<methodparam><type>int</type><parameter>status</parameter></methodparam>
</methodsynopsis>
<para>
Informs the SCM of the current status of a running service.
This call is only valid for a running service process.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>status</parameter></term>
<listitem>
<para>
The service status code, one of
<constant>WIN32_SERVICE_RUNNING</constant>,
<constant>WIN32_SERVICE_STOPPED</constant>,
<constant>WIN32_SERVICE_STOP_PENDING</constant>,
<constant>WIN32_SERVICE_START_PENDING</constant>,
<constant>WIN32_SERVICE_CONTINUE_PENDING</constant>,
<constant>WIN32_SERVICE_PAUSE_PENDING</constant>,
<constant>WIN32_SERVICE_PAUSED</constant>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>win32_start_service_ctrl_dispatcher</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- Generated by xml_proto.php v2.3. Found in /scripts directory of phpdoc. -->
<refentry id="function.win32-start-service-ctrl-dispatcher">
<refnamediv>
<refname>win32_start_service_ctrl_dispatcher</refname>
<refpurpose>Registers the script with the SCM, so that it can act as the service with the given name</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>win32_start_service_ctrl_dispatcher</methodname>
<methodparam><type>string</type><parameter>name</parameter></methodparam>
</methodsynopsis>
<para>
When launched via the Service Control Manager, a service process is
required to "check-in" with it to establish service monitoring and
communication facilities. This function performs the check-in by spawning
a thread to handle the lower-level communication with the service control
manager.
</para>
<para>
Once started, the service process should continue to check-in with the
service control manager so that it can determine if it should terminate.
This is achieved by periodically calling
<function>win32_get_last_control_message</function> and handling the return
code appropriately.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>
The short-name of the service, as registered by
<function>win32_create_service</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>win32_start_service_ctrl_dispatcher</function> example</title>
<para>
Any text that describes the purpose of the example, or
what goes on in the example should go here (inside the
</para>
<programlisting role="php">
<![CDATA[
<?php
if (!win32_start_service_ctrl_dispatcher('dummyphp')) {
die("I'm probably not running under the service control manager");
}
while (WIN32_SERVICE_CONTROL_STOP != win32_get_last_control_message()) {
# do some work here, trying not to take more than around 30 seconds
# before coming back into the loop again
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>win32_get_last_control_message</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- Generated by xml_proto.php v2.3. Found in /scripts directory of phpdoc. -->
<refentry id="function.win32-start-service">
<refnamediv>
<refname>win32_start_service</refname>
<refpurpose>Starts a service</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>long</type><methodname>win32_start_service</methodname>
<methodparam><type>string</type><parameter>servicename</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>machine</parameter></methodparam>
</methodsynopsis>
<para>
Attempts to start the named service. Usually requires administrative
privileges.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>servicename</parameter></term>
<listitem>
<para>
The short name of the service.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>machine</parameter></term>
<listitem>
<para>
Optional machine name. If omitted, the local machine is used.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <constant>WIN32_NO_ERROR</constant> on success, or some other win32
error code on failure.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>win32_stop_service</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- Generated by xml_proto.php v2.3. Found in /scripts directory of phpdoc. -->
<refentry id="function.win32-stop-service">
<refnamediv>
<refname>win32_stop_service</refname>
<refpurpose>Stops a service</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>long</type><methodname>win32_stop_service</methodname>
<methodparam><type>string</type><parameter>servicename</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>machine</parameter></methodparam>
</methodsynopsis>
<para>
Stops a named service. Requires administrative privileges.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>servicename</parameter></term>
<listitem>
<para>
The short name of the service.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>machine</parameter></term>
<listitem>
<para>
Optional machine name. If omitted, the local machine is used.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <constant>WIN32_NO_ERROR</constant> on success, or a win32 error
code on failure.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>win32_start_service</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- Purpose: -->
<!-- Membership: -->
<!-- Generated by xml_proto.php v2.3. Found in /scripts directory of phpdoc. -->
<reference id="ref.win32service">
<title>win32service Functions</title>
<titleabbrev>win32service</titleabbrev>
<partintro>
<section id="win32service.intro">
&reftitle.intro;
<para>
The win32service extension is a Windows specific extension that allows PHP
to communicate with the Service Control Manager to start, stop, register
and unregister extensions, and even allows your PHP scripts to run as a
service.
</para>
</section>
<section id="win32service.requirements">
&reftitle.required;
<para>
Windows NT, Windows 2000, Windows XP or Windows Server 2003. Any version
of windows derived from Windows NT should be compatible.
</para>
</section>
<section id="win32service.install">
&reftitle.install;
<procedure id="win32service.install-from-pecl">
<title>Installing from PECL</title>
<step>
<para>
You can download php_win32service.dll from http://snaps.php.net/win32/.
Choose the PECL_X_X folder that matches you PHP version.
</para>
</step>
<step>
<para>
Copy the php_win32service.dll into you <link
linkend="ini.extension-dir">extension_dir</link>.
</para>
</step>
<step>
<para>
Load the extension from your &php.ini;
<screen>
<![CDATA[
extension=php_win32service.dll
]]>
</screen>
</para>
</step>
</procedure>
</section>
<section id="win32service.examples">
&reftitle.examples;
<para>
<example><title>Registering a PHP to run as a service</title>
<programlisting role='php'>
<![CDATA[
<?php
win32_create_service(array(
'service' => 'dummyphp', # the name of your service
'display' => 'sample dummy PHP service', # description
'params' => 'c:\path\to\script.php run', # path to the script and parameters
));
?>
]]>
</programlisting>
</example>
</para>
<para>
<example><title>Unregistering a service</title>
<programlisting role='php'>
<![CDATA[
<?php
win32_delete_service('dummyphp');
?>
]]>
</programlisting>
</example>
</para>
<para>
<example><title>Running as a service</title>
<programlisting role='php'>
<![CDATA[
<?php
if ($argv[1] == 'run') {
win32_start_service_ctrl_dispatcher('dummyphp');
while (WIN32_SERVICE_CONTROL_STOP != win32_get_last_control_message()) {
# do your work here.
# try not to take up more than 30 seconds before going around the loop
# again
}
}
?>
]]>
</programlisting>
</example>
</para>
</section>
&reference.win32service.constants;
</partintro>
&reference.win32service.functions;
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->