<div class="content" name="RQueryServiceConfig2A" uuid="89892356-ac90-49d7-ad99-fc2ffa2a2494"><p>The RQueryServiceConfig2A <a id="Appendix_A_Target_55"></a><a aria-label="Product behavior note 55" href="041d2a89-9d7d-4f79-91a1-c336d0a668f6#Appendix_A_55" data-linktype="relative-path">&lt;55&gt;</a> method
returns the optional configuration parameters of the specified service based on
the specified information level.</p><dl>
<dd>
<div><pre> DWORD RQueryServiceConfig2A(
   [in] SC_RPC_HANDLE hService,
   [in] DWORD dwInfoLevel,
   [out, size_is(cbBufSize)] LPBYTE lpBuffer,
   [in, range(0, 1024*8)] DWORD cbBufSize,
   [out] LPBOUNDED_DWORD_8K pcbBytesNeeded
 );
</pre></div>
</dd></dl><p><b>hService: </b>An <span><a href="b5f0a0a8-887c-4097-af1c-71ef9f214ce4" data-linktype="relative-path">SC_RPC_HANDLE (section 2.2.4)</a></span>
data type that defines the 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> 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_QUERY_CONFIG access right MUST have been granted to the caller when the
<span><a href="4f66d32e-2f4f-4482-998e-e5ccbb445223#gt_9dfe84e3-a772-4ad1-9a25-1255c1dc0f84" data-linktype="relative-path">RPC
context handle</a></span> to the service record was created.</p><p><b>dwInfoLevel: </b>A value that specifies the
configuration information to query. This SHOULD 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_CONFIG_DESCRIPTION 0x00000001</td>
  <td>The lpBuffer parameter is a pointer to a SERVICE_DESCRIPTIONA structure.</td>
 </tr><tr>
  <td>SERVICE_CONFIG_FAILURE_ACTIONS 0x00000002</td>
  <td>The lpBuffer parameter is a pointer to a SERVICE_FAILURE_ACTIONSA structure.</td>
 </tr><tr>
  <td>SERVICE_CONFIG_DELAYED_AUTO_START_INFO 0x00000003&lt;56&gt;</td>
  <td>The lpBuffer parameter is a pointer to a SERVICE_DELAYED_AUTO_START_INFO structure.</td>
 </tr><tr>
  <td>SERVICE_CONFIG_FAILURE_ACTIONS_FLAG 0x00000004&lt;57&gt;</td>
  <td>The lpBuffer parameter is a pointer to a SERVICE_FAILURE_ACTIONS_FLAG structure.</td>
 </tr><tr>
  <td>SERVICE_CONFIG_SERVICE_SID_INFO 0x00000005&lt;58&gt;</td>
  <td>The lpBuffer parameter is a pointer to a SERVICE_SID_INFO structure.</td>
 </tr><tr>
  <td>SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO 0x00000006&lt;59&gt;</td>
  <td>The lpBuffer parameter is a pointer to a SERVICE_RPC_REQUIRED_PRIVILEGES_INFO structure.</td>
 </tr><tr>
  <td>SERVICE_CONFIG_PRESHUTDOWN_INFO 0x00000007&lt;60&gt;</td>
  <td>The lpBuffer parameter is a pointer to a SERVICE_PRESHUTDOWN_INFO structure.</td>
 </tr><tr>
  <td>SERVICE_CONFIG_PREFERRED_NODE 0x00000009&lt;61&gt;</td>
  <td>The lpBuffer parameter is a pointer to a SERVICE_PREFERRED_NODE_INFO structure.&lt;62&gt;</td>
 </tr></tbody></table>
</dd></dl><p><b>lpBuffer: </b>A pointer to the buffer that
contains the service configuration information. The format of this data depends
on the value of the <i>dwInfoLevel</i> parameter.</p><p><b>cbBufSize: </b>The size, in bytes, of the <i>lpBuffer</i>
parameter.</p><p><b>pcbBytesNeeded: </b>An <span><a href="1720ed6e-d907-41c6-8d98-fb6e4877d761" data-linktype="relative-path">LPBOUNDED_DWORD_8K (section 2.2.8)</a></span>
data type that defines the pointer to a variable that contains the number of
bytes needed to return the configuration information.</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_QUERY_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 is no longer valid.</td>
 </tr><tr>
  <td>87 ERROR_INVALID_PARAMETER</td>
  <td>A parameter that was specified is invalid.</td>
 </tr><tr>
  <td>122 ERROR_INSUFFICIENT_BUFFER</td>
  <td>The data area passed to a system call is too small.</td>
 </tr><tr>
  <td>124 ERROR_INVALID_LEVEL</td>
  <td>The dwInfoLevel parameter contains an unsupported value.</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 query the specific configuration
information stored in the <span><a href="4f66d32e-2f4f-4482-998e-e5ccbb445223#gt_afc3f782-a908-486d-9c05-8a054cd9cc84" data-linktype="relative-path">SCM</a></span> database
associated with the service record identified by the <i>hService</i> parameter,
using the information level and the corresponding values associated with that
information level as specified in the <i>dwInfoLevel</i> parameter of the
client request. The server MUST return this configuration data by setting the <i>lpBuffer</i>
parameter with the appropriate structure filled with the configuration data
based on <i>dwInfoLevel</i>. </p><p>The server MUST set the required buffer size in the <i>pcbBytesNeeded</i>
parameter.</p><p>If the buffer pointed to by <i>lpBuffer</i> is insufficient
to hold all the configuration data, the server MUST fail the call with
ERROR_INSUFFICIENT_BUFFER (122).</p><p>The server MUST use the process described in <span><a href="f9ddeebe-b05e-423c-9440-84fd3d14bee9" data-linktype="relative-path">Conversion
Between ANSI and Unicode String Formats (section 3.1.7)</a></span> to
convert a string to the appropriate format.</p><p>The server MUST return ERROR_INVALID_PARAMETER (87) if
either or both <i>lpBuffer</i> and <i>pcbBytesNeeded</i> are NULL.<a id="Appendix_A_Target_63"></a><a aria-label="Product behavior note 63" href="041d2a89-9d7d-4f79-91a1-c336d0a668f6#Appendix_A_63" data-linktype="relative-path">&lt;63&gt;</a></p></div>