<div class="content" name="NetrShareEnumSticky" uuid="f6fb470f-d980-42cd-9573-e034ee361aa1"><p>The NetrShareEnumSticky method retrieves information about
each <a href="1709f6a7-efb8-4ded-b7ae-5cee9ee36320#gt_f193d2af-d3e1-488d-b1da-c6f0a40eeb8f" data-linktype="relative-path">sticky shared</a>
resource whose IsPersistent setting is set in a <b>ShareList</b>.</p><dl>
<dd>
<div><pre> NET_API_STATUS NetrShareEnumSticky(
   [in, string, unique] SRVSVC_HANDLE ServerName,
   [in, out] LPSHARE_ENUM_STRUCT InfoStruct,
   [in] DWORD PreferedMaximumLength,
   [out] DWORD* TotalEntries,
   [in, out, unique] DWORD* ResumeHandle
 );
</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 RPC 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>InfoStruct: </b>A pointer to a structure, in the
format of a <a href="79ee052e-e16b-4ec5-b4b7-e99777c26eca" data-linktype="relative-path">SHARE_ENUM_STRUCT (section 2.2.4.38)</a>.
The <b>SHARE_ENUM_STRUCT</b> structure has a <b>Level</b> member that specifies
the type of structure to return in the <b>ShareInfo</b> member. The <b>Level</b>
member MUST be set to one of the values specified in section 2.2.4.38
(excluding <a href="18fa9da8-8a98-4cbe-a026-899a4fb5eefe" data-linktype="relative-path">SHARE_INFO_501_CONTAINER</a>).</p><p><b>PreferedMaximumLength: </b>Specifies the preferred
maximum length, in bytes, of the returned data. If the specified value is
MAX_PREFERRED_LENGTH, the method MUST attempt to return all entries.</p><p><b>TotalEntries: </b>The total number of entries that
could have been enumerated if the buffer had been big enough to hold all the
entries.</p><p><b>ResumeHandle: </b>A pointer to a value that
contains a handle, which is used to continue an existing <a href="1709f6a7-efb8-4ded-b7ae-5cee9ee36320#gt_866b0055-ceba-4acf-a692-98452943b981" data-linktype="relative-path">connection</a> search. The
handle MUST be zero on the first call and remain unchanged for subsequent
calls. If the <i>ResumeHandle</i> parameter is NULL, a resume handle MUST NOT
be stored. If this parameter is not NULL and the method returns
ERROR_MORE_DATA, this parameter receives an implementation-specific nonzero
value that can be passed in subsequent calls to this method to continue with
the enumeration. </p><dl>
<dd>
<p>If this parameter is NULL or points to 0x00000000,
the enumeration starts from the beginning of the list of the currently active
connections.</p>
</dd></dl><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>.
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>0x00000000 NERR_Success</td>
  <td>The client request succeeded.</td>
 </tr><tr>
  <td>0x000000EA ERROR_MORE_DATA</td>
  <td>The client request succeeded. More entries are available. Not all entries could be returned in the buffer size that is specified by PreferedMaximumLength.</td>
 </tr><tr>
  <td>0x0000084B NERR_BufTooSmall</td>
  <td>The client request succeeded. More entries are available. The buffer size that is specified by PreferedMaximumLength was too small to fit even a single entry.</td>
 </tr></tbody></table>
</dd></dl><p>In response to a NetrShareEnumSticky message, the server
MUST enumerate all the sticky shares in the <b>ShareList</b> whose <b>IsPersistent</b>
setting is set, or return an error code. If the server is restarted, any shares
that are created before the restart that are not sticky MUST be forgotten.
Information about sticky shares MUST be stored in a persistent store,<a id="Appendix_A_Target_60"></a><a aria-label="Product behavior note 60" href="ebb74ff2-abb1-4e1b-a76a-563a5cbbea9a#Appendix_A_60" data-linktype="relative-path">&lt;60&gt;</a> and the shares MUST be restored
(that is, re-created on the server) after the server is restarted.</p><p>The NetrShareEnumSticky method MUST NOT support Level 501
and MUST enumerate only sticky shares. Other than this difference, the server
MUST process this message in exactly the same manner as the <a href="c4a98e7b-d416-439c-97bd-4d9f52f8ba52" data-linktype="relative-path">NetrShareEnum</a> message.</p></div>