<div class="content"><p>The RStartServiceW method starts a specified service.</p><dl>
<dd>
<div><pre> DWORD RStartServiceW(
   [in] SC_RPC_HANDLE hService,
   [in, range(0, SC_MAX_ARGUMENTS)] 
     DWORD argc,
   [in, unique, size_is(argc)] LPSTRING_PTRSW argv
 );
</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 <a href="4f66d32e-2f4f-4482-998e-e5ccbb445223#gt_1fbb7936-8437-4e3d-b62f-47df3be07721" data-linktype="relative-path">service record</a> 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>. The
SERVICE_START access right MUST have been granted to the caller when the RPC
context handle to the service record was created.</p><p><b>argc: </b>The number of argument strings in the <i>argv</i>
array. If <i>argv</i> is <b>NULL</b>, this parameter MAY be 0.</p><p><b>argv: </b>A pointer to a buffer that contains an
array of pointers to null-terminated <b>UNICODE</b> strings that are passed as
arguments to 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.<a id="Appendix_A_Target_41"></a><a aria-label="Product behavior note 41" href="041d2a89-9d7d-4f79-91a1-c336d0a668f6#Appendix_A_41" data-linktype="relative-path">&lt;41&gt;</a></p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>2</p>
  <p>ERROR_FILE_NOT_FOUND</p>
  </td>
  <td>
  <p>The system cannot find the file specified.</p>
  </td>
 </tr><tr>
  <td>
  <p>3</p>
  <p>ERROR_PATH_NOT_FOUND</p>
  </td>
  <td>
  <p>The system cannot find the path specified.</p>
  </td>
 </tr><tr>
  <td>
  <p>5</p>
  <p>ERROR_ACCESS_DENIED</p>
  </td>
  <td>
  <p>The SERVICE_START 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>6</p>
  <p>ERROR_INVALID_HANDLE</p>
  </td>
  <td>
  <p>The handle is no longer valid.</p>
  </td>
 </tr><tr>
  <td>
  <p>87</p>
  <p>ERROR_INVALID_PARAMETER</p>
  </td>
  <td>
  <p>A parameter that was specified is invalid.</p>
  </td>
 </tr><tr>
  <td>
  <p>1053</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 time-out.<a id="Appendix_A_Target_42"></a><a aria-label="Product behavior note 42" href="041d2a89-9d7d-4f79-91a1-c336d0a668f6#Appendix_A_42" data-linktype="relative-path">&lt;42&gt;</a></p>
  </td>
 </tr><tr>
  <td>
  <p>1054</p>
  <p>ERROR_SERVICE_NO_THREAD</p>
  </td>
  <td>
  <p>A thread could not be created for the service.</p>
  </td>
 </tr><tr>
  <td>
  <p>1055</p>
  <p>ERROR_SERVICE_DATABASE_LOCKED</p>
  </td>
  <td>
  <p>The service database is locked by the call to the <b>BlockServiceDatabase</b>
  method.<a id="Appendix_A_Target_43"></a><a aria-label="Product behavior note 43" href="041d2a89-9d7d-4f79-91a1-c336d0a668f6#Appendix_A_43" data-linktype="relative-path">&lt;43&gt;</a></p>
  </td>
 </tr><tr>
  <td>
  <p>1056</p>
  <p>ERROR_SERVICE_ALREADY_RUNNING</p>
  </td>
  <td>
  <p>The <b>ServiceStatus.dwCurrentState</b> in the service
  record is not set to SERVICE_STOPPED.</p>
  </td>
 </tr><tr>
  <td>
  <p>1058</p>
  <p>ERROR_SERVICE_DISABLED</p>
  </td>
  <td>
  <p>The service cannot be started because the Start field
  in the service record is set to SERVICE_DISABLED.</p>
  </td>
 </tr><tr>
  <td>
  <p>1068</p>
  <p>ERROR_SERVICE_DEPENDENCY_FAIL</p>
  </td>
  <td>
  <p>The specified service depends on another service that
  has failed to start.</p>
  </td>
 </tr><tr>
  <td>
  <p>1069</p>
  <p>ERROR_SERVICE_LOGON_FAILED</p>
  </td>
  <td>
  <p>The service did not start due to a logon failure.</p>
  </td>
 </tr><tr>
  <td>
  <p>1072</p>
  <p>ERROR_SERVICE_MARKED_FOR_DELETE</p>
  </td>
  <td>
  <p>The <b>RDeleteService</b> method has been called for
  the service record identified by the <i>hService</i> parameter.</p>
  </td>
 </tr><tr>
  <td>
  <p>1075</p>
  <p>ERROR_SERVICE_DEPENDENCY_DELETED</p>
  </td>
  <td>
  <p>The specified service depends on a service that does
  not exist or has been marked for deletion.</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 server MUST start the service using the information
from the service record identified by the <i>hService</i> parameter and pass
the arguments specified in the <i>argv</i> parameter as part of the service
launch command.</p><p>If <i>argv</i> is not NULL, the client SHOULD set the first
element in <i>argv</i> to the name of the service.</p><p>The server MUST ignore <i>argv</i> for service records with <b>Type</b>
equal to SERVICE_KERNEL_DRIVER or SERVICE_FILE_SYSTEM_DRIVER.</p><p>The server MUST set the <b>ServiceStatus.dwCurrentState</b>
in the service record, as specified in <a href="4e91ff36-ab5f-49ed-a43d-a308e72b0b3c" data-linktype="relative-path">SERVICE_STATUS (section 2.2.47)</a>,
to SERVICE_START_PENDING.</p><p>The server MUST set the <b>ServiceStatus.dwControlsAccepted</b>
in the service record, as specified in SERVICE_STATUS, to none (zero).</p><p>The server MUST set the <b>ServiceStatus.dwCheckPoint</b> in
the service record, as specified in SERVICE_STATUS, to zero.</p><p>The server MUST set the <b>ServiceStatus.dwWaitHint</b> in
the service record, as specified in SERVICE_STATUS, to 2 seconds.</p><p>The server MUST return ERROR_SERVICE_NO_THREAD if it is
unable to create a new thread for the service process.</p><p>If <i>argv</i> does not contain as many non-NULL pointers as
indicated by <i>argc</i>, the server MUST fail the call with
ERROR_INVALID_PARAMETER (87).</p></div>