<div class="content"><p>The RControlServiceExW method<a id="Appendix_A_Target_80"></a><a aria-label="Product behavior note 80" href="041d2a89-9d7d-4f79-91a1-c336d0a668f6#Appendix_A_80" data-linktype="relative-path">&lt;80&gt;</a> receives
a control code for a specific service.</p><dl>
<dd>
<div><pre> DWORD RControlServiceExW(
   [in] SC_RPC_HANDLE hService,
   [in] DWORD dwControl,
   [in] DWORD dwInfoLevel,
   [in, switch_is(dwInfoLevel)] PSC_RPC_SERVICE_CONTROL_IN_PARAMSW pControlInParams,
   [out, switch_is(dwInfoLevel)] PSC_RPC_SERVICE_CONTROL_OUT_PARAMSW pControlOutParams
 );
</pre></div>
</dd></dl><p><b>hService: </b>An <a href="b5f0a0a8-887c-4097-af1c-71ef9f214ce4" data-linktype="relative-path">SC_RPC_HANDLE (section 2.2.4)</a>
data type that defines the handle to the service record that MUST have been
created previously, using one of the open methods specified in section <a href="0d7a7011-9f41-470d-ad52-8535b47ac282" data-linktype="relative-path">3.1.4</a>.</p><p><b>dwControl: </b>Requested control code. MUST be one
of the following values.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>SERVICE_CONTROL_STOP</p>
  <p>0x00000001</p>
  </td>
  <td>
  <p>Notifies a service to stop. The SERVICE_STOP access
  right MUST have been granted to the caller when the RPC control handle to the
  service record was created. The service record MUST have the
  SERVICE_ACCEPT_STOP bit set in the <b>ServiceStatus.dwControlsAccepted</b>
  field of the <a href="4f66d32e-2f4f-4482-998e-e5ccbb445223#gt_1fbb7936-8437-4e3d-b62f-47df3be07721" data-linktype="relative-path">service
  record</a>.</p>
  </td>
 </tr><tr>
  <td>
  <p>SERVICE_CONTROL_PAUSE</p>
  <p>0x00000002</p>
  </td>
  <td>
  <p>Notifies a service to pause. The
  SERVICE_PAUSE_CONTINUE access right MUST have been granted to the caller when
  the RPC control handle to the service record was created. The service record
  MUST have the SERVICE_ACCEPT_PAUSE_CONTINUE bit set in the <b>ServiceStatus.dwControlsAccepted</b>
  field of the service record.</p>
  </td>
 </tr><tr>
  <td>
  <p>SERVICE_CONTROL_CONTINUE</p>
  <p>0x00000003</p>
  </td>
  <td>
  <p>Notifies a paused service to resume. The
  SERVICE_PAUSE_CONTINUE access right MUST have been granted to the caller when
  the RPC control handle to the service record was created. The service record
  MUST have the SERVICE_ACCEPT_PAUSE_CONTINUE bit set in the <b>ServiceStatus.dwControlsAccepted</b>
  field of the service record.</p>
  </td>
 </tr><tr>
  <td>
  <p>SERVICE_CONTROL_INTERROGATE</p>
  <p>0x00000004</p>
  </td>
  <td>
  <p>Notifies a service to report its current status
  information to the <a href="4f66d32e-2f4f-4482-998e-e5ccbb445223#gt_afc3f782-a908-486d-9c05-8a054cd9cc84" data-linktype="relative-path">SCM</a>.
  The SERVICE_INTERROGATE access right MUST have been granted to the caller
  when the RPC control handle to the service record was created.</p>
  </td>
 </tr><tr>
  <td>
  <p>SERVICE_CONTROL_PARAMCHANGE</p>
  <p>0x00000006</p>
  </td>
  <td>
  <p>Notifies a service that its startup parameters have
  changed. The SERVICE_PAUSE_CONTINUE access right MUST have been granted to
  the caller when the RPC control handle to the service record was created. The
  service record MUST have the SERVICE_ACCEPT_PARAMCHANGE bit set in the <b>ServiceStatus.dwControlsAccepted</b>
  field of the service record.</p>
  </td>
 </tr><tr>
  <td>
  <p>SERVICE_CONTROL_NETBINDADD</p>
  <p>0x00000007</p>
  </td>
  <td>
  <p>Notifies a service that there is a new component for
  binding. The SERVICE_PAUSE_CONTINUE access right MUST have been granted to
  the caller when the RPC control handle to the service record was created. The
  service record MUST have the SERVICE_ACCEPT_NETBINDCHANGE bit set in the <b>ServiceStatus.dwControlsAccepted</b>
  field of the service record.</p>
  </td>
 </tr><tr>
  <td>
  <p>SERVICE_CONTROL_NETBINDREMOVE</p>
  <p>0x00000008</p>
  </td>
  <td>
  <p>Notifies a network service that a component for
  binding has been removed. The SERVICE_PAUSE_CONTINUE access right MUST have
  been granted to the caller when the RPC control handle to the service record
  was created. The service record MUST have the SERVICE_ACCEPT_NETBINDCHANGE
  bit set in the <b>ServiceStatus.dwControlsAccepted</b> field of the service
  record.</p>
  </td>
 </tr><tr>
  <td>
  <p>SERVICE_CONTROL_NETBINDENABLE</p>
  <p>0x00000009</p>
  </td>
  <td>
  <p>Notifies a network service that a disabled binding has
  been enabled. The SERVICE_PAUSE_CONTINUE access right MUST have been granted
  to the caller when the RPC control handle to the service record was created.
  The service record MUST have the SERVICE_ACCEPT_NETBINDCHANGE bit set in the <b>ServiceStatus.dwControlsAccepted</b>
  field of the service record.</p>
  </td>
 </tr><tr>
  <td>
  <p>SERVICE_CONTROL_NETBINDDISABLE</p>
  <p>0x0000000A</p>
  </td>
  <td>
  <p>Notifies a network service that one of its bindings
  has been disabled. The SERVICE_PAUSE_CONTINUE access right MUST have been
  granted to the caller when the RPC control handle to the service record was
  created. The service record MUST have the SERVICE_ACCEPT_NETBINDCHANGE bit
  set in the <b>ServiceStatus.dwControlsAccepted</b> field of the service
  record. </p>
  </td>
 </tr></tbody></table>
