<div class="content" name="NetrShareGetInfo" uuid="b2c2b995-8c42-4502-b7d7-646d1b295c5b"><p>The NetrShareGetInfo method retrieves information about a
particular shared resource on the <a href="1709f6a7-efb8-4ded-b7ae-5cee9ee36320#gt_434b0234-e970-4e8c-bdfa-e16a30d96703" data-linktype="relative-path">server</a> from the <b>ShareList</b>.</p><dl>
<dd>
<div><pre> NET_API_STATUS NetrShareGetInfo(
   [in, string, unique] SRVSVC_HANDLE ServerName,
   [in, string] WCHAR* NetName,
   [in] DWORD Level,
   [out, switch_is(Level)] LPSHARE_INFO InfoStruct
 );
</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 server. 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 (<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 return information for.</p><p><b>Level: </b>Specifies the information level of the
data. This parameter MUST be one of the following values.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0</td>
  <td>LPSHARE_INFO_0</td>
 </tr><tr>
  <td>1</td>
  <td>LPSHARE_INFO_1</td>
 </tr><tr>
  <td>2</td>
  <td>LPSHARE_INFO_2</td>
 </tr><tr>
  <td>501</td>
  <td>LPSHARE_INFO_501</td>
 </tr><tr>
  <td>502</td>
  <td>LPSHARE_INFO_502_I</td>
 </tr><tr>
  <td>503</td>
  <td>LPSHARE_INFO_503_I</td>
 </tr><tr>
  <td>1005</td>
  <td>LPSHARE_INFO_1005</td>
 </tr></tbody></table>
</dd></dl><p><b>InfoStruct: </b>This parameter is of type <a href="419f538b-9342-455e-9b8c-fa430e77bc54" data-linktype="relative-path">LPSHARE_INFO</a> union, as
specified in section 2.2.3.6. Its contents are determined by the value of the <i>Level</i>
parameter, as shown in the preceding table.</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>.
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>0x00000005 ERROR_ACCESS_DENIED</td>
  <td>Access is denied.</td>
 </tr><tr>
  <td>0x0000007C ERROR_INVALID_LEVEL</td>
  <td>The system call level is not correct.</td>
 </tr><tr>
  <td>0x00000057 ERROR_INVALID_PARAMETER</td>
  <td>The client request failed because the specified parameter is invalid.</td>
 </tr><tr>
  <td>0x00000008 ERROR_NOT_ENOUGH_MEMORY</td>
  <td>Not enough storage is available to process this command.</td>
 </tr><tr>
  <td>0x0000084B NERR_BufTooSmall</td>
  <td>The supplied buffer is too small.</td>
 </tr><tr>
  <td>0x00000906 NERR_NetNameNotFound</td>
  <td>The share name does not exist.</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
parameter <i>ServerName</i> 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 <i>NetName</i> parameter specifies the name of the share
for which to return information. This MUST be a nonempty null-terminated UTF-16
string; otherwise, the server MUST fail the call with an
ERROR_INVALID_PARAMETER error code.</p><p>The value of the <i>Level</i> parameter can be 0, 1, 2, 501,
502, 503, or 1005. If the value of the <i>Level</i> parameter is anything else,
the server MUST fail the call with an ERROR_INVALID_LEVEL error code. The value
of the <i>Level</i> parameter determines the format of the <i>InfoStruct</i>
parameter. </p><p>The server MUST locate a <b>Share</b> from <b>ShareList</b>,
where <i>NetName</i> matches <b>Share.ShareName</b> and the normalized <i>ServerName</i>
matches <b>Share.ServerName</b>. If no share is found, the server MUST fail the
call with NERR_NetNameNotFound error code. If a matching <b>Share</b> is found,
the server MUST query share properties by invoking the underlying server events
as specified in <a href="../ms-cifs/d416ff7c-c536-406e-a951-4f04b2fd1d2b" data-linktype="relative-path">[MS-CIFS]</a>
section <a href="../ms-cifs/c5193839-4cd5-4f95-8ada-df13584251ce" data-linktype="relative-path">3.3.4.12</a>
or <a href="../ms-smb/f210069c-7086-4dc2-885e-861d837df688" data-linktype="relative-path">[MS-SMB]</a>
section <a href="../ms-smb/8708a390-e791-48d7-aa2a-bdaceaefecbd" data-linktype="relative-path">3.3.4.7</a>,
and <a href="../ms-smb2/5606ad47-5ee0-437a-817e-70c366052962" data-linktype="relative-path">[MS-SMB2]</a>
section <a href="../ms-smb2/13acd5bf-3518-4dfd-8e06-a2e5cc45bf04" data-linktype="relative-path">3.3.4.16</a>,
providing the tuple &lt;<i>normalized server name</i>, <i>NetName</i>&gt; as
the input parameter. When the server receives STATUS_SUCCESS for a share, it
MUST consider the received SHARE_INFO_503_I and SHARE_INFO_1005 structures as
valid. The server MUST return information about the shared resource on the
server. </p><p>The server MUST use the <b>share</b> in valid
SHARE_INFO_503_I and SHARE_INFO_1005 structures from either CIFS or SMB2
servers and fill the return structures as follows. The server MUST discard the
structures received from other file server except the value of <b>share.shi503_current_uses</b>.</p><p>If the value of the <i>Level</i> parameter is 0, the server
MUST return information about the <b>share</b> by filling the SHARE_INFO_0
structure in the <b>ShareInfo0</b> member of the <i>InfoStruct</i> parameter.</p><ul><li><p><span><span> 
</span></span><b>shi0_netname</b> MUST be set to <b>share.shi503_netname</b>.</p>
</li></ul><p>If the value of the <i>Level</i> parameter is 1, the server
MUST return information about the <b>share</b> by filling the SHARE_INFO_1
structure in the <b>ShareInfo1</b> member of the <i>InfoStruct</i> parameter.</p><ul><li><p><span><span> 
</span></span><b>shi1_netname</b> MUST be set to <b>share.shi503_netname</b>.</p>
</li><li><p><span><span> 
</span></span><b>shi1_type</b> MUST be set to <b>share.shi503_type</b>.</p>
</li><li><p><span><span> 
</span></span><b>shi1_remark</b> MUST be set to <b>share.shi503_remark</b>.</p>
</li></ul><p>If the value of the <i>Level</i> parameter is 2, the server
MUST return information about the <b>share</b> by filling the SHARE_INFO_2
structure in the <b>ShareInfo2</b> member of the <i>InfoStruct</i> parameter.</p><ul><li><p><span><span> 
</span></span><b>shi2_netname</b> MUST be set to <b>share.shi503_netname</b>.</p>
</li><li><p><span><span> 
</span></span><b>shi2_type</b> MUST be set to <b>share.shi503_type</b>.</p>
</li><li><p><span><span> 
</span></span><b>shi2_remark</b> MUST be set to <b>share.shi503_remark</b>.</p>
</li><li><p><span><span> 
</span></span><b>shi2_permissions</b> MUST be set to <b>share.shi503_permissions</b>.</p>
</li><li><p><span><span> 
</span></span><b>shi2_max_uses</b> MUST be set to <b>share.shi503_max_uses</b>.</p>
</li><li><p><span><span> 
</span></span><b>shi2_current_uses</b> MUST be set to the sum of <b>share.shi503_current_uses</b>
values retrieved from both CIFS and SMB2 servers.</p>
</li><li><p><span><span> 
</span></span><b>shi2_path</b> MUST be set to <b>share.shi503_path</b>.</p>
</li><li><p><span><span> 
</span></span><b>shi2_passwd</b> MUST be set to <b>share.shi503_passwd</b>.</p>
</li></ul><p>If the value of the <i>Level</i> parameter is 501, the
server MUST return information about the <b>share</b> by filling the
SHARE_INFO_501 structure in the <b>ShareInfo501</b> member of the <i>InfoStruct</i>
parameter.</p><ul><li><p><span><span> 
</span></span><b>shi501_netname</b> MUST be set to <b>share.shi503_netname</b>.</p>
</li><li><p><span><span> 
</span></span><b>shi501_type</b> MUST be set to <b>share.shi503_type</b>.</p>
</li><li><p><span><span> 
</span></span><b>shi501_remark</b> MUST be set to <b>share.shi503_remark</b>.</p>
</li><li><p><span><span> 
</span></span><b>shi501_flags</b> MUST be set to <b>share.ShareFlags</b>.</p>
</li></ul><p>If the value of the <i>Level</i> parameter is 502, the
server MUST return information about the <b>share</b> by filling the
SHARE_INFO_502_I structure in the <b>ShareInfo502</b> member of the <i>InfoStruct</i>
parameter.</p><ul><li><p><span><span> 
</span></span><b>shi502_netname</b> MUST be set to <b>share.shi503_netname</b>.</p>
</li><li><p><span><span> 
</span></span><b>shi502_type</b> MUST be set to <b>share.shi503_type</b>.</p>
</li><li><p><span><span> 
</span></span><b>shi502_remark</b> MUST be set to <b>share.shi503_remark</b>.</p>
</li><li><p><span><span> 
</span></span><b>shi502_permissions</b> MUST be set to <b>share.shi503_permissions</b>.</p>
</li><li><p><span><span> 
</span></span><b>shi502_max_uses</b> MUST be set to <b>share.shi503_max_uses</b>.</p>
</li><li><p><span><span> 
</span></span><b>shi502_current_uses</b> MUST be set to the sum of <b>share.shi503_current_uses</b>
values retrieved from both CIFS and SMB2 servers.</p>
</li><li><p><span><span> 
</span></span><b>shi502_path</b> MUST be set to <b>share.shi503_path</b>.</p>
</li><li><p><span><span> 
</span></span><b>shi502_passwd</b> MUST be set to <b>share.shi503_passwd</b>.</p>
</li><li><p><span><span> 
</span></span><b>shi502_security_descriptor</b> MUST be set to <b>share.shi503_security_descriptor</b>.</p>
</li></ul><p>If the value of the <i>Level</i> parameter is 503, the
server MUST return information about the <b>share</b> in the SHARE_INFO_503_I
structure by filling the SHARE_INFO_503_I structure in the <b>ShareInfo503</b>
member of the <i>InfoStruct</i> parameter, except that <b>shi503_current_uses</b>
MUST be set to the sum of <b>share.shi503_current_uses</b> values retrieved
from both CIFS and SMB2 servers.</p><p>The server MUST set the STYPE_CLUSTER_FS,
STYPE_CLUSTER_SOFS, and STYPE_CLUSTER_DFS bits of the shi*_type field to zero;
the client MUST ignore them on receipt.</p><p>If the value of the <i>Level</i> parameter is 1005, the
server MUST return information about the <b>share</b> in the SHARE_INFO_1005
structure directly by filling the SHARE_INFO_1005 structure in the <b>ShareInfo1005</b>
member of the <i>InfoStruct</i> parameter.</p><p>If both the SMB server and the SMB2 server return an error,
the server MUST fail the call with NERR_NetNameNotFound error code.</p><p>The server SHOULD<a id="Appendix_A_Target_61"></a><a aria-label="Product behavior note 61" href="ebb74ff2-abb1-4e1b-a76a-563a5cbbea9a#Appendix_A_61" data-linktype="relative-path">&lt;61&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_62"></a><a aria-label="Product behavior note 62" href="ebb74ff2-abb1-4e1b-a76a-563a5cbbea9a#Appendix_A_62" data-linktype="relative-path">&lt;62&gt;</a> fail the call.</p></div>