<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.win32service.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.win32-query-service-status.php',
    1 => 'win32_query_service_status',
    2 => 'Queries the status of a service',
  ),
  'up' => 
  array (
    0 => 'ref.win32service.php',
    1 => 'win32service Functions',
  ),
  'prev' => 
  array (
    0 => 'function.win32-pause-service.php',
    1 => 'win32_pause_service',
  ),
  'next' => 
  array (
    0 => 'function.win32-read-all-rights-access-service.php',
    1 => 'win32_read_all_rights_access_service',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/win32service/functions/win32-query-service-status.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.win32-query-service-status" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">win32_query_service_status</h1>
  <p class="verinfo">(PECL win32service &gt;=0.1.0)</p><p class="refpurpose"><span class="refname">win32_query_service_status</span> &mdash; <span class="dc-title">Queries the status of a service</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.win32-query-service-status-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>win32_query_service_status</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$servicename</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$machine</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>


  <p class="para rdfs-comment">
   Queries the current status for a service, returning an array of
   information.
  </p>

 </div>

 <div class="refsect1 parameters" id="refsect1-function.win32-query-service-status-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">servicename</code></dt>
     <dd>
      <p class="para">
       The short name of the service.
      </p>
     </dd>
    
    
     <dt><code class="parameter">machine</code></dt>
     <dd>
      <p class="para">
       The optional machine name.  If omitted, the local machine will be used.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.win32-query-service-status-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns an array consisting of the following information on success
  </p>
  <p class="para">
    Prior version 1.0.0, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> if there is a problem with the parameters or a <a href="win32service.constants.php#win32service.constants.errors" class="link">Win32 Error Code</a> on failure.
  </p>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">ServiceType</code></dt>
     <dd>
      <p class="para">
       The dwServiceType. See <a href="win32service.constants.php#win32service.constants.servicetype" class="link">Win32Service Service Type Bitmasks</a>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">CurrentState</code></dt>
     <dd>
      <p class="para">
       The dwCurrentState. See <a href="win32service.constants.php#win32service.constants.servicestatus" class="link">Win32Service Service Status Constants</a>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">ControlsAccepted</code></dt>
     <dd>
      <p class="para">
       Which service controls are accepted by the service. See <a href="win32service.constants.php#win32service.constants.controlsaccepted" class="link">Win32Service Service Control Message Accepted Bitmasks</a>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">Win32ExitCode</code></dt>
     <dd>
      <p class="para">
       If the service exited, the return code from the process. This value is equal to 
       <strong><code><a href="win32service.constants.php#constant.win32-error-service-specific-error">WIN32_ERROR_SERVICE_SPECIFIC_ERROR</a></code></strong> 
       if the exit mode is not gracefuly. See 
       <a href="win32service.constants.php#win32service.constants.errors" class="link">Win32Service error codes</a> and 
       <span class="function"><a href="function.win32-set-service-exit-mode.php" class="function">win32_set_service_exit_mode()</a></span>
      </p>
     </dd>
    
    
     <dt><code class="parameter">ServiceSpecificExitCode</code></dt>
     <dd>
      <p class="para">
       If the service exited with an error condition, the service specific
       code that is logged in the event log is visible here. This value is equal 
       to the value defined by <span class="function"><a href="function.win32-set-service-exit-code.php" class="function">win32_set_service_exit_code()</a></span>
      </p>
     </dd>
    
    
     <dt><code class="parameter">CheckPoint</code></dt>
     <dd>
      <p class="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.
      </p>
     </dd>
    
    
     <dt><code class="parameter">WaitHint</code></dt>
     <dd>
      <p class="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.
      </p>
     </dd>
    
    
     <dt><code class="parameter">ProcessId</code></dt>
     <dd>
      <p class="para">
       The Windows process identifier. If 0, the process is not running.
      </p>
     </dd>
    
    
     <dt><code class="parameter">ServiceFlags</code></dt>
     <dd>
      <p class="para">
       The dwServiceFlags. See <a href="win32service.constants.php#win32service.constants.serviceflag" class="link">Win32Service Service Flag Constants</a>.
      </p>
     </dd>
    
   </dl>
  </p>

 </div>



 <div class="refsect1 errors" id="refsect1-function.win32-query-service-status-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">
    A <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span> is thrown if the
    value of <code class="parameter">servicename</code> parameter is empty.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.win32-query-service-status-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>PECL win32service 1.0.0</td>
       <td>
        Throws a <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span> on invalid data in parameters,
        previously <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> was returned.
       </td>
      </tr>

      <tr>
       <td>PECL win32service 1.0.0</td>
       <td>
        Throws a <span class="classname"><a href="class.win32serviceexception.php" class="classname">Win32ServiceException</a></span> on error,
        previously a 
        <a href="win32service.constants.php#win32service.constants.errors" class="link">Win32 Error Code</a>
        was returned.
       </td>
      </tr>

      <tr>
       <td>PECL win32service 1.0.0</td>
       <td>
        The return type is now <span class="type"><a href="language.types.array.php" class="type array">array</a></span>, previously it was <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span>.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.win32-query-service-status-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><a href="win32service.constants.php" class="link">Win32Service Predefined Constants</a></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>