</dd>
<dd>
<p>Services can define their own
codes in the range 128-255.</p>
</dd></dl><p><b>dwInfoLevel: </b>The information level for the
service control parameters. This MUST be set to 0x00000001.</p><p><b>pControlInParams: </b>A pointer to a <a href="1ac2684a-ea98-420c-ac33-7441af91282e" data-linktype="relative-path">SERVICE_CONTROL_STATUS_REASON_IN_PARAMSW (section 2.2.31)</a>
structure that contains the reason associated with the SERVICE_CONTROL_STOP
control.</p><p><b>pControlOutParams: </b>A pointer to a buffer that
contains a <a href="2679fdcc-5e6a-4092-8958-a625f2a4ace7" data-linktype="relative-path">SERVICE_CONTROL_STATUS_REASON_OUT_PARAMS (section 2.2.32)</a>
structure to receive the current status on the service.</p><p><b>Return Values: </b>The method returns 0x00000000
(ERROR_SUCCESS) on success; otherwise, it returns one of the following error
codes.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>0x00000005</p>
  <p>ERROR_ACCESS_DENIED</p>
  </td>
  <td>
  <p>The required access right had not been granted to the
  caller when the RPC context handle to the service record was created.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000006</p>
  <p>ERROR_INVALID_HANDLE</p>
  </td>
  <td>
  <p>The handle is no longer valid.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000087</p>
  <p>ERROR_INVALID_PARAMETER</p>
  </td>
  <td>
  <p>The requested control code is undefined.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000124</p>
  <p>ERROR_INVALID_LEVEL</p>
  </td>
  <td>
  <p>The <i>dwInfoLevel</i> parameter contains an
  unsupported level.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00001051</p>
  <p>ERROR_DEPENDENT_SERVICES_RUNNING</p>
  </td>
  <td>
  <p>The service cannot be stopped because other running
  services are dependent on it.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00001052</p>
  <p>ERROR_INVALID_SERVICE_CONTROL</p>
  </td>
  <td>
  <p>The requested control code is not valid, or it is
  unacceptable to the service.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00001053</p>
  <p>ERROR_SERVICE_REQUEST_TIMEOUT</p>
  </td>
  <td>
  <p>The process for the service was started, but it did
  not respond within an implementation-specific timeout.<a id="Appendix_A_Target_81"></a><a aria-label="Product behavior note 81" href="041d2a89-9d7d-4f79-91a1-c336d0a668f6#Appendix_A_81" data-linktype="relative-path">&lt;81&gt;</a></p>
  </td>
 </tr><tr>
  <td>
  <p>0x00001061</p>
  <p>ERROR_SERVICE_CANNOT_ACCEPT_CTRL</p>
  </td>
  <td>
  <p>The requested control code cannot be sent to the
  service because the state of the service is <b>SERVICE_START_PENDING</b> or <b>SERVICE_STOP_PENDING</b>.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00001062</p>
  <p>ERROR_SERVICE_NOT_ACTIVE</p>
  </td>
  <td>
  <p>The service has not been started, or the <b>ServiceStatus.dwCurrentState</b>
  in the service record is <b>SERVICE_STOPPED</b>.</p>
  </td>
 </tr><tr>
  <td>
  <p>1115</p>
  <p>ERROR_SHUTDOWN_IN_PROGRESS</p>
  </td>
  <td>
  <p>The system is shutting down.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p>In response to this request from the client, for a
