<div class="content"><p> </p><p>The <b>R_DhcpEnumClasses</b> method enumerates <span><a href="a9d6a415-4de6-4058-befe-ca2e42764485#gt_713c7395-9431-4d67-bab1-a069ae7461e2" data-linktype="relative-path">user
classes</a></span> or <span><a href="a9d6a415-4de6-4058-befe-ca2e42764485#gt_45d20b00-7166-4f94-b679-4cc5a7835a3a" data-linktype="relative-path">vendor classes</a></span>
configured for the DHCP server. The caller of this function can free the memory
pointed to by <i>ClassInfoArray</i> and <b>Classes</b> by calling the function <b>midl_user_free</b>
(section <span><a href="a7e5f2d1-04b7-4363-bdc0-76a1099664eb" data-linktype="relative-path">3</a></span>).</p><dl>
<dd>
<div><pre> DWORD R_DhcpEnumClasses(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] DWORD ReservedMustBeZero,
   [in, out] DHCP_RESUME_HANDLE* ResumeHandle,
   [in] DWORD PreferredMaximum,
   [out] LPDHCP_CLASS_INFO_ARRAY* ClassInfoArray,
   [out] DWORD* nRead,
   [out] DWORD* nTotal
 );
</pre></div>
</dd></dl><p><b>ServerIpAddress: </b>The IP address/host name of
the DHCP server. This parameter is unused.</p><p><b>ReservedMustBeZero: </b>This is of type <span><a href="../ms-dtyp/262627d8-3418-4627-9218-4ffe110850b2" data-linktype="relative-path">DWORD</a></span>
and is reserved for future use. Currently it is not used, and any value set to
this parameter will not affect the behavior of this method.</p><p><b>ResumeHandle: </b>This is a pointer of type <span><a href="a6e4cdc0-4f71-4922-ade1-7a5392f9e920" data-linktype="relative-path">DHCP_RESUME_HANDLE (section 2.2.1.2.6)</a></span>
that identifies the enumeration operation. Initially, this value MUST be set to
zero, with a successful call returning the handle value used for subsequent
enumeration requests. For example, if <i>PreferredMaximum</i> is set to 100,
and 200 classes are stored on the DHCP server, the resume handle can be used
after the first 100 classes are retrieved to obtain the next 100 on a
subsequent call, and so forth.</p><p><b>PreferredMaximum: </b>This is of type DWORD,
specifying the preferred maximum number of bytes to be returned. If the number
of bytes required in memory for the remaining unenumerated classes is less than
the <i>PreferredMaximum</i> value, then all the classes for the DHCP server are
returned. To retrieve all the classes defined on the DHCP server, 0xFFFFFFFF is
specified.</p><p><b>ClassInfoArray: </b>This is a pointer of type <span><a href="023265a1-3057-4f43-bb2b-1fe304007566" data-linktype="relative-path">LPDHCP_CLASS_INFO_ARRAY</a></span>
in which information of all the classes defined on the DHCP server is
retrieved.</p><p><b>nRead: </b>This is a pointer to a DWORD value that
specifies the number of classes returned in <i>ClassInfoArray</i>. The caller
MUST allocate memory for this parameter equal to the size of data type DWORD.</p><p><b>nTotal: </b>This is a pointer to a DWORD value
that specifies the number of classes defined on the DHCP server that have not
yet been enumerated. 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, else 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 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>There are more elements available to enumerate.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000103</p>
  <p>ERROR_NO_MORE_ITEMS</p>
  </td>
  <td>
  <p>There are no more elements left to enumerate.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p>The opnum field value for this method is 28.</p><p>When processing this call, the DHCP server MUST do the
following:</p><ul><li><p><span><span> 
</span></span>If the parameters <i>ClassInfoArray</i>, <i>ResumeHandle</i>, <i>nRead</i>,
and <i>nTotal</i> are NULL, return ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>Validate if this method is authorized for read access per 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 all the entries in server ADM element <b>DHCPv4ClassDefList</b>.</p>
</li><li><p><span><span> 
</span></span>If the <i>ResumeHandle</i> parameter points to 0x00000000, the
enumeration MUST start from the first entry of the <b>DHCPv4ClassDefList</b>.</p>
</li><li><p><span><span> 
</span></span>If the <i>ResumeHandle</i> parameter points to a nonzero value,
the server MUST continue enumeration based on the value of <i>ResumeHandle</i>.
If the <i>ResumeHandle</i> parameter is greater than or equal to the number of
entries in the <b>DHCPv4ClassDefList</b> ADM element, then return
ERROR_NO_MORE_ITEMS.</p>
</li><li><p><span><span> 
</span></span>If the <i>PreferredMaximum</i> parameter is 0 and the number of <b>DHCPv4ClassDef</b>
entries retrieved is greater than 0, then ERROR_MORE_DATA is returned.</p>
</li><li><p><span><span> 
</span></span>If <i>PreferredMaximum</i> parameter is 0 and the number of <b>DHCPv4ClassDef</b>
entries retrieved is 0, then ERROR_NO_MORE_ITEMS is returned.</p>
</li><li><p><span><span> 
</span></span>The <i>PreferredMaximum</i> parameter specifies the maximum
number of bytes that the server can allocate and return to the caller
containing the data related to the classes. If the <i>PreferredMaximum</i>
parameter is unable to hold all the entries being retrieved, then the server
must store as many entries that will fit into the <i>ClassInfoArray</i>
parameter and return ERROR_MORE_DATA.</p>
</li><li><p><span><span> 
</span></span>Allocate the memory for <b>DHCP_CLASS_INFO_ARRAY</b> (section
2.2.1.2.76) and for the total number of classes type <span><a href="0f8461a3-14ad-4b60-a398-553b199ecfc0" data-linktype="relative-path">DHCP_CLASS_INFO (section 2.2.1.2.75)</a></span>
from <i>ResumeHandle</i> to the end of the option list.</p>
</li><li><p><span><span> 
</span></span>Read the entries information in the ADM element <b>DHCPv4ClassDef</b>
starting from the index specified by <i>ResumeHandle</i> to the end of the <b>DHCPv4ClassDefList</b>
ADM element, copy it in the allocated memory, and return it to the caller until
the copied data length is less than <i>PreferredMaximum</i>.</p>
</li><li><p><span><span> 
</span></span>Fill the number of read <b>DHCPv4ClassDef</b> entries in <i>nRead</i>
and the number of <b>DHCPv4ClassDef</b> entries in the <b>DHCPv4ClassDefList</b>
that have not been enumerated in <i>nTotal</i>. Set the <i>ResumeHandle</i> to
the index of the next <b>DHCPv4ClassDef</b> entry to be read.</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>