<div class="content" name="RChangeServiceConfigW" uuid="61ea7ed0-c49d-4152-a164-b4830f16c8a4"><p>The RChangeServiceConfigW method changes a service&#39;s
configuration parameters in the <span><a href="4f66d32e-2f4f-4482-998e-e5ccbb445223#gt_afc3f782-a908-486d-9c05-8a054cd9cc84" data-linktype="relative-path">SCM</a></span> database.</p><dl>
<dd>
<div><pre> DWORD RChangeServiceConfigW(
   [in] SC_RPC_HANDLE hService,
   [in] DWORD dwServiceType,
   [in] DWORD dwStartType,
   [in] DWORD dwErrorControl,
   [in, string, unique, range(0, SC_MAX_PATH_LENGTH)] 
     wchar_t* lpBinaryPathName,
   [in, string, unique, range(0, SC_MAX_NAME_LENGTH)] 
     wchar_t* lpLoadOrderGroup,
   [in, out, unique] LPDWORD lpdwTagId,
   [in, unique, size_is(dwDependSize)] 
     LPBYTE lpDependencies,
   [in, range(0, SC_MAX_DEPEND_SIZE)] 
     DWORD dwDependSize,
   [in, string, unique, range(0, SC_MAX_ACCOUNT_NAME_LENGTH)] 
     wchar_t* lpServiceStartName,
   [in, unique, size_is(dwPwSize)] 
     LPBYTE lpPassword,
   [in, range(0, SC_MAX_PWD_SIZE)] 
     DWORD dwPwSize,
   [in, string, unique, range(0, SC_MAX_NAME_LENGTH)] 
     wchar_t* lpDisplayName
 );
</pre></div>
</dd></dl><p><b>hService: </b>An <span><a href="b5f0a0a8-887c-4097-af1c-71ef9f214ce4" data-linktype="relative-path">SC_RPC_HANDLE</a></span>
(section 2.2.4) 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 <span><a href="0d7a7011-9f41-470d-ad52-8535b47ac282" data-linktype="relative-path">3.1.4</a></span>. The
SERVICE_CHANGE_CONFIG access right MUST have been granted to the caller when
the RPC context handle to the <span><a href="4f66d32e-2f4f-4482-998e-e5ccbb445223#gt_1fbb7936-8437-4e3d-b62f-47df3be07721" data-linktype="relative-path">service record</a></span> was
created.</p><p><b>dwServiceType: </b>A Type value for the service
record (section <span><a href="3b30d63a-095b-4bc1-84ec-72370fc1db61" data-linktype="relative-path">3.1.1</a></span>) that
specifies the type of service. This 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>SERVICE_KERNEL_DRIVER 0x00000001</td>
  <td>A driver service. These are services that manage devices on the system.</td>
 </tr><tr>
  <td>SERVICE_FILE_SYSTEM_DRIVER 0x00000002</td>
  <td>A file system driver service. These are services that manage file systems on the system.</td>
 </tr><tr>
  <td>SERVICE_WIN32_OWN_PROCESS 0x00000010</td>
  <td>Service that runs in its own process.</td>
 </tr><tr>
  <td>SERVICE_WIN32_SHARE_PROCESS 0x00000020</td>
  <td>Service that shares a process with other services.</td>
 </tr><tr>
  <td>SERVICE_NO_CHANGE 0xFFFFFFFF</td>
  <td>Service type does not change.</td>
 </tr></tbody></table>
</dd>
<dd>
<p>The following flag can also be
combined with the value passed in <i>dwServiceStartType</i>:</p>
</dd>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>SERVICE_INTERACTIVE_PROCESS 0x00000100</td>
  <td>The service can interact with the desktop.</td>
 </tr></tbody></table>
</dd></dl><p><b>dwStartType: </b>A Start value for the service
record (section 3.1.1) that specifies when to start the service. This 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>SERVICE_BOOT_START 0x00000000</td>
  <td>Starts the driver service when the system boots up. This value is valid only for driver services.</td>
 </tr><tr>
  <td>SERVICE_SYSTEM_START 0x00000001</td>
  <td>Starts the driver service when the system boots up. This value is valid only for driver services. The services marked SERVICE_SYSTEM_START are started after all SERVICE_BOOT_START services have been started.</td>
 </tr><tr>
  <td>SERVICE_AUTO_START 0x00000002</td>
  <td>Starts the service automatically during system startup.</td>
 </tr><tr>
  <td>SERVICE_DEMAND_START 0x00000003</td>
  <td>Starts the service when a client requests the SCM to start the service.</td>
 </tr><tr>
  <td>SERVICE_DISABLED 0x00000004</td>
  <td>Service cannot be started.</td>
 </tr><tr>
  <td>SERVICE_NO_CHANGE 0xFFFFFFFF</td>
  <td>Service start type does not change.</td>
 </tr></tbody></table>
