<div class="content"><p> </p><p>The NetrShareDel method deletes a share name from the <b>ShareList</b>,
which disconnects all <span><a href="1709f6a7-efb8-4ded-b7ae-5cee9ee36320#gt_866b0055-ceba-4acf-a692-98452943b981" data-linktype="relative-path">connections</a></span> to the
shared resource. If the share is <span><a href="1709f6a7-efb8-4ded-b7ae-5cee9ee36320#gt_f193d2af-d3e1-488d-b1da-c6f0a40eeb8f" data-linktype="relative-path">sticky</a></span>, all
information about the share is also deleted from permanent storage.<a id="Appendix_A_Target_67"></a><a aria-label="Product behavior note 67" href="ebb74ff2-abb1-4e1b-a76a-563a5cbbea9a#Appendix_A_67" data-linktype="relative-path">&lt;67&gt;</a></p><dl>
<dd>
<div><pre> NET_API_STATUS NetrShareDel(
   [in, string, unique] SRVSVC_HANDLE ServerName,
   [in, string] WCHAR* NetName,
   [in] DWORD Reserved
 );
</pre></div>
</dd></dl><p><b>ServerName: </b>An <span><a href="5f8329ee-1965-4ea1-ad35-3b29fbb63232" data-linktype="relative-path">SRVSVC_HANDLE (section 2.2.1.1)</a></span>
pointer that identifies the <span><a href="1709f6a7-efb8-4ded-b7ae-5cee9ee36320#gt_434b0234-e970-4e8c-bdfa-e16a30d96703" data-linktype="relative-path">server</a></span>. The <span><a href="1709f6a7-efb8-4ded-b7ae-5cee9ee36320#gt_60e0e1fa-66fe-41e1-b5e3-ceab97e53506" data-linktype="relative-path">client</a></span>
MUST map this structure to an RPC binding handle (<span><a href="https://go.microsoft.com/fwlink/?LinkId=89824" data-linktype="external">[C706]</a></span> 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>The server MUST ignore this
parameter.<a id="Appendix_A_Target_68"></a><a aria-label="Product behavior note 68" href="ebb74ff2-abb1-4e1b-a76a-563a5cbbea9a#Appendix_A_68" data-linktype="relative-path">&lt;68&gt;</a></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 <span><a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a></span>
section <span><a href="../ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d" data-linktype="relative-path">2.2</a></span>.
The most common error codes are listed in the following table.</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>NERR_Success</p>
  </td>
  <td>
  <p>The client request succeeded.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000005</p>
  <p>ERROR_ACCESS_DENIED</p>
  </td>
  <td>
  <p>Access is denied.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000057</p>
  <p>ERROR_INVALID_PARAMETER</p>
  </td>
  <td>
  <p>The client request failed because the specified
  parameter is invalid.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000008</p>
  <p>ERROR_NOT_ENOUGH_MEMORY</p>
  </td>
  <td>
  <p>Not enough storage is available to process this
  command.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000906</p>
  <p>NERR_NetNameNotFound</p>
  </td>
  <td>
  <p>The share name does not exist.</p>
  </td>
 </tr></tbody></table>
</dd></dl><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 <span><a href="281119a2-9545-4d8d-b186-6e85b412f4ff" data-linktype="relative-path">3.1.6.8</a></span>, passing in
the updated <i>ServerName</i> parameter as the ServerName, and an empty string
as the ShareName.</p><p>The server MUST look up the <b>ShareList</b> and locate a <b>Share</b>
where <i>NetName</i> matches <b>Share.ShareName</b> and <i>ServerName</i>
matches <b>Share.ServerName</b>. If no match is found, the server MUST fail the
call with a NERR_NetNameNotFound error code. If a matching share is found, the
server MUST remove the share from <b>ShareList</b> and free the share object. </p><p>If the Share is found and <b>Share.IsPrinterShare</b> is
TRUE, <b>PrinterShareCount</b> MUST be decreased by 1. If <b>PrinterShareCount</b>
becomes 0, the server MUST invoke the events as specified in section <span><a href="12bdc7cd-d73a-4468-a83f-09e04547ad71" data-linktype="relative-path">3.1.6.10</a></span>,
providing SV_TYPE_PRINTQ_SERVER as input parameter.</p><p>The server MUST delete the Share by invoking underlying
server event as specified in <span><a href="../ms-cifs/d416ff7c-c536-406e-a951-4f04b2fd1d2b" data-linktype="relative-path">[MS-CIFS]</a></span>
section <span><a href="../ms-cifs/7c96c13d-e5de-4326-a9c7-aae97250a66a" data-linktype="relative-path">3.3.4.11</a></span>
and <span><a href="../ms-smb2/5606ad47-5ee0-437a-817e-70c366052962" data-linktype="relative-path">[MS-SMB2]</a></span>
section <span><a href="../ms-smb2/9b634aad-c492-4c27-9918-4ef2e7aef76d" data-linktype="relative-path">3.3.4.15</a></span>,
providing tuple &lt;<i>ServerName</i>, <i>NetName</i>&gt; as input parameters.
If either CIFS or SMB2 servers return STATUS_SUCCESS, the server MUST return
NERR_Success. Otherwise, the server MUST fail the call with an
implementation-dependent error.</p><p>The server SHOULD<a id="Appendix_A_Target_69"></a><a aria-label="Product behavior note 69" href="ebb74ff2-abb1-4e1b-a76a-563a5cbbea9a#Appendix_A_69" data-linktype="relative-path">&lt;69&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_70"></a><a aria-label="Product behavior note 70" href="ebb74ff2-abb1-4e1b-a76a-563a5cbbea9a#Appendix_A_70" data-linktype="relative-path">&lt;70&gt;</a> fail the call.</p></div>