<div class="content"><p align="right"><a href="https://msdn.microsoft.com/en-us/library/6b3291a2-1265-498e-8e9d-f7e28962255e" data-linktype="external">msdn link</a></p><p>The LsarQuerySecurityObject method is invoked to query
security information that is assigned to a database object. It returns the <a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_e5213722-75a9-44e7-b026-8e4833f0d350" data-linktype="relative-path">security descriptor</a> of the
object.</p><dl>
<dd>
<div><pre> NTSTATUS LsarQuerySecurityObject(
   [in] LSAPR_HANDLE ObjectHandle,
   [in] SECURITY_INFORMATION SecurityInformation,
   [out] PLSAPR_SR_SECURITY_DESCRIPTOR* SecurityDescriptor
 );
</pre></div>
</dd></dl><p><b>ObjectHandle: </b>An open object handle of any
type.</p><p><b>SecurityInformation: </b>A bitmask specifying
which portions of the security descriptor the caller is interested in.</p><p><b>SecurityDescriptor: </b>Used to return the
security descriptor containing the elements requested by the caller.</p><p><b>Return Values: </b>The following is a summary of
the return values that an implementation MUST return, as specified by the
message processing that follows.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>0x00000000</p>
  <p>STATUS_SUCCESS</p>
  </td>
  <td>
  <p>The request was successfully completed.</p>
  </td>
 </tr><tr>
  <td>
  <p>0xC0000022</p>
  <p>STATUS_ACCESS_DENIED</p>
  </td>
  <td>
  <p>The caller does not have the permissions to perform
  this operation.</p>
  </td>
 </tr><tr>
  <td>
  <p>0xC00000BB</p>
  <p>STATUS_NOT_SUPPORTED</p>
  </td>
  <td>
  <p>The request is not supported.</p>
  </td>
 </tr><tr>
  <td>
  <p>0xC0000008</p>
  <p>STATUS_INVALID_HANDLE</p>
  </td>
  <td>
  <p><i>ObjectHandle</i> is not a valid handle.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p>Processing:</p><p>This message takes three arguments:</p><p><i>ObjectHandle</i>: Can be an open handle of any type. If
the handle is not a valid context handle to an object or <i>ObjectHandle</i>.PolicyType
is not one of the following:</p><ul><li><p><span><span> 
</span></span>&#34;Policy&#34; for handles to policy objects</p>
</li><li><p><span><span> 
</span></span>&#34;Account&#34; for handles to <a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_b76eee27-064e-461b-81a9-fbf41e49928b" data-linktype="relative-path">account objects</a></p>
</li><li><p><span><span> 
</span></span>&#34;Secret&#34; for handles to <a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_9720ddb8-c802-40b7-8dba-5e7520c3396d" data-linktype="relative-path">secret objects</a></p>
</li><li><p><span><span> 
</span></span>&#34;Trusted Domain&#34; for handles to <a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_f2ceef4e-999b-4276-84cd-2e2829de5fc4" data-linktype="relative-path">trusted domain objects</a></p>
</li></ul><p>The server MUST return STATUS_INVALID_HANDLE. The access
required for a successful completion of this request depends on the <i>SecurityInformation</i>
parameter. The server MUST verify that <i>ObjectHandle</i> grants access as
specified in section <a href="d1c2802a-70d5-4f81-843c-6523ab0c5e03" data-linktype="relative-path">3.1.4.2.2</a>.
The following pseudocode specifies the RequiredAccess value to use in this
access check.</p><dl>
<dd>
<div><pre> Set RequiredAccess equal to 0
 IF ((SecurityInformation &amp; OWNER_SECURITY_INFORMATION) || (SecurityInformation &amp; GROUP_SECURITY_INFORMATION) || (SecurityInformation &amp; DACL_SECURITY_INFORMATION)) THEN
     RequiredAccess |= READ_CONTROL
 END IF
 IF (SecurityInformation &amp; SACL_SECURITY_INFORMATION) THEN
     RequiredAccess |= ACCESS_SYSTEM_SECURITY
 END IF
</pre></div>
</dd></dl><p><i>SecurityInformation</i>: A set of bits specifying which
portions of the security descriptor the caller is interested in retrieving. The
various bits and the associated access rights are specified in section <a href="62175da4-e30f-4c12-b1c4-dae0434e38af" data-linktype="relative-path">2.2.1.3</a>.</p><p><i>SecurityDescriptor</i>: An output parameter. If access
checks pass, the server MUST fill this information with a valid self-relative
security descriptor containing only the fields requested by the caller. The
server MUST NOT put information into the security descriptor that the caller
did not request.</p><p>It is valid for the server to not support this method for
all object types. If an object does not support this method, the server MUST
return STATUS_NOT_SUPPORTED.<a id="Appendix_A_Target_108"></a><a aria-label="Product behavior note 108" href="2a769a08-e023-459f-aebe-4fb3f595c0b7#Appendix_A_108" data-linktype="relative-path">&lt;108&gt;</a></p></div>