Platform SDK: Network Management

NetUseGetInfo

The NetUseGetInfo function retrieves information about a connection to a shared resource.

Win32-based applications can also use the WNetGetConnection function to retrieve the name of a network resource associated with a local device.

Security Requirements

No special group membership is required to call the NetUseGetInfo function. This function cannot be executed on a remote server.

NET_API_STATUS NetUseGetInfo (
  LPWSTR UncServerName,
  LPWSTR UseName,
  DWORD Level,
  LPBYTE *BufPtr
);

Parameters

UncServerName
[in] Reserved; must be NULL.
UseName
[in] Pointer to a Unicode string specifying the name of the connection for which to return information.
Level
[in] Specifies the information level of the data. This parameter can be one of the following values.
Value Meaning
0 Specifies a local device name and the share name of a remote resource. The BufPtr parameter is a pointer to a USE_INFO_0 structure.
1 Specifies information about the connection between a local device and a shared resource, including connection status and type. The BufPtr parameter is a pointer to a USE_INFO_1 structure.
2 Specifies information about the connection between a local device and a shared resource. Information includes the connection status, connection type, user name, and domain name. The BufPtr parameter is a pointer to a USE_INFO_2 structure.

BufPtr
[out] Pointer to the buffer that receives the data. The format of this data depends on the value of the Level parameter. This buffer is allocated by the system and must be freed using the NetApiBufferFree function.

Return Values

If the function succeeds, the return value is NERR_Success.

If the function fails, the return value is a Win32 API error code. For a list of error codes, see Error Codes.

Remarks

To list all current connections between the local computer and resources on remote servers, you can call the NetUseEnum function.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Unsupported.
  Header: Declared in Lmuse.h; include Lm.h.
  Library: Use Netapi32.lib.

See Also

Network Management Overview, Network Management Functions, Use Functions, USE_INFO_0, USE_INFO_1, USE_INFO_2, WNetGetConnection, NetUseEnum