<div class="content" name="NetrShareDelStart" uuid="34819f8d-08c6-4635-a8ce-af527d945dc9"><p>The NetrShareDelStart method performs the initial phase of a
two-phase share delete.</p><dl>
<dd>
<div><pre> NET_API_STATUS NetrShareDelStart(
   [in, string, unique] SRVSVC_HANDLE ServerName,
   [in, string] WCHAR* NetName,
   [in] DWORD Reserved,
   [out] PSHARE_DEL_HANDLE ContextHandle
 );
</pre></div>
</dd></dl><p><b>ServerName: </b>An <a href="5f8329ee-1965-4ea1-ad35-3b29fbb63232" data-linktype="relative-path">SRVSVC_HANDLE (section 2.2.1.1)</a>
pointer that identifies the <a href="1709f6a7-efb8-4ded-b7ae-5cee9ee36320#gt_434b0234-e970-4e8c-bdfa-e16a30d96703" data-linktype="relative-path">server</a>.
The <a href="1709f6a7-efb8-4ded-b7ae-5cee9ee36320#gt_60e0e1fa-66fe-41e1-b5e3-ceab97e53506" data-linktype="relative-path">client</a> MUST map this
structure to an <a href="1709f6a7-efb8-4ded-b7ae-5cee9ee36320#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a>
binding handle (see <a href="https://go.microsoft.com/fwlink/?LinkId=89824" data-linktype="external">[C706]</a>
sections 4.3.5 and 5.1.5.2). If this parameter is NULL, the local computer is
used.</p><p><b>NetName: </b>A pointer to a null-terminated UTF-16
string that specifies the name of the share to delete.</p><p><b>Reserved: </b>Reserved; SHOULD be set to zero when
sent and MUST be ignored on receipt.</p><p><b>ContextHandle: </b>A handle for the second phase
of the two-phase share delete, in the form of a <a href="447d2eb0-d16a-419c-9138-226886784c34" data-linktype="relative-path">PSHARE_DEL_HANDLE (section 2.2.1.3)</a>
data type.</p><p><b>Return Values: </b>The method returns 0x00000000
(NERR_Success) to indicate success; otherwise, it returns a nonzero error code.
The method can take any specific error code value, as specified in <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>
section <a href="../ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d" data-linktype="relative-path">2.2</a>.
</p><p>In response to a NetrShareDelStart request, the server MUST
mark a share for deletion and return to the client an RPC context handle that
the client can use to actually perform the deletion by calling the <a href="04ebf798-ba19-45c6-8ca4-876671e17bc7" data-linktype="relative-path">NetrShareDelCommit</a> method.</p><p>This two-phase deletion MUST be used to delete IPC$, which
is the share that is used for <a href="1709f6a7-efb8-4ded-b7ae-5cee9ee36320#gt_34f1dfa8-b1df-4d77-aa6e-d777422f9dca" data-linktype="relative-path">named
pipes</a>. Deleting IPC$ results in the closing of the pipe on which the RPC is
being executed. Thus, the client never receives the response to the RPC. The
two-phase delete offers a positive response in phase 1 and then an expected
error in phase 2.</p><p>If <i>ServerName</i> does not match any <b>Transport.ServerName</b>
in <b>TransportList</b> with the SVTI2_SCOPED_NAME bit set in <b>Transport.Flags</b>,
the server MUST reset <i>ServerName</i> as &#34;*&#34;.</p><p>The server MUST remove any preceding &#34;\\&#34; from the
<i>ServerName</i> parameter and normalize the <i>ServerName</i> parameter as
specified in section <a href="281119a2-9545-4d8d-b186-6e85b412f4ff" data-linktype="relative-path">3.1.6.8</a>,
passing in the updated <i>ServerName</i> parameter as the ServerName, and an
empty string as the ShareName.</p><p>The server MUST search through <b>ShareList</b> and locate a
<b>Share</b> where <b>Share.ShareName</b> matches <b>NetName</b> and <b>Share.ServerName</b>
matches <i>ServerName</i>. If a match is not found, the server MUST fail the
call with an NERR_NetNameNotFound error code.</p><p>If a match is found, the server MUST mark the share for
deletion by setting the <b>IsMarkedForDeletion</b> member of the Share element
in <b>ShareList</b>. The share MUST remain available until the client
calls the NetrShareDelCommit method.</p><p>The server MUST return a handle to the share being deleted
in the <i>ContextHandle</i> parameter. The client is expected to use the handle
to actually delete the share by calling the <b>NetrShareDelCommit</b> method.</p><p>The server SHOULD<a id="Appendix_A_Target_76"></a><a aria-label="Product behavior note 76" href="ebb74ff2-abb1-4e1b-a76a-563a5cbbea9a#Appendix_A_76" data-linktype="relative-path">&lt;76&gt;</a> enforce
security measures to verify that the caller has the required permissions to
execute this routine. If the caller does not have the required credentials, the
server SHOULD<a id="Appendix_A_Target_77"></a><a aria-label="Product behavior note 77" href="ebb74ff2-abb1-4e1b-a76a-563a5cbbea9a#Appendix_A_77" data-linktype="relative-path">&lt;77&gt;</a> fail the call.</p></div>