<div class="content" name="NetrUseGetInfo" uuid="2a025351-3e5b-466f-9ad5-534a2a716cbf"><p>The <b>NetrUseGetInfo</b> method retrieves details from a
remote workstation about a connection to a shared resource on an SMB server.
The server SHOULD NOT allow this method to be invoked remotely<a id="Appendix_A_Target_47"></a><a aria-label="Product behavior note 47" href="def80006-2495-4571-8a93-1668e0f8af31#Appendix_A_47" data-linktype="relative-path">&lt;47&gt;</a> and SHOULD return
ERROR_CALL_NOT_IMPLEMENTED.</p><dl>
<dd>
<div><pre> unsigned long NetrUseGetInfo(
   [in, string, unique] WKSSVC_IMPERSONATE_HANDLE ServerName,
   [in, string] wchar_t* UseName,
   [in] unsigned long Level,
   [out, switch_is(Level)] LPUSE_INFO InfoStruct
 );
</pre></div>
</dd></dl><p><b>ServerName: </b>A <b>WKSSVC_IMPERSONATE_HANDLE</b>
structure (section <a href="2427e140-22b3-45f8-9e12-1b3593308e46" data-linktype="relative-path">2.2.2.2</a>)
that identifies the <a href="3acf0e02-9bbd-4ce0-a7a0-586bc72d3ef4#gt_434b0234-e970-4e8c-bdfa-e16a30d96703" data-linktype="relative-path">server
(2)</a>. The <a href="3acf0e02-9bbd-4ce0-a7a0-586bc72d3ef4#gt_60e0e1fa-66fe-41e1-b5e3-ceab97e53506" data-linktype="relative-path">client</a> MUST
map this structure to an <a href="3acf0e02-9bbd-4ce0-a7a0-586bc72d3ef4#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a>
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). The server MUST ignore this parameter.</p><p><b>UseName: </b>A pointer to a string that specifies
the local device name or shared resource name for which to return information.</p><p><b>Level: </b>A value that specifies the information
level of the data. This parameter MUST be one of the following values;
otherwise, the server MUST fail the call with an ERROR_INVALID_LEVEL code.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0x00000000</td>
  <td>The buffer is a USE_INFO_0 structure (section 2.2.5.22).</td>
 </tr><tr>
  <td>0x00000001</td>
  <td>The buffer is a USE_INFO_1 structure (section 2.2.5.23).</td>
 </tr><tr>
  <td>0x00000002</td>
  <td>The buffer is a USE_INFO_2 structure (section 2.2.5.24).</td>
 </tr><tr>
  <td>0x00000003</td>
  <td>The buffer is a USE_INFO_3 structure (section 2.2.5.25).</td>
 </tr></tbody></table>