</dd></dl><p><b>dwErrorControl: </b>An ErrorControl value for the
service record (section 3.1.1) that specifies the severity of the error if the
service fails to start and determines the action that the SCM takes. 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>SERVICE_ERROR_IGNORE 0x00000000</td>
  <td>The SCM ignores the error and continues the startup operation.</td>
 </tr><tr>
  <td>SERVICE_ERROR_NORMAL 0x00000001</td>
  <td>The SCM logs the error and displays a message box, but continues the startup operation.</td>
 </tr><tr>
  <td>SERVICE_ERROR_SEVERE 0x00000002</td>
  <td>The SCM logs the error. If the last-known good configuration is being started, the startup operation continues. Otherwise, the system is restarted with the last-known good configuration.</td>
 </tr><tr>
  <td>SERVICE_ERROR_CRITICAL 0x00000003</td>
  <td>The SCM SHOULD log the error 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.</td>
 </tr><tr>
  <td>SERVICE_NO_CHANGE 0xFFFFFFFF</td>
  <td>Service error control type does not change.</td>
 </tr></tbody></table>
</dd></dl><p><b>lpBinaryPathName: </b>An ImagePath value for the
service record (section 3.1.1) as a pointer to a null-terminated <b>UNICODE</b>
string name. The pointer contains the fully qualified path to the service
binary file. The path MAY include arguments. If the path contains a space, it
MUST be quoted so that it is correctly interpreted. For example, &#34;d:\\my
share\\myservice.exe&#34; is specified as &#34;\&#34;d:\\my share\\myservice.exe\&#34;&#34;.</p><p><b>lpLoadOrderGroup: </b>A Group value for the
service record (section 3.1.1) as a pointer to a null-terminated <b>UNICODE</b>
string that names the load-ordering group of which this service is a member.</p><dl>
<dd>
<p>Specify NULL or an empty string if <code>the</code> service does not belong to a <span><a href="4f66d32e-2f4f-4482-998e-e5ccbb445223#gt_88c26bf0-5b6f-4423-82b3-1027ea5df0e3" data-linktype="relative-path">load-ordering
group</a></span>.</p>
</dd></dl><p><b>lpdwTagId: </b>A Tag value for the service record
(section 3.1.1) as a pointer to a variable that receives a tag value. The value
is unique to the group specified in the <i>lpLoadOrderGroup</i> parameter.</p><p><b>lpDependencies: </b>DependOnService and
DependOnGroup values for the service record (section 3.1.1) as a pointer to an
array of null-separated names of services or load ordering groups that MUST
start before this service. The array is doubly null-terminated. Load ordering
group names are prefixed with a &#34;+&#34; character (to distinguish them
from service names). If the pointer is NULL or if it points to an empty string,
the service has no dependencies. Cyclic dependency between services is not
allowed. The character set is <span><a href="4f66d32e-2f4f-4482-998e-e5ccbb445223#gt_c305d0ab-8b94-461a-bd76-13b40cb8c4d8" data-linktype="relative-path">Unicode</a></span>. Dependency
on a service means that this service can only run if the service it depends on
is running. Dependency on a group means that this service can run if at least
one member of the group is running after an attempt to start all members of the
group.</p><p><b>dwDependSize: </b>The size, in bytes, of the
string specified by the <i>lpDependencies</i> parameter.</p><p><b>lpServiceStartName: </b>An ObjectName value for
the service record (section 3.1.1) as a pointer to a null-terminated UNICODE
string that specifies the name of the account under which the service runs.</p><p><b>lpPassword: </b>A Password value for the service
record (section 3.1.1) as a pointer to a null-terminated UNICODE string that
contains the password of the account whose name was specified by the <i>lpServiceStartName</i>
parameter.</p><p><b>dwPwSize: </b>The size, in bytes, of the password
specified by the <i>lpPassword</i> parameter.</p><p><b>lpDisplayName: </b>A DisplayName value for the
service record (section 3.1.1) as a pointer to a null-terminated UNICODE string
that contains the display name that applications can use to identify the
service for its users.</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>5 ERROR_ACCESS_DENIED</td>
  <td>The SERVICE_CHANGE_CONFIG access right had not been granted to the caller when the RPC context handle to the service record was created.</td>
 </tr><tr>
  <td>6 ERROR_INVALID_HANDLE</td>
  <td>The handle specified is invalid.</td>
 </tr><tr>
  <td>87 ERROR_INVALID_PARAMETER</td>
  <td>A parameter that was specified is invalid.</td>
 </tr><tr>
  <td>1057 ERROR_INVALID_SERVICE_ACCOUNT</td>
  <td>The user account name specified in the lpServiceStartName parameter does not exist.</td>
 </tr><tr>
  <td>1059 ERROR_CIRCULAR_DEPENDENCY</td>
  <td>A circular service dependency was specified.</td>
 </tr><tr>
  <td>1078 ERROR_DUPLICATE_SERVICE_NAME</td>
  <td>The lpDisplayName matches either the ServiceName or the DisplayName of another service record in the service control manager database.</td>
 </tr><tr>
  <td>1072 ERROR_SERVICE_MARKED_FOR_DELETE</td>
  <td>The RDeleteService has been called for the service record identified by the hService parameter.</td>
 </tr><tr>
  <td>1115 ERROR_SHUTDOWN_IN_PROGRESS</td>
  <td>The system is shutting down.</td>
 </tr></tbody></table>
