<div class="content" name="R_DhcpV4RemovePolicyRange" uuid="0e055f03-c011-43f0-9550-42cca73cc8f7"><p>The <b>R_DhcpV4RemovePolicyRange</b> method removes the
specified IP address range from the list of IP address ranges of the policy.</p><dl>
<dd>
<div><pre> DWORD R_DhcpV4RemovePolicyRange(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] DHCP_IP_ADDRESS SubnetAddress,
   [in, unique, string] LPWSTR PolicyName,
   [in] LPDHCP_IP_RANGE Range
 );
</pre></div>
</dd></dl><p><b>ServerIpAddress: </b>The IP address/host name of
the DHCP server. This parameter is unused.</p><p><b>SubnetAddress: </b>This is of type <a href="5122557b-b85d-4982-8ffb-98d8d934e353" data-linktype="relative-path">DHCP_IP_ADDRESS (section 2.2.1.2.1)</a>
that contains the IPv4 subnet ID that contains the policy identified by the <i>PolicyName</i>
parameter.</p><p><b>PolicyName: </b>A pointer to a null-terminated
Unicode string that contains the name of the policy inside the subnet
identified by the <i>SubnetAddress</i> parameter from which the IP address
range is being deleted.</p><p><b>Range: </b>This is a pointer to a structure of
type <b>DHCP_IP_RANGE</b> (section <a href="29a03b34-249e-4bd8-a118-e708dadbf22b" data-linktype="relative-path">2.2.1.2.31</a>) that specifies
the IP address range to be deleted from the policy.</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
a Win32 error code, as specified in <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>.
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>0x00000000 ERROR_SUCCESS</td>
  <td>The call was successful.</td>
 </tr><tr>
  <td>0x00004E25 ERROR_DHCP_SUBNET_NOT_PRESENT</td>
  <td>The specified IPv4 subnet does not exist.</td>
 </tr><tr>
  <td>0x00004E8F ERROR_DHCP_POLICY_NOT_FOUND</td>
  <td>The specified policy does not exist.</td>
 </tr><tr>
  <td>0x00004E8B ERROR_DHCP_POLICY_RANGE_BAD</td>
  <td>The specified policy range is not contained within the IP address range of the scope.</td>
 </tr></tbody></table>
</dd></dl><p>The opnum field value for this method is 114.</p><p>When processing this call, the DHCP server MUST do the
following:</p><ul><li><p><span><span> 
</span></span>If the <i>PolicyName</i> parameter, <i>Range</i> parameter, or <i>SubnetAddress</i>
parameter is NULL, return ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>Validate whether this method is authorized for read write/access
as specified in section <a href="38840bd0-0a5a-47ed-bc69-0dd870d33aec" data-linktype="relative-path">3.5.5</a>.
If not, return ERROR_ACCESS_DENIED.</p>
</li><li><p><span><span> 
</span></span>Retrieve the <b>DHCPv4Scope</b> ADM element entry corresponding
to the <i>SubnetAddress</i> parameter from the server ADM element <b>DHCPv4ScopesList</b>.
If the <b>DHCPv4Scope</b> entry is not present, return
ERROR_DHCP_SUBNET_NOT_PRESENT.</p>
</li><li><p><span><span> 
</span></span>Retrieve the <b>DHCPv4Scope.DHCPv4ScopePolicyList</b> ADM element
from <b>DHCPv4Scope</b>. Retrieve the <b>DHCPv4Policy</b> ADM element entry
from the <b>DHCPv4ScopePolicyList</b> ADM element corresponding to the
specified <i>PolicyName</i>. If no <b>DHCPv4Policy</b> has the specified <i>PolicyName</i>,
return ERROR_DHCP_POLICY_NOT_FOUND.</p>
</li><li><p><span><span> 
</span></span>Retrieve the <b>DHCPv4Policy.Policy.Ranges</b> ADM element.
Retrieve the DHCP_IP_RANGE structure in the <b>Elements</b> ADM element from the
<b>DHCPv4Policy.Policy.Ranges</b> that has the same <b>StartAddress</b> ADM
element and <b>EndAddress</b> ADM element as the specified <i>Range</i>
parameter. If none of the <b>DHCPv4Policy.Policy.Ranges</b> has the same <b>StartAddress</b>
and <b>EndAddress</b> as the specified <i>Range</i> parameter, return
ERROR_POLICY_RANGE_BAD.</p>
</li><li><p><span><span> 
</span></span>Delete the DHCP_IP_RANGE structure in the <b>Elements</b> ADM
element from the same <b>DHCPv4Policy.Policy.Ranges</b> as the specified <i>Range</i>
parameter.</p>
</li><li><p><span><span> 
</span></span>Return ERROR_SUCCESS.</p>
</li></ul><p><b>Exceptions Thrown:</b> 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>