Events
Nov 19, 11 PM - Nov 21, 11 PM
Gain the competitive edge you need with powerful AI and Cloud solutions by attending Microsoft Ignite online.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
The NetUseEnum function lists all current connections between the local computer and resources on remote servers.
You can also use the WNetOpenEnum and the WNetEnumResource functions to enumerate network resources or connections.
NET_API_STATUS NET_API_FUNCTION NetUseEnum(
[in] LMSTR UncServerName,
[in] DWORD LevelFlags,
[out] LPBYTE *BufPtr,
[in] DWORD PreferedMaximumSize,
[out] LPDWORD EntriesRead,
[out] LPDWORD TotalEntries,
[in, out] LPDWORD ResumeHandle
);
[in] UncServerName
The UNC name of the computer on which to execute this function. If this is parameter is NULL, then the local computer is used. If the UncServerName parameter specified is a remote computer, then the remote computer must support remote RPC calls using the legacy Remote Access Protocol mechanism.
This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined.
[in] LevelFlags
The information level of the data requested. This parameter can be one of the following values.
Value | Meaning |
---|---|
|
Specifies a local device name and the share name of a remote resource. The BufPtr parameter points to an array of USE_INFO_0 structures. |
|
Specifies information about the connection between a local device and a shared resource, including connection status and type. The BufPtr parameter points to an array of USE_INFO_1 structures. |
|
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 points to an array of USE_INFO_2 structures. |
[out] BufPtr
A pointer to the buffer that receives the information structures. 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 when the information is no longer needed. Note that you must free the buffer even if the function fails with ERROR_MORE_DATA.
[in] PreferedMaximumSize
The preferred maximum length, in bytes, of the data to return. If MAX_PREFERRED_LENGTH is specified, the function allocates the amount of memory required for the data. If another value is specified in this parameter, it can restrict the number of bytes that the function returns. If the buffer size is insufficient to hold all entries, the function returns ERROR_MORE_DATA. For more information, see Network Management Function Buffers and Network Management Function Buffer Lengths.
[out] EntriesRead
A pointer to a value that receives the count of elements actually enumerated.
[out] TotalEntries
A pointer to a value that receives the total number of entries that could have been enumerated from the current resume position. Note that applications should consider this value only as a hint.
[in, out] ResumeHandle
A pointer to a value that contains a resume handle which is used to continue the search. The handle should be zero on the first call and left unchanged for subsequent calls. If ResumeHandle is NULL, then no resume handle is stored.
If the function succeeds, the return value is NERR_Success.
If the function fails, the return value is a system error code. For a list of error codes, see System Error Codes.
Return code | Description |
---|---|
|
An invalid parameter was passed to the function. This error is returned if a NULL pointer is passed in the BufPtr or entriesread parameters. |
|
There is more data to return. This error is returned if the buffer size is insufficient to hold all entries. |
|
The request is not supported. This error is returned if the UncServerName parameter was not NULL and the remote server does not support remote RPC calls using the legacy Remote Access Protocol mechanism. |
|
Use FormatMessage to obtain the message string for the returned error. |
No special group membership is required to call the NetUseEnum function. This function cannot be executed on a remote server except in cases of downlevel compatibility using the legacy Remote Access Protocol.
To retrieve information about one network connection, you can call the NetUseGetInfo function.
This function applies only to the Server Message Block (LAN Manager Workstation) client. The NetUseEnum function does not support Distributed File System (DFS) shares. To enumerate shares using a different network provider (WebDAV or a DFS share, for example), use the WNetOpenEnum, WNetEnumResource, and WNetCloseEnum functions.
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | lmuse.h (include Lm.h, Lmcons.h) |
Library | Netapi32.lib |
DLL | Netapi32.dll |
Events
Nov 19, 11 PM - Nov 21, 11 PM
Gain the competitive edge you need with powerful AI and Cloud solutions by attending Microsoft Ignite online.
Register now