The NetConnectionEnum API lists (1) the connections made to a shared resource of a server or (2) all connections established from a particular computer to a server.
Restrictions
This API can be called from DLS and OS/2 workstations, but DLS workstations can issue this call only to a remote LAN Server workstation. A call to this API can be issued only to an OS/2 LAN Server workstation.
#include <netcons.h> #include <shares.h> NetConnectionEnum(pszServername, qualifier, sLevel, buf, usBuflen, pusEntriesReturned, pusEntriesAvail); /* 16 bit */ Net32ConnectionEnum(pszServername, qualifier, ulLevel, buf, ulBuflen, pulEntriesReturned, pulEntriesAvail); /* 32 bit */Parameters
See Common Parameter Definitions for descriptions of parameters not defined here.
qualifier
The following table lists the return codes most significant to this API.
(See API Return Codes for a complete
list of return codes.) ┌───────────────────────────┬───────┬──────────────────────────────────────────┐│SYMBOLICCONSTANT
│VALUE│MEANING │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_Success │ 0 │ No errors were encountered. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ ERROR_ACCESS_DENIED │ 5 │ Administrator privilege is required. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ ERROR_BAD_NETPATH │ 53 │ The network path cannot be found. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ ERROR_NETWORK_ACCESS_DENIE│ 65 │ Network access is denied. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ ERROR_INVALID_PARAMETER │ 87 │ At least one parameter value is not
│
│ │ │ valid. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ ERROR_INVALID_LEVEL │ 124 │ The sLevel parameter is not valid. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ ERROR_MORE_DATA │ 234 │ Additional data is available, but the │
│ │ │ buffer is too small. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_NetNotStarted │ 2102 │ The redirector NETWKSTA.200 has not been
│
│ │ │ started. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_RemoteOnly │ 2106 │ This operation is not supported on work-
│
│ │ │ stations. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_ServerNotStarted │ 2114 │ The Server service has not been started.
│
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_WkstaNotStarted │ 2138 │ The Requester service has not been
│
│ │ │ started. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_InternalError │ 2140 │ An internal error has occurred. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_BadTransactConfig │ 2141 │ The server is not configured for trans-
│
│ │ │ actions. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_NetNameNotFound │ 2310 │ This shared resource does not exist.
│
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_ClientNameNotFound │ 2312 │ A session does not exist with that
com- │
│ │ │ puter name. │
├───────────────────────────┼───────┼──────────────────────────────────────────┤
│ NERR_InvalidComputer │ 2351 │ The specified computer name is not
│
│ │ │ valid. │
└───────────────────────────┴───────┴──────────────────────────────────────────┘
Other codes could be returned from the following functions:
If you call this API with the buffer length parameter equal to zero, the API returns a value for total entries available. This technique is useful if you do not know the exact buffer size required.
If qualifier specifies a requester, NetConnectionEnum returns a list of all connections made between the requester and the specified server during the current session.
If qualifier specifies a shared resource, NetConnectionEnum returns a list of all connections made to the shared resource.
For information about: