<div class="content"><p> </p><p>The <b>R_DhcpRemoveOptionValueV5</b> method removes the
option value for a specific option on the DHCPv4 server for a specific user
class and vendor class. If the user class or the vendor class is not specified,
the option value is removed from the default user class or vendor class. <i>ScopeInfo</i>
defines the scope on which this option value is removed.</p><dl>
<dd>
<div><pre> DWORD R_DhcpRemoveOptionValueV5(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] DWORD Flags,
   [in] DHCP_OPTION_ID OptionID,
   [in, string, unique] WCHAR* ClassName,
   [in, string, unique] WCHAR* VendorName,
   [in] LPDHCP_OPTION_SCOPE_INFO ScopeInfo
 );
</pre></div>
</dd></dl><p><b>ServerIpAddress: </b>The IP address/host name of
the DHCP server. This parameter is unused.</p><p><b>Flags: </b>This is of type <span><a href="../ms-dtyp/262627d8-3418-4627-9218-4ffe110850b2" data-linktype="relative-path">DWORD</a></span>,
specifying that the option values are removed for a specific or default vendor
class.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>DHCP_FLAGS_OPTION_DEFAULT</p>
  <p>0x00000000</p>
  </td>
  <td>
  <p>Option value is removed for a default vendor class.</p>
  </td>
 </tr><tr>
  <td>
  <p>DHCP_FLAGS_OPTION_IS_VENDOR</p>
  <p>0x00000003</p>
  </td>
  <td>
  <p>If a bitwise AND operation with this bitmask yields a
  nonzero value, it indicates that the option value is removed for a specific
  vendor class.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p><b>OptionID: </b>This is of type <span><a href="4a0bb785-ceec-4f7a-b4a7-64555f6e0b62" data-linktype="relative-path">DHCP_OPTION_ID (section 2.2.1.2.3)</a></span>,
containing the option identifier for the option being removed.</p><p><b>ClassName: </b>A pointer to a null-terminated
Unicode string that contains the name of the user class from which the option
value is being removed. This parameter is optional. If <i>ClassName</i> is not
specified, implementations MUST retrieve the option value for the default user
class.</p><p><b>VendorName: </b>A pointer to a null-terminated
Unicode string that contains the name of the vendor class to which the option
value is being removed. This parameter is optional, and if a vendor class is
not specified, the option value is removed for the default vendor class.</p><p><b>ScopeInfo: </b>This is a pointer to a <span><a href="177415f4-85c1-4496-a414-4938dca18b93" data-linktype="relative-path">DHCP_OPTION_SCOPE_INFO (section 2.2.1.2.41)</a></span>
structure that contains information describing the DHCPv4 scope this option
value is removed on. This value defines that option as being removed from the
server, multicast scope, or scope level or from an IPv4 reservation.</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>0x00004E25</p>
  <p>ERROR_DHCP_SUBNET_NOT_PRESENT</p>
  </td>
  <td>
  <p>The specified IPv4 subnet does not exist on the DHCP
  server.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00004E2A</p>
  <p>ERROR_DHCP_OPTION_NOT_PRESENT</p>
  </td>
  <td>
  <p>The specified option definition does not exist on the
  DHCP server database.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00004E32</p>
  <p>ERROR_DHCP_NOT_RESERVED_CLIENT</p>
  </td>
  <td>
  <p>The specified DHCP client is not a reserved client.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00004E4C</p>
  <p>ERROR_DHCP_CLASS_NOT_FOUND</p>
  </td>
  <td>
  <p>The class name being used is unknown or incorrect.</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 if this method is authorized for read/write access per
