MprAdminConnectionEnum function (mprapi.h)

The MprAdminConnectionEnum function enumerates all active connections.

Syntax

DWORD MprAdminConnectionEnum(
  [in]  RAS_SERVER_HANDLE hRasServer,
  [in]  DWORD             dwLevel,
  [out] LPBYTE            *lplpbBuffer,
  [in]  DWORD             dwPrefMaxLen,
  [out] LPDWORD           lpdwEntriesRead,
  [out] LPDWORD           lpdwTotalEntries,
  [in]  LPDWORD           lpdwResumeHandle
);

Parameters

[in] hRasServer

Handle to the RAS server on which connections are enumerated. Obtain this handle by calling MprAdminServerConnect.

[in] dwLevel

A DWORD value that describes the format in which the information is returned in the lplpbBuffer parameter. Acceptable values for dwLevel include 0, 1, 2, and 3, as listed in the following table.

Windows NT 4.0:  This parameter must be zero.

Value Structure Format
0 RAS_CONNECTION_0
1 Windows 2000 or later: RAS_CONNECTION_1
2 Windows 2000 or later: RAS_CONNECTION_2
3 Windows Server 2008 or later: RAS_CONNECTION_3

[out] lplpbBuffer

On successful completion, a pointer to an array of structures that describe the connection. These structures are of type RAS_CONNECTION_0, RAS_CONNECTION_1, RAS_CONNECTION_2, or RAS_CONNECTION_3, depending on the value of the dwLevel parameter.

To free this memory, call MprAdminBufferFree.

[in] dwPrefMaxLen

Specifies the preferred maximum length of returned data in 8-bit bytes. If dwPrefMaxLen is -1, the buffer returned is large enough to hold all available information.

[out] lpdwEntriesRead

Pointer to a DWORD variable. This variable receives the total number of connections enumerated from the current resume position.

[out] lpdwTotalEntries

Pointer to a DWORD variable. This variable receives the total number of connections that could have been enumerated from the current resume position.

[in] lpdwResumeHandle

Pointer to a DWORD variable. This variable specifies a resume handle used to continue the enumeration. The lpdwResumeHandle parameter is zero on the first call, and left unchanged on subsequent calls. If the return code is ERROR_MORE_DATA, another call may be made using this handle to retrieve more data. If the handle is NULL upon return, the enumeration is complete. This handle is invalid for other types of error returns.

Return value

If the function succeeds, the return value is NO_ERROR.

If the function fails, the return value is one of the following error codes.

Value Meaning
ERROR_DDM_NOT_RUNNING
The Demand Dial Manager (DDM) is not running, possibly because the Dynamic Interface Manager (DIM) is configured to run only on a LAN.
ERROR_INVALID_LEVEL
The value passed for dwLevel is not zero, one, two, or three. Levels one and two are supported only on Windows 2000 or later. Level three is supported only on Windows Server 2008 or later.
ERROR_INVALID_PARAMETER
At least one of the following parameters is NULL or does not point to valid memory: lplpBuffer, lpdwEntriesRead, or lpdwTotalEntries.
ERROR_MORE_DATA
Not all of the data was returned with this call. To obtain additional data, call the function again using the resume handle.
RPC_S_INVALID_BINDING
The handle passed in the hRasServer parameter is NULL or invalid.
Other
An error from MprError.h, RasError.h, or WinError.h.

Remarks

This function is available on Windows NT 4.0 if the RRAS redistributable is installed. However, the version of Mprapi.dll that ships with the RRAS redistributable exports the function as RasAdminConnectionEnum rather than MprAdminConnectionEnum. Therefore, when using the RRAS redistributable, use LoadLibrary and GetProcAddress to access this function.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header mprapi.h
Library Mprapi.lib
DLL Mprapi.dll

See also

MprAdminBufferFree

MprAdminServerConnect

RAS Administration Functions

RAS_CONNECTION_0

RAS_CONNECTION_1

RAS_CONNECTION_2

RAS_CONNECTION_3

Remote Access Service Administration Reference