<div class="content"><p> </p><p>The <b>R_DhcpEnumOptions</b> method enumerates the <span><a href="a9d6a415-4de6-4058-befe-ca2e42764485#gt_da9bfcf7-a7e0-4cf0-ac87-ffdd83a5f25b" data-linktype="relative-path">option
definition</a></span> for a default <span><a href="a9d6a415-4de6-4058-befe-ca2e42764485#gt_713c7395-9431-4d67-bab1-a069ae7461e2" data-linktype="relative-path">user class</a></span> and <span><a href="a9d6a415-4de6-4058-befe-ca2e42764485#gt_45d20b00-7166-4f94-b679-4cc5a7835a3a" data-linktype="relative-path">vendor
class</a></span> pair specified at the default level. The extension of this
method is <span><a href="c10b2ea4-a9b9-4074-8201-37f1c3be0cc6" data-linktype="relative-path">R_DhcpEnumOptionsV5 (section 3.2.4.18)</a></span>,
which enumerates the option definition for the specific user class and vendor
class. The caller of this function can free the memory pointed to by the <i>Options</i>
parameter and its member the <b>Options</b> array 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_DhcpEnumOptions(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in, out] DHCP_RESUME_HANDLE* ResumeHandle,
   [in] DWORD PreferredMaximum,
   [out] LPDHCP_OPTION_ARRAY* Options,
   [out] DWORD* OptionsRead,
   [out] DWORD* OptionsTotal
 );
</pre></div>
</dd></dl><p><b>ServerIpAddress: </b>The IP address/host name of
the DHCP server. This parameter is unused.</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 the <i>PreferredMaximum</i> parameter is
set to 1,000 bytes, and 2,000 bytes worth of option definitions are stored on
the DHCPv4 server, the resume handle can be used after the first 1,000 bytes
are retrieved to obtain the next 1,000 on a subsequent call, and so forth.</p><p><b>PreferredMaximum: </b>This is of type <span><a href="../ms-dtyp/262627d8-3418-4627-9218-4ffe110850b2" data-linktype="relative-path">DWORD</a></span>,
specifying the preferred maximum number of bytes to return. If the number of
remaining unenumerated option definitions (in bytes) is less than this value,
all option definitions are returned. To retrieve all the option definitions
defined for a default user class and vendor class on the <span><a href="a9d6a415-4de6-4058-befe-ca2e42764485#gt_746786e7-458f-45aa-ab24-5534a94b4fb3" data-linktype="relative-path">DHCPv4
server</a></span>, 0xFFFFFFFF is specified.</p><p><b>Options: </b>This is a pointer of type <span><a href="34b6a347-0458-415a-9808-0dc631a8c547" data-linktype="relative-path">LPDHCP_OPTION_ARRAY</a></span>
that points to the location where all the option definitions for the default
user class and vendor class are retrieved from the DHCPv4 server.</p><p><b>OptionsRead: </b>This is a pointer to a DWORD
value that specifies the number of option definitions read in the <i>Options</i>
parameter. The caller MUST allocate memory for this parameter equal to the size
of data type DWORD.</p><p><b>OptionsTotal: </b>This is a pointer to a DWORD
value that specifies the number of option definitions that have not yet been
enumerated. The caller MUST allocate memory for this parameter that is 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 23.</p><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 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>Iterate though the server Abstract Data Model (ADM) element <b>DHCPv4OptionDefList</b>
and retrieve the <b>DHCPv4ClassedOptDefList</b> ADM element corresponding to
the <b>DHCPv4OptionDef</b> ADM element entry whose <b>UserClass</b> and <b>VendorClass</b>
ADM element fields are NULL.</p>
</li><li><p><span><span> 
</span></span>If there are no entries in the retrieved <b>DHCPv4ClassedOptDefList</b>
ADM element, return the error 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>DHCPv4ClassedOptDef</b>
ADM element entries retrieved is greater than 0, then ERROR_MORE_DATA is
returned.</p>
</li><li><p><span><span> 
</span></span>If the <i>PreferredMaximum</i> parameter is 0 and the number of <b>DHCPv4ClassedOptDef</b>
ADM element entries retrieved is 0, then ERROR_NO_MORE_ITEMS is returned.</p>
</li><li><p><span><span> 
</span></span>If the <i>PreferredMaximum</i> parameter is 0XFFFFFFFF, then all
the <b>DHCPv4ClassedOptDef</b> ADM element entries are retrieved. If the number
of <b>DHCPv4ClassedOptDef</b> ADM element entries is 0, then
ERROR_NO_MORE_ITEMS is returned.</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>DHCPv4ClassedOptDefList</b>
ADM element.</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>DHCPv4ClassedOptDefList</b> ADM element, then return
ERROR_NO_MORE_ITEMS.</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 option definitions. If <i>PreferredMaximum</i>
is not 0xFFFFFFFF, allocate the memory for the number of <b>DHCPv4ClassedOptDef</b>
ADM element entries available in the retrieved list starting from the index
specified by the <i>ResumeHandle</i> parameter that can fit in <i>PreferredMaximum</i>
amount of memory. Else, if the <i>PreferredMaximum</i> parameter is 0xFFFFFFFF,
allocate the memory for all remaining <b>DHCPv4ClassedOptDef</b> ADM elements.</p>
</li><li><p><span><span> 
</span></span>Enumerate the <b>DHCPv4ClassedOptDef</b> ADM element entries for
the default user class and vendor class pair from the <i>ResumeHandle</i>
parameter, and copy them in the <i>Options</i> parameter until as many <b>DHCPv4ClassedOptDef</b>
ADM element entries have been copied that can be accommodated in <i>PreferredMaximum</i>
memory, or until the end of the <b>DHCPv4ClassedOptDefList</b> ADM element,
whichever comes first.</p>
</li><li><p><span><span> 
</span></span>Copy the number of <b>DHCPv4ClassedOptDef</b> ADM element entries
read from that list in the <i>OptionsRead</i> parameter, copy the number of <b>DHCPv4ClassedOptDef</b>
ADM element entries from that list that are not yet enumerated in the <i>OptionsTotal</i>
parameter. Update the <i>ResumeHandle</i> parameter to one more than the index
of the last <b>DHCPv4ClassedOptDef</b> ADM element entry read.</p>
</li><li><p><span><span> 
</span></span>If all <b>DHCPv4ClassedOptDef</b> ADM element entries from <b>DHCPv4ClassedOptDefList</b>
ADM element were copied to the <i>OptionsRead</i> parameter, return
ERROR_SUCCESS; else, if the number of <b>DHCPv4ClassedOptDef</b> ADM element
entries copied to the <i>OptionsRead</i> parameter was limited by <i>PreferredMaximum</i>,
return ERROR_MORE_DATA.</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>