successful operation the SCM MUST send the control specified in the <i>dwControl</i>
parameter to the service created for the service record identified by the <i>hService</i>
parameter of the client request if the type of the service record is
SERVICE_WIN32_OWN_PROCESS or SERVICE_WIN32_SHARE_PROCESS.</p><p>If the type of the service record is SERVICE_KERNEL_DRIVER
or SERVICE_FILESYSTEM_DRIVER, and <i>dwControl</i> parameter is not
SERVICE_CONTROL_INTERROGATE or SERVICE_CONTROL_STOP, the SCM MUST fail the
request with ERROR_INVALID_SERVICE_CONTROL.</p><p>If the type of the service record is SERVICE_KERNEL_DRIVER
or SERVICE_FILESYSTEM_DRIVER, the SCM MUST query the current status of the
driver from the Operating System and set the <b>ServiceStatus.dwCurrentState</b>
of the service record to SERVICE_RUNNING if driver is loaded and
SERVICE_STOPPED if it is not.</p><p>If the <i>dwControl</i> is not SERVICE_CONTROL_INTERROGATE
and type of the service record is SERVICE_KERNEL_DRIVER or
SERVICE_FILESYSTEM_DRIVER and the driver is managed by the PnP subsystem, the
SCM MUST fail the request with ERROR_INVALID_SERVICE_CONTROL.</p><p>If the <b>ServiceStatus.dwControlsAccepted</b> field of the
service record does not have a required SERVICE_ACCEPT_xxx bit set, the SCM
MUST fail the request with ERROR_INVALID_SERVICE_CONTROL.</p><p>In response to this request from the client, for a
successful operation the SCM MUST return the current status of the service by
setting <i>pControlOutParams</i> after the operation.</p><p>The server MUST return the services last known state if <i>dwControl</i>
is SERVICE_CONTROL_INTERROGATE and the service is in START_PENDING state.</p><p>The server MUST provide information in <i>pControlOutParams</i>.</p><p>If <i>dwControl</i> is not equal to SERVICE_CONTROL_STOP,
pControlInParams-&gt;pszComment MUST be NULL. If not, the server MUST fail the
call and return ERROR_INVALID_PARAMETER (87).</p></div>