<div class="content" name="RQueryServiceLockStatusA" uuid="05ac6988-6445-49ca-84b0-a5f88925076d"><p>The RQueryServiceLockStatusA method returns the lock status
of the specified <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 RQueryServiceLockStatusA(
   [in] SC_RPC_HANDLE hSCManager,
   [out] LPQUERY_SERVICE_LOCK_STATUSA lpLockStatus,
   [in, range(0, 1024*4)] DWORD cbBufSize,
   [out] LPBOUNDED_DWORD_4K pcbBytesNeeded
 );
</pre></div>
</dd></dl><p><b>hSCManager: </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 SCM database 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
SC_MANAGER_QUERY_LOCK_STATUS 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>
was created.</p><p><b>lpLockStatus: </b>A pointer to a buffer that
contains the <span><a href="b61893cb-aef2-427e-abf6-6f3b072f629d" data-linktype="relative-path">QUERY_SERVICE_LOCK_STATUSA (section 2.2.16)</a></span>
structures.</p><p><b>cbBufSize: </b>The size, in bytes, of the <i>lpLockStatus</i>
buffer.</p><p><b>pcbBytesNeeded: </b>An <span><a href="d5e2cc22-7db6-4101-b36f-f4377e836b4c" data-linktype="relative-path">LPBOUNDED_DWORD_4K (section 2.2.7)</a></span>
data type that defines the pointer to a variable that receives the number of
bytes needed to return all the lock status.</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 SC_MANAGER_QUERY_LOCK_STATUS access right had not been granted to the caller when the RPC context handle was created.</td>
 </tr><tr>
  <td>6 ERROR_INVALID_HANDLE</td>
  <td>The handle is no longer valid.</td>
 </tr><tr>
  <td>122 ERROR_INSUFFICIENT_BUFFER</td>
  <td>The data area passed to a system call is too small.</td>
 </tr></tbody></table>
</dd></dl><p>In response to this request from the client, for a
successful operation the server MUST query the lock status of the SCM database
identified by the <i>hSCManager</i> parameter of the client request. The server
MUST return this lock status by setting the <i>lpLockStatus</i> parameter as
specified in section 2.2.16.</p><p>If the buffer pointed to by <i>lpLockStatus</i> is
insufficient to hold all the lock status data, the server MUST fail the call
with ERROR_INSUFFICIENT_BUFFER (122) and set the required buffer size in the <i>pcbBytesNeeded</i>
parameter. If the size is sufficient for data returned, the server also returns
the required size, in bytes.</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></div>