<div class="content" name="LsarQuerySecurityObject" uuid="6b3291a2-1265-498e-8e9d-f7e28962255e"><p>The LsarQuerySecurityObject method is invoked to query
security information that is assigned to a database object. It returns the <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_e5213722-75a9-44e7-b026-8e4833f0d350" data-linktype="relative-path">security
descriptor</a></span> 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>0x00000000 STATUS_SUCCESS</td>
  <td>The request was successfully completed.</td>
 </tr><tr>
  <td>0xC0000022 STATUS_ACCESS_DENIED</td>
  <td>The caller does not have the permissions to perform this operation.</td>
 </tr><tr>
  <td>0xC00000BB STATUS_NOT_SUPPORTED</td>
  <td>The request is not supported.</td>
 </tr><tr>
  <td>0xC0000008 STATUS_INVALID_HANDLE</td>
  <td>ObjectHandle is not a valid handle.</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 <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_b76eee27-064e-461b-81a9-fbf41e49928b" data-linktype="relative-path">account objects</a></span></p>
</li><li><p><span><span> 
</span></span>&#34;Secret&#34; for handles to <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_9720ddb8-c802-40b7-8dba-5e7520c3396d" data-linktype="relative-path">secret objects</a></span></p>
</li><li><p><span><span> 
</span></span>&#34;Trusted Domain&#34; for handles to <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_f2ceef4e-999b-4276-84cd-2e2829de5fc4" data-linktype="relative-path">trusted
domain objects</a></span></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 <span><a href="d1c2802a-70d5-4f81-843c-6523ab0c5e03" data-linktype="relative-path">3.1.4.2.2</a></span>. 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 <span><a href="62175da4-e30f-4c12-b1c4-dae0434e38af" data-linktype="relative-path">2.2.1.3</a></span>.
The server MUST reject calls that specify a bit that is not defined in section
2.2.1.3.<a id="Appendix_A_Target_112"></a><a aria-label="Product behavior note 112" href="2a769a08-e023-459f-aebe-4fb3f595c0b7#Appendix_A_112" data-linktype="relative-path">&lt;112&gt;</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_113"></a><a aria-label="Product behavior note 113" href="2a769a08-e023-459f-aebe-4fb3f595c0b7#Appendix_A_113" data-linktype="relative-path">&lt;113&gt;</a></p></div>