<div class="content" name="LsarDeleteObject" uuid="8d0aa2dc-22b6-4bc3-b5d2-79b4b0ad7bce"><p>The LsarDeleteObject method is invoked to delete an open <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_b76eee27-064e-461b-81a9-fbf41e49928b" data-linktype="relative-path">account
object</a></span>, <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_9720ddb8-c802-40b7-8dba-5e7520c3396d" data-linktype="relative-path">secret object</a></span>, or <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_f2ceef4e-999b-4276-84cd-2e2829de5fc4" data-linktype="relative-path">trusted
domain object</a></span>.</p><dl>
<dd>
<div><pre> NTSTATUS LsarDeleteObject(
   [in, out] LSAPR_HANDLE* ObjectHandle
 );
</pre></div>
</dd></dl><p><b>ObjectHandle: </b>A handle to an open object of
the correct type to be deleted. After successful completion of the call, the
handle value cannot be reused.</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>0xC000000D STATUS_INVALID_PARAMETER</td>
  <td>One or more of the supplied parameters was invalid.</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 one input parameter.</p><p><i>ObjectHandle</i>: An open handle to an object that is to
be deleted. 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 account objects</p>
</li><li><p><span><span> 
</span></span>&#34;Secret&#34; for handles to secret objects</p>
</li><li><p><span><span> 
</span></span>&#34;Trusted Domain&#34; for handles to trusted domain objects</p>
</li></ul><p>The server MUST return STATUS_INVALID_HANDLE. Policy objects
cannot be deleted. Attempts to delete policy objects MUST fail with
STATUS_INVALID_PARAMETER. For other object types, 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> with
RequiredAccess set to DELETE.</p><p>The server MUST make all subsequent requests to deleted
objects through already opened handles fail with STATUS_INVALID_HANDLE. The
deleted handle MUST be automatically closed by the server; the caller need not
close it.</p><p>If the object being deleted is a <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_f2f00d47-6cf2-4b32-b8f7-b63e38e2e9c4" data-linktype="relative-path">trusted domain</a></span>, then
the server MUST also check whether an <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_ba0d31d7-aa03-4e10-936a-a0ebd276ebc9" data-linktype="relative-path">interdomain trust account</a></span>
with name &#34;&lt;Trusted Domain NetBIOS Name&gt;$&#34; exists. If it
exists, the server MUST delete that account along with the trusted domain.</p><p>The server MUST free any resources associated with the
LsaContextHandle element (section <span><a href="1011130b-0413-460d-81ed-d1821d141639" data-linktype="relative-path">3.1.1.7</a></span>) that is
represented by <i>ObjectHandle</i>, as specified in section <span><a href="2184a151-ce74-4e1e-8ba7-25384f51dbf8" data-linktype="relative-path">3.1.6.1</a></span>,
LSAPR_HANDLE_rundown.</p><p>The fact that a handle is no longer usable is communicated
to the <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_c2eeb200-3cd0-4916-966e-d7d6bff1737a" data-linktype="relative-path">RPC transport</a></span> by
returning a NULL value in the handle parameter, as specified in <span><a href="https://go.microsoft.com/fwlink/?LinkId=89824" data-linktype="external">[C706]</a></span>
section 5.1.6.</p></div>