</dd></dl><p><b>InfoStruct: </b>A pointer to the buffer that
specifies the data. The format of this data depends on the value of the <i>Level</i>
parameter.</p><p><b>Return Values: </b>When the message processing
result meets the description in the right-hand column of the following table,
this method MUST return one of the following values (<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><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value/code</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>NERR_Success 0x00000000</td>
  <td>The operation completed successfully.</td>
 </tr><tr>
  <td>ERROR_ACCESS_DENIED 0x00000005</td>
  <td>Access is denied.</td>
 </tr><tr>
  <td>ERROR_INVALID_PARAMETER 0x00000057</td>
  <td>One of the function parameters is not valid.</td>
 </tr><tr>
  <td>ERROR_INVALID_LEVEL 0x0000007C</td>
  <td>The information level is invalid.</td>
 </tr><tr>
  <td>NERR_UseNotFound 0x000008CA</td>
  <td>The network connection could not be found.</td>
 </tr></tbody></table>
</dd></dl><p>The server SHOULD<a id="Appendix_A_Target_48"></a><a aria-label="Product behavior note 48" href="def80006-2495-4571-8a93-1668e0f8af31#Appendix_A_48" data-linktype="relative-path">&lt;48&gt;</a> enforce
security measures to verify that the caller has the required permissions to
execute this routine. If the server enforces security measures and the caller
does not have the required credentials, the server MUST fail the call with
ERROR_ACCESS_DENIED. Specifications for determining the identity of the caller
for the purpose of performing an access check are in <a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a>
section <a href="../ms-rpce/0e5b0e1c-0ba5-4342-bc36-30c66a9d07fd" data-linktype="relative-path">3.3.3.1.3</a>.</p><p>The <i>UseName</i> parameter specifies the local device name
or shared resource name for which to return information. The server MUST
canonicalize <i>UseName </i>(<a href="../ms-srvs/accf23b0-0f57-441c-9185-43041f1b0ee9" data-linktype="relative-path">[MS-SRVS]</a>
section <a href="../ms-srvs/e79aaff9-ba49-4548-8cc6-7041a7fcf907" data-linktype="relative-path">3.1.4.33</a>).
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 server MUST ensure that the remaining steps are executed
atomically with respect to other callers performing queries or updates to the <b>UseTable</b>
and <b>Connection</b> tables.</p><p>The server invokes the event to impersonate the client
([MS-RPCE] section <a href="../ms-rpce/a996aa17-8e04-4a25-806a-a3c724230e12" data-linktype="relative-path">3.3.3.4.3.1</a>)
passing in NULL as input parameter. If this event fails, the server MUST return
an error. If the event returns UserToken, the server MUST look in <b>UseTable</b>
for an entry where <b>UseEntry.UserToken</b> matches UserToken. If no match is
found, the server MUST fail the call with a NERR_UseNotFound error code.</p><p>If a match is found and <i>UseName</i> is a UNC path type,
the server MUST locate the connection where <i>UseName</i> matches <b>Connection.remote</b>.
If <i>UseName</i> is a local device name, the server MUST locate a <b>UseEntry.ConnectionTable</b>
where <i>UseName</i> matches <b>Connection.local</b>. If no match is found, the
server MUST fail the call with a NERR_UseNotFound error code. If a matching
connection is found, the server MUST return details about the connection on the
remote workstation.</p><p>The server MUST fill the return structures as follows:</p><ul><li><p><span><span> 
</span></span>If the <b>Level</b> member is 0, the server MUST return details
about the connection by filling the <b>USE_INFO_0_CONTAINER</b> structure
(section <a href="93aed681-2e57-41f7-84ca-4fb14ad5b7ba" data-linktype="relative-path">2.2.5.26</a>) in
the <b>Buffer</b> field of the <i>InfoStruct</i> parameter as follows. <b>USE_INFO_0_CONTAINER</b>
contains an array of <b>USE_INFO_0</b> structures.</p>
<ul><li><p><span><span>  </span></span><b>ui0_local</b>
set to <b>Connection.local</b></p>
</li><li><p><span><span>  </span></span><b>ui0_remote</b>
set to <b>Connection.Remote</b></p>
</li></ul></li><li><p><span><span> 
</span></span>If the <b>Level</b> member is 1, the server MUST return details
about the connection by filling the <b>USE_INFO_1_CONTAINER</b> structure (section
<a href="21a7e830-91b0-416e-a151-7760f3646d68" data-linktype="relative-path">2.2.5.27</a>) in the <b>Buffer</b>
field of the <i>InfoStruct</i> parameter as follows. <b>USE_INFO_1_CONTAINER</b>
contains an array of <b>USE_INFO_1</b> structures.</p>
<ul><li><p><span><span>  </span></span><b>ui1_local</b>
set to <b>Connection.local</b></p>
</li><li><p><span><span>  </span></span><b>ui1_remote</b>
set to <b>Connection.remote</b></p>
</li><li><p><span><span>  </span></span><b>ui1_password</b>
set to NULL</p>
</li><li><p><span><span>  </span></span><b>ui1_status</b>
set to <b>Connection.status</b></p>
</li><li><p><span><span>  </span></span><b>ui1_asg_type</b>
set to <b>Connection.asgtype</b></p>
</li><li><p><span><span>  </span></span><b>ui1_refcount</b>
set to <b>Connection.refcount</b></p>
</li><li><p><span><span>  </span></span><b>ui1_usecount</b>
set to <b>Connection.usecount</b></p>
</li></ul></li><li><p><span><span> 
</span></span>If the <b>Level</b> member is 2 or 3, the server MUST return details
about the connection by filling the <b>USE_INFO_2_CONTAINER</b> structure
(section <a href="f739de8a-b363-488e-a9c8-190ac6234189" data-linktype="relative-path">2.2.5.28</a>) in
the <b>Buffer</b> field of the <i>InfoStruct</i> parameter as follows. <b>USE_INFO_2_CONTAINER</b>
contains an array of <b>USE_INFO_2</b> structures.</p>
<ul><li><p><span><span>  </span></span><b>ui2_local</b>
set to <b>Connection.local</b></p>
</li><li><p><span><span>  </span></span><b>ui2_remote</b>
set to <b>Connection.remote</b></p>
</li><li><p><span><span>  </span></span><b>ui2_password</b>
set to NULL</p>
</li><li><p><span><span>  </span></span><b>ui2_status</b>
set to <b>Connection.status</b></p>
</li><li><p><span><span>  </span></span><b>ui2_asg_type</b>
set to <b>Connection.asgtype</b></p>
</li><li><p><span><span>  </span></span><b>ui2_refcount</b>
set to <b>Connection.refcount</b></p>
</li><li><p><span><span>  </span></span><b>ui2_usecount</b>
set to <b>Connection.usecount</b></p>
</li><li><p><span><span>  </span></span><b>ui2_username</b>
set to <b>Connection.username</b></p>
</li><li><p><span><span>  </span></span><b>ui2_domainname</b>
set to <b>Connection.domain</b></p>
</li></ul></li></ul><p>The server MUST invoke the event to end the client
impersonation ([MS-RPCE] section <a href="../ms-rpce/53d8f057-4e3a-4bc4-9355-a1cd781de901" data-linktype="relative-path">3.3.3.4.3.3</a>).</p></div>