<div class="content"><p> </p><p>The <b>R_DhcpV4EnumSubnetClients</b> method is used to
retrieve all DHCPv4 clients serviced on the specified IPv4 subnet. The
information also includes the link-layer filter status info for the DHCPv4
client and the policy, if any, that resulted in the specific IPv4 address
assignment.</p><dl>
<dd>
<div><pre> DWORD R_DhcpV4EnumSubnetClients(
     [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
     [in] DHCP_IP_ADDRESS SubnetAddress,
     [in, out] DHCP_RESUME_HANDLE *ResumeHandle,
     [in] DWORD PreferredMaximum,
     [out] LPDHCP_CLIENT_INFO_PB_ARRAY *ClientInfo,
     [out] DWORD *ClientsRead,
     [out] DWORD *ClientsTotal
 );
</pre></div>
</dd></dl><p><b>ServerIPAddress: </b>The IP address of the DHCP
server. This parameter is unused.</p><p><b>SubnetAddress: </b>A <span><a href="5122557b-b85d-4982-8ffb-98d8d934e353" data-linktype="relative-path">DHCP_IP_ADDRESS</a></span>
structure containing the IPv4 subnet ID from which DHCPv4 clients are
enumerated. If this parameter is set to 0, the DHCPv4 clients from all the IPv4
subnets are returned.</p><p><b>ResumeHandle: </b>A <span><a href="a6e4cdc0-4f71-4922-ade1-7a5392f9e920" data-linktype="relative-path">DHCP_RESUME_HANDLE</a></span>
structure that identifies the enumeration operation. Callers MUST set this
value to zero. On success, this method returns the handle value used for
subsequent enumeration requests in this parameter. The return value is the last
IPv4 address retrieved.</p><p><b>PreferredMaximum: </b>A DWORD value that specifies
the preferred maximum number of bytes to return. To retrieve all DHCPv4 clients
serviced by a specific IPv4 subnet, clients MUST pass the special value
0xFFFFFFFF. Otherwise, the minimum value is 1024, and the maximum value is
65536. If the input value is less than 1024, it must be treated as 1024. If the
input value is greater than 65536 but not equal to 0xFFFFFFFF, it MUST be
treated as 65536.</p><p><b>ClientInfo: </b>A pointer to an array of DHCPv4
client lease records.</p><p><b>ClientsRead: </b>A pointer to a DWORD containing
the number of DHCPv4 client lease records copied into the <i>ClientInfo</i>
parameter. The caller MUST allocate memory for this parameter equal to the size
of data type DWORD.</p><p><b>ClientsTotal: </b>A pointer to a DWORD containing
the number of DHCPv4 client lease records remaining from the current read
position. For example, if there are 100 DHCPv4 lease records for an IPv4
subnet, and if 10 records have been read so far, <i>ClientsTotal</i> will hold
the value 90 when this method returns. The caller MUST allocate memory for this
parameter equal to the size of data type DWORD.</p><p><b>Return Values: </b>A 32-bit unsigned integer value
that indicates return status. A return value ERROR_SUCCESS (0x00000000)
indicates that the operation was completed successfully. Otherwise, it contains
a Win32 error code, as specified in <span><a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a></span>.
This error code value can correspond to a DHCP-specific failure, which takes a
value between 20000 and 20099, or to any generic failure.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>0x00000000</p>
  <p>ERROR_SUCCESS</p>
  </td>
  <td>
  <p>The call was successful.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x000000EA</p>
  <p>ERROR_MORE_DATA</p>
  </td>
  <td>
  <p>More client lease records are available to enumerate.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000103</p>
  <p>ERROR_NO_MORE_ITEMS</p>
  </td>
  <td>
  <p>No more client lease records are left to enumerate.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00004E2D</p>
  <p>ERROR_DHCP_JET_ERROR</p>
  </td>
  <td>
  <p>An error occurred while accessing the DHCP server
  database.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p>When processing this call, the DHCP server MUST do the
following:</p><ul><li><p><span><span> 
</span></span>Validate whether this method is authorized for read access as
specified in section <span><a href="baec2112-1146-4c42-b77e-b706e170a590" data-linktype="relative-path">3.5.4</a></span>. If not,
return the error ERROR_ACCESS_DENIED.</p>
</li><li><p><span><span> 
</span></span>Retrieve the <b>DHCPv4ClientsList</b> member of the <b>DHCPv4Scope</b>
entry corresponding to the <i>SubnetAddress</i> parameter from the server ADM
element <b>DHCPv4ScopesList</b>. If the <i>SubnetAddress</i> parameter is 0,
retrieve the <b>DHCPv4ClientsList</b> member of all the <b>DHCPv4Scope</b>
entries in the server ADM element <b>DHCPv4ScopesList</b>.</p>
</li><li><p><span><span> 
</span></span>If the <i>ResumeHandle</i> parameter is a null pointer, enumeration
MUST start from the first entry of the <b>DHCPv4ClientsList</b> ADM element.</p>
</li><li><p><span><span> 
</span></span>If there are no entries in the <b>DHCPv4ClientsList</b> of the <b>DHCPv4Scope</b>
entry corresponding to the <i>SubnetAddress</i> parameter, return
ERROR_NO_MORE_ITEMS.</p>
</li><li><p><span><span> 
</span></span>If the <i>ResumeHandle</i> parameter is not a null pointer, the
server MUST continue enumeration based on the value of the <i>ResumeHandle</i>
parameter. If the IPv4 Address contained in the location pointed to by the <i>ResumeHandle</i>
parameter does not match the <b>ClientIpAddress</b> value of any <b>DHCPv4Client</b>
of the <b>DHCPv4Scope</b> entry corresponding to the <i>SubnetAddress</i>
parameter or does not match the <b>ClientIpAddress</b> value of any <b>DHCPv4Client</b>
of all <b>DHCPv4Scope</b> entries when the specified <i>SubnetAddress</i> value
is 0x0, return ERROR_DHCP_JET_ERROR.</p>
</li><li><p><span><span> 
</span></span>If the <i>PreferredMaximum</i> parameter is less than 1024, set
it to 1024.</p>
</li><li><p><span><span> 
</span></span>If the <i>PreferredMaximum</i> parameter is greater than 65536
but is not equal to 0xFFFFFFFF, set it to 65536.</p>
</li><li><p><span><span> 
</span></span>Allocate the amount of memory indicated by the <i>PreferredMaximum</i>
parameter. If the <i>PreferredMaximum</i> parameter is equal to 0xFFFFFFFF,
allocate an amount of memory sufficient to store all of the available client
lease records. Note that the actual number of records that will fit into a
given amount of memory can be determined only at run time.</p>
</li><li><p><span><span> 
</span></span>For each retrieved <b>DHCPv4Client</b> entry, retrieve the <b>DHCPv4Filter</b>
entry corresponding to the <b>DHCPv4Client.ClientHardwareAddress</b> ADM
element.</p>
</li><li><p><span><span> 
</span></span>Add the client information from the <b>DHCPv4Client</b> entries
to the memory pointed to by the <i>ClientInfo</i> parameter. Set the <b>FilterStatus</b>
field for each client lease record as follows.</p>
<table><thead>
  <tr>
   <th>
   <p>DHCPv4FilterListType</p>
   </th>
   <th>
   <p>DHCPv4Filter.AddPatt.IsWildCard</p>
   </th>
   <th>
   <p>FilterStatus</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>Allow</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0x00000002</p>
  <p>FILTER_STATUS_FULL_MATCH_IN_ALLOW_LIST</p>
  </td>
 </tr><tr>
  <td>
  <p>Deny</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0x00000004</p>
  <p>FILTER_STATUS_FULL_MATCH_IN_DENY_LIST</p>
  </td>
 </tr><tr>
  <td>
  <p>Allow</p>
  </td>
  <td>
  <p>1</p>
  </td>
  <td>
  <p>0x00000008</p>
  <p>FILTER_STATUS_WILDCARD_MATCH_IN_ALLOW_LIST</p>
  </td>
 </tr><tr>
  <td>
  <p>Deny</p>
  </td>
  <td>
  <p>1</p>
  </td>
  <td>
  <p>0x00000010</p>
  <p>FILTER_STATUS_WILDCARD_MATCH_IN_DENY_LIST</p>
  </td>
 </tr></tbody></table>
</li><li><p><span><span> 
</span></span>If the <b>DHCPv4Filter</b> entry corresponding to the <b>DHCPv4Client.ClientHardwareAddress</b>
ADM element is not found, set the <b>FilterStatus</b> field for each client
added to the <i>ClientInfo</i> parameter to FILTER_STATUS_NONE.</p>
</li><li><p><span><span> 
</span></span>If the retrieve operation has reached the maximum number of <b>DHCPv4Client</b>
entries that fit into the <i>PreferredMaximum</i> amount of memory and there
are additional <b>DHCPv4Client</b> entries in any <b>DHCPv4MClientsList</b>,
set the <i>ClientsTotal</i> parameter to the number of <b>DHCPv4Client</b>
entries that have not yet been enumerated, and set the <i>ClientsRead</i>
parameter to the number of <b>DHCPv4Client</b> entries that are enumerated in
this retrieve operation. Set the <i>ResumeHandle</i> parameter to the address
of the <b>ClientIpAddress</b> member of the last <b>DHCPv4Client</b> entry
read, and return ERROR_MORE_DATA.</p>
</li><li><p><span><span> 
</span></span>If the number of bytes specified by the <i>PreferredMaximum</i>
parameter is more than the total memory occupied by all the <b>DHCPv4Client</b>
entries, set the <i>ClientsTotal</i> parameter and the <i>ClientsRead</i>
parameter to the total number of <b>DHCPv4Client</b> entries enumerated in this
retrieve operation. Set the <i>ResumeHandle</i> parameter to the null pointer,
and return ERROR_SUCCESS.</p>
</li></ul><p><b>Exceptions Thrown:</b> No exceptions are thrown beyond
those thrown by the underlying RPC protocol <span><a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a></span>.</p></div>