</dd></dl><p>In response to this request from the client, for a
successful operation the server MUST use the values from the appropriate
parameters of the client request to update the service record identified by the
<i>hService</i> parameter in the SCM database:</p><ul><li><p><span><span> 
</span></span>If the client passes NULL for <i>lpBinaryPathName</i>, the server
MUST keep the existing ImagePath value.</p>
</li><li><p><span><span> 
</span></span>If the client passes NULL for <i>lpLoadOrderGroup</i>, the server
MUST keep the existing ServiceGroup value.</p>
</li><li><p><span><span> 
</span></span>If the client passes NULL for <i>lpdwTagId</i>, the server MUST
keep the existing Tag value.</p>
</li><li><p><span><span> 
</span></span>If the client passes NULL for <i>lpDependencies</i>, the server
MUST keep the existing DependOnService and DependOnGroup values.</p>
</li><li><p><span><span> 
</span></span>If the client passes NULL for <i>lpServiceStartName</i>, the
server MUST keep the existing ObjectName value.</p>
</li><li><p><span><span> 
</span></span>If the client passes NULL for <i>lpPassword</i>, the server MUST
keep the existing Password value.</p>
</li><li><p><span><span> 
</span></span>If the client passes NULL for <i>lpDisplayName</i>, the server
MUST keep the existing DisplayName value.</p>
</li></ul><p>If the original service type is SERVICE_WIN32_OWN_PROCESS or
SERVICE_WIN32_SHARE_PROCESS, the server MUST fail the call if <i>dwServiceType</i>
is set to SERVICE_FILE_SYSTEM_DRIVER or SERVICE_KERNEL_DRIVER.<a id="Appendix_A_Target_39"></a><a aria-label="Product behavior note 39" href="041d2a89-9d7d-4f79-91a1-c336d0a668f6#Appendix_A_39" data-linktype="relative-path">&lt;39&gt;</a></p><p>If <i>dwServiceType</i> is set to SERVICE_WIN32_OWN_PROCESS
or SERVICE_WIN32_SHARE_PROCESS and is combined with the
SERVICE_INTERACTIVE_PROCESS bit, and the <b>ObjectName</b> field of the service
record is not equal to &#34;LocalSystem&#34;, the server MUST fail the
request with ERROR_INVALID_PARAMETER.</p><p>If the service has a PreferredNode setting and the client
requested a change in service type other than SERVICE_WIN32_OWN_PROCESS, the
server MUST fail the call with ERROR_INVALID_PARAMETER (87).</p><p>If the service is a member of a load-order group has a start
type of delayed autostart (see section <span><a href="805b8296-863d-4d1e-8ae8-f639adf8c6cb" data-linktype="relative-path">2.2.33</a></span>), then the
server MUST fail the call with ERROR_INVALID_PARAMETER (87).</p><p>If <i>lpdwTagId</i> has a valid value and <i>lpLoadOrderGroup</i>
is either NULL or an empty string, then the server MUST return
ERROR_INVALID_PARAMETER.</p><p>For service record changes to apply to the running service,
the service MUST be stopped and started back up, except in the case of <i>lpDisplayName</i>.
Changes to <i>lpDisplayName</i> take effect immediately.</p><p>If <i>lpBinaryPathName</i> contains arguments, the server
MUST pass these arguments to the service entry point.</p></div>