<div class="content"><p>The <b>RRasAdminPortEnum</b> method retrieves the list of
all ports on a RRAS server, or the ports for a specified connection determined
by <i>hRasConnection</i>. The <i>hDimServer</i> handle specifies the RRAS
server on which the call is executed. The <i>dwLevel</i> defines the type of
information requested. The caller MUST pass a pointer to a valid <a href="95609dbb-56aa-4b1b-a0e2-697864a141bd" data-linktype="relative-path"><b>DIM_INFORMATION_CONTAINER (section 2.2.1.2.1)</b></a>,
where <b>DIM_INFORMATION_CONTAINER.dwBufferSize</b> is initialized to zero (0).
The caller SHOULD free the memory pointed to by <i>pInfoStruct</i>.  </p><dl>
<dd>
<div><pre> DWORD RRasAdminPortEnum(
   [in] DIM_HANDLE hDimServer,
   [in] DWORD dwLevel,
   [in] DWORD hRasConnection,
   [in, out] PDIM_INFORMATION_CONTAINER pInfoStruct,
   [in] DWORD dwPreferedMaximumLength,
   [out] LPDWORD lpdwEntriesRead,
   [out] LPDWORD lpdwTotalEntries,
   [in, out, unique] LPDWORD lpdwResumeHandle
 );
</pre></div>
</dd></dl><p><b>hDimServer: </b>A handle to the RRASM server where
the call is to be executed, see section <a href="1f8cdbcc-9791-4a35-ad78-878b8d110e15" data-linktype="relative-path">3.1.3</a>.</p><p><b>dwLevel: </b>This is of type <b>DWORD</b> and MUST
be set to the following value.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>After the function returns, the memory pointed by
  pInfoStruct-&gt;pBuffer is interpreted as an array of <a href="ed4beef4-11ba-413f-abf4-2659412169e8" data-linktype="relative-path"><b>RASI_PORT_0 (section 2.2.1.2.75)</b></a>.
  The size of the array is determined by <i>lpdwEntriesRead</i>. This includes
  information related to the Port object during runtime. The port objects
  SHOULD be initialized based on the port configurations defined by <a href="1b836c27-fbc9-476f-8076-f8ede3e14d66" data-linktype="relative-path"><b>WanEndpoints (section 2.2.3.3.1.8)</b></a>.
  The Device Name is also returned as a part of each port information.  </p>
  </td>
 </tr></tbody></table>
</dd></dl><p><b>hRasConnection: </b>This is of type <b>DWORD</b>
and SHOULD be set to a particular connection identifier for which the
connection information is required. Obtain this handle by calling <a href="023913fc-f438-47c9-a52b-6e45e0190c6c" data-linktype="relative-path"><b>RRasAdminConnectionEnum (section 3.1.4.2)</b></a>.
If this parameter is passed as INVALID_HANDLE_VALUE (0xFFFFFFFF), the function
enumerates all the active ports configured on the RRAS server. Since RRASM
server does not maintain connection handle information, the validation of this
handle SHOULD be done by the RRAS server implementation.  </p><p><b>pInfoStruct: </b>This is a pointer of type <b>DIM_INFORMATION_CONTAINER (section 2.2.1.2.1)</b>,
and <b>DIM_INFORMATION_CONTAINER.dwBufferSize</b> is initialized to zero (0).
Upon successful return, the pInfoStruct-&gt;pBuffer is typecast to an array of <b>RASI_PORT_0</b>,
and the array size is determined by the value to pointer <i>lpdwEntriesRead</i>. 
</p><p><b>dwPreferedMaximumLength: </b>This is of type <b>DWORD</b>
and SHOULD specify the preferred maximum length of returned data
(pInfoStruct-&gt;pBuffer) in bytes. If <i>dwPreferedMaximumLength</i> is -1
then all existing port entries for the specified connection are returned in the
buffer.</p><p><b>lpdwEntriesRead: </b>This is a pointer to type <b>DWORD</b>.
Upon successful return, this determines the total number of ports enumerated
from the current resume position given by <i>lpdwResumeHandle</i>.</p><p><b>lpdwTotalEntries: </b>This is a pointer to type <b>DWORD</b>
and receives the total number of ports that could have been enumerated from the
current resume position given by <i>lpdwResumeHandle</i>.</p><p><b>lpdwResumeHandle: </b>This is a pointer to type <b>DWORD</b>
and specifies a resume handle that is used to continue the enumeration. The <i>lpdwResumeHandle</i>
parameter is zero (0) on the first call and left unchanged on subsequent calls
(the caller MUST pass the same returned value in the next call to this
function; otherwise, an error is returned). If the return code is ERROR_MORE_DATA
(0x000000EA), another call can be made using this handle to retrieve more data.
If the handle is NULL upon return, the enumeration is complete. This handle is
invalid (-1) for other types of error returns.</p><p><b>Return Values: </b>A 32-bit, unsigned integer value
that indicates return status. A return value of ERROR_SUCCESS (0x00000000)
indicates that the operation was completed successfully; otherwise, it contains
an error code, as specified in <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>
or section <a href="5c0c991a-0d3d-4fe5-9503-5128d0d49fe1" data-linktype="relative-path">2.2.4</a>. All
values that are not listed in the table that follows MUST be treated the same
by the RRASM client.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>ERROR_SUCCESS</p>
  <p>0x00000000</p>
  </td>
  <td>
  <p>The call was successful.</p>
  </td>
 </tr><tr>
  <td>
  <p>ERROR_ACCESS_DENIED</p>
  <p>0x00000005</p>
  </td>
  <td>
  <p>The calling application does not have sufficient
  privileges.</p>
  </td>
 </tr><tr>
  <td>
  <p>ERROR_MORE_DATA</p>
  <p>0x000000EA</p>
  </td>
  <td>
  <p>Not all of the data was returned with this call. To
  obtain additional data, call the function again using the handle that was
  returned in the <i>lpdwResumeHandle</i> parameter.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p>The opnum field value for this method is 4.</p><p>When processing this call, the RRASM server MUST do the
following:</p><ul><li><p><span><span> 
</span></span>Validate, as specified in section <a href="9373431f-ed29-4639-9f8b-743267c9f9b6" data-linktype="relative-path">2.1.1.1</a>, whether this
method was called by a client that has access to the method. If the client does
not have access, then return error ERROR_ACCESS_DENIED (0x00000005).</p>
<p>If the <a href="bacd0fa5-aabf-452b-9bb9-0a29a1dd8238" data-linktype="relative-path"><b>RouterType (section 2.2.3.4.1)</b></a>
is ROUTER_TYPE_LAN, return an error other than those in the preceding table.  </p>
</li><li><p><span><span> 
</span></span>If <i>pInfoStruct</i> is NULL, return an error other than those
in the preceding table.</p>
</li><li><p><span><span> 
</span></span>If <i>dwLevel</i> is not supported, return an error other than
those in the preceding table.</p>
</li><li><p><span><span> 
</span></span>Call the abstract interface <b>Invoke DIMSVC</b> method
specifying the operation and the parameters to enable the RRAS server to
perform the required management task.</p>
</li><li><p><span><span> 
</span></span>If the RRAS server successfully processes the request, populate <i>pInfoStruct</i>
with the information returned by the RRAS server and return ERROR_SUCCESS
(0x00000000).</p>
</li><li><p><span><span> 
</span></span>Otherwise return the failure error status returned by RRAS
server.</p>
</li></ul><p>No exceptions are thrown beyond those thrown by the
underlying RPC protocol <a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a>.</p></div>