section <span><a href="38840bd0-0a5a-47ed-bc69-0dd870d33aec" data-linktype="relative-path">3.5.5</a></span>. If not,
return the error ERROR_ACCESS_DENIED.</p>
</li><li><p><span><span> 
</span></span>The <i>Flags</i> parameter MUST pass one of the validations given
in the <i>Flags</i> field description. Otherwise, the method returns
ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>If <i>ScopeInfo</i> contains DhcpDefaultOptions, return the error
ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>If <i>ScopeInfo</i> contains DhcpGlobalOptions, iterate through
the server ADM element <b>DHCPv4OptionDefList</b> and retrieve <b>DHCPv4OptionDef.DHCPv4ClassedOptDefList</b>
corresponding to the user class and vendor class specified by <b>ClassName</b>
and <b>VendorName</b> respectively. If <i>ClassName</i> or <i>VendorName</i> is
NULL, implementations MUST use the default user class or vendor class respectively
(see section <span><a href="4aa40625-0f9f-4e89-93a4-e4455bc1cc95" data-linktype="relative-path">3.1.1.9</a></span>). If there
is no <b>DHCPv4OptionDef</b> entry corresponding to specified user and vendor
classes, return ERROR_DHCP_CLASS_NOT_FOUND. Otherwise, go to the last step.</p>
</li><li><p><span><span> 
</span></span>If <i>ScopeInfo</i> contains DhcpSubnetOptions, retrieve the <b>DHCPv4Scope</b>
entry corresponding to the field <b>SubnetScopeInfo</b> of <i>ScopeInfo</i>
from the server ADM element <b>DHCPv4ScopesList</b>. If the <b>DHCPv4Scope</b>
entry is not found, return ERROR_DHCP_SUBNET_NOT_PRESENT, else iterate through <b>DHCPv4Scope.DHCPv4ScopeOptValuesList</b>
and retrieve the <b>DHCPv4OptionValue</b> corresponding to the user class and
vendor class specified by <b>ClassName</b> and <b>VendorName</b>, respectively.
If <i>ClassName</i> or <i>VendorName</i> is NULL, implementations MUST use the
default user class or vendor class respectively (see section 3.1.1.9). If the <b>DHCPv4OptionValue</b>
element is not found, return ERROR_DHCP_OPTION_NOT_PRESENT, else retrieve the <b>DHCPv4ClassedOptValue</b>
entry corresponding to <b>OptionID</b> from <b>DHCPv4OptionValue.DHCPv4ClassedOptValueList</b>.
Go to the last step.</p>
</li><li><p><span><span> 
</span></span>If <i>ScopeInfo</i> contains DhcpMScopeOptions, retrieve the <b>DHCPv4MScope</b>
entry corresponding to the <i>ScopeInfo</i> parameter from the server ADM
element <b>DHCPv4MScopesList</b>. If the <b>DHCPv4MScope</b> object is not
found, return ERROR_DHCP_SUBNET_NOT_PRESENT, else iterate through <b>DHCPv4MScope.DHCPv4MScopeOptValuesList</b>
and retrieve the <b>DHCPv4OptionValue</b> corresponding to the user class and
vendor class specified by <b>ClassName</b> and <b>VendorName</b>, respectively.
If <i>ClassName</i> or <i>VendorName</i> is NULL, implementations MUST use the
default user class or vendor class respectively (see section 3.1.1.9). If the <b>DHCPv4OptionValue</b>
element is not found, return ERROR_DHCP_OPTION_NOT_PRESENT, else retrieve the <b>DHCPv4ClassedOptValue</b>
entry corresponding to <b>OptionID</b> from <b>DHCPv4OptionValue.DHCPv4ClassedOptValueList</b>.
Go to the last step.</p>
</li><li><p><span><span> 
</span></span>If <i>ScopeInfo</i> contains DhcpReservedOptions, retrieve the <b>DHCPv4Scope</b>
object from the server ADM element <b>DHCPv4ScopesList</b> that contains the <b>ReservedIpAddress</b>
field of the <i>ScopeInfo</i> parameter. Otherwise, if the <b>DHCPv4Scope</b>
entry is not found, return ERROR_DHCP_NOT_RESERVED_CLIENT, else if the <b>ScopeInfo.SubnetAddress</b>
does not match <b>ScopeInfo</b>&#39;s<b> ReservedIpSubnetAddress</b> field, return
ERROR_DHCP_SUBNET_NOT_PRESENT, else retrieve the <b>DHCPv4Reservation</b> entry
from <b>DHCPv4Scope.DHCPv4ReservationsList</b> corresponding to <b>ReservedIpAddress</b>.
If <b>ReservedIpAddress</b> is not part of any of <b>DHCPv4Scope</b>, or if
there is no <b>DHCPv4Reservation</b> corresponding to <b>ReservedIpAddress</b>,
return ERROR_DHCP_NOT_RESERVED_CLIENT, else iterate through <b>DHCPv4Reservation.DHCPv4ResvOptValuesList</b>
and retrieve <b>DHCPv4OptionValue</b> corresponding to the user and vendor
class specified by <b>ClassName</b> and <b>VendorName</b>, respectively. If <i>ClassName</i>
or <i>VendorName</i> is NULL, implementations MUST use the default user class
or vendor class respectively (see section 3.1.1.9). If the <b>DHCPv4OptionValue</b>
element is not found, return ERROR_DHCP_OPTION_NOT_PRESENT, else retrieve the <b>DHCPv4ClassedOptValue</b>
entry corresponding to <b>OptionID</b> from <b>DHCPv4OptionValue.DHCPv4ClassedOptValueList</b>.</p>
</li><li><p><span><span> 
</span></span>If the <b>DHCPv4ClassedOptValue</b> entry is not present, return
ERROR_DHCP_OPTION_NOT_PRESENT. If the <i>Flags</i> parameter indicates a
default option but <i>VendorName</i> contains a valid value, or if the <i>Flags</i>
parameter indicates a vendor option but the <i>VendorName</i> parameter is set
to NULL, return ERROR_DHCP_OPTION_NOT_PRESENT. Otherwise, delete the <b>DHCPv4ClassedOptValue</b>
entry corresponding to the <i>OptionID</i> from <b>DHCPv4ClassedOptValueList</b>
and return ERROR_SUCCESS.<a id="Appendix_A_Target_48"></a><a aria-label="Product behavior note 48" href="afab0546-79ae-4764-8dab-27a85cca5145#Appendix_A_48" data-linktype="relative-path">&lt;48&gt;</a></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>