<div class="content"><p> </p><p>The <b>R_DhcpRemoveMScopeElement</b> method removes an IPv4
multicast subnet element (IPv4 multicast range or IPv4 exclusion range) from
the IPv4 multicast subnet defined on the MADCAP server.</p><dl>
<dd>
<div><pre> DWORD R_DhcpRemoveMScopeElement(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in, ref, string] LPWSTR* MScopeName,
   [in, ref] LPDHCP_SUBNET_ELEMENT_DATA_V4 RemoveElementInfo,
   [in] DHCP_FORCE_FLAG ForceFlag
 );
</pre></div>
</dd></dl><p><b>ServerIpAddress: </b>The IP address/host name of
the MADCAP server. This parameter is unused.</p><p><b>MScopeName: </b>This is a pointer to a Unicode
string that contains the name of the multicast subnet from which the IPv4
multicast subnet element is removed. There is no restriction on the length of
this field.</p><p><b>RemoveElementInfo: </b>This is of type <span><a href="76963288-4666-4dc8-b649-77fd7032bdf7" data-linktype="relative-path">DHCP_SUBNET_ELEMENT_DATA_V4 (section 2.2.1.2.35)</a></span>,
containing the IPv4 multicast subnet element that needs to be removed from the
IPv4 multicast subnet.</p><p><b>ForceFlag: </b>This is of type <span><a href="3aca524f-86d6-494c-beaf-35c3936780a5" data-linktype="relative-path">DHCP_FORCE_FLAG (section 2.2.1.1.9)</a></span>
that defines the behavior of this method. If the flag is set to DhcpNoForce and
this IPv4 multicast subnet has served the IPv4 address to some MADCAP clients,
the IPv4 multicast subnet is not deleted. If the flag is set to DhcpFullForce,
the IPv4 multicast subnet is deleted along with the MADCAP client lease record
on the MADCAP server.</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>0x00004E27</p>
  <p>ERROR_DHCP_ELEMENT_CANT_REMOVE</p>
  </td>
  <td>
  <ul><li><p><span><span>  
  </span></span><span>The specified IPv4 multicast
  subnet element cannot be removed because at least one multicast IPv4 address
  has been leased out to a MADCAP client.</span></p>
  </li><li><p><span><span>  
  </span></span><span>The starting address of the
  specified Multicast exclusion range is not part of any multicast exclusion
  range configured on the server.</span></p>
  </li><li><p><span><span>  
  </span></span><span>There is an error in deleting the
  exclusion range from the database.</span></p>
  </li></ul></td>
 </tr><tr>
  <td>
  <p>0x00004E2D</p>
  <p>ERROR_DHCP_JET_ERROR</p>
  </td>
  <td>
  <p>An error occurred while accessing the MADCAP server
  database.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00004E37</p>
  <p>ERROR_DHCP_INVALID_RANGE</p>
  </td>
  <td>
  <p>The specified IPv4 range either overlaps an existing
  IPv4 range or is not valid.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p>The opnum field value for this method is 6.</p><p>When processing this call, the MADCAP 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>If the <i>MScopeName</i> parameter is NULL, return
ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>Retrieve the <b>DHCPv4MScope</b> entry corresponding to the <i>MScopeName</i>
from the server ADM element <b>DHCPv4MScopesList</b>.</p>
</li><li><p><span><span> 
</span></span>If the <b>DHCPv4MScope</b> entry is not found, return
ERROR_FILE_NOT_FOUND.</p>
</li><li><p><span><span> 
</span></span>If the <b>ElementType</b> field in the <i>RemoveElementInfo</i>
parameter is set to DhcpSecondaryHosts, return ERROR_CALL_NOT_IMPLEMENTED.</p>
</li><li><p><span><span> 
</span></span>If the <b>ElementType</b> is set to DhcpReservedIps or
DhcpIpUsedClusters, return ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>If <b>ElementType</b> is set to DhcpExcludedIpRanges, delete the <b>DHCPv4ExclusionRange</b>
entry corresponding to the <b>ExcludeIpRange</b> field of the <i>RemoveElementInfo</i>
input parameter from the <b>DHCPv4ExclusionRangesList</b>. If the <b>ExcludeIpRange</b>
field in the <b>RemoveElementInfo</b> parameter is equal to NULL, return
ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>If the starting address of the IPv4 multicast exclusion range in
the <b>ExcludeIpRange</b> field of <i>RemoveElementInfo</i> is not part of
range specified by any <b>DHCPv4ExclusionRange</b> entry in <b>DHCPv4MScope.DHCPv4ExclusionRangesList</b>,
then return ERROR_DHCP_ELEMENT_CANT_REMOVE.</p>
</li><li><p><span><span> 
</span></span>If the <b>StartAddress</b> and <b>EndAddress</b> fields of <b>ExcludeIpRange</b>
of <i>RemoveElementInfo</i> input parameter do not match the <b>StartAddress</b>
and <b>EndAddress</b> of any <b>DHCPv4ExclusionRange</b> entry in <b>DHCPv4ExclusionRangesList</b>,
then return ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>If there is error in deleting the <b>DHCPv4ExclusionRange</b>
entry from <b>DHCPv4MScope.DHCPv4ExclusionRangesList</b>, then return
ERROR_DHCP_ELEMENT_CANT_REMOVE.</p>
</li><li><p><span><span> 
</span></span>If the <b>ElementType</b> is set to any one of the values from
DhcpIpRanges, DhcpIpRangesDhcpBootp, DhcpIpRangesDhcpOnly, or
DhcpIpRangesBootpOnly (section <span><a href="c2ff4890-adad-4906-bb96-d9417f24545a" data-linktype="relative-path">2.2.1.1.7</a></span>), and if
the <b>StartAddress</b> and <b>EndAddress</b> fields of <b>IpRange</b> of <i>RemoveElementInfo</i>
input parameter do not match the <b>StartAddress</b> and <b>EndAddress</b> of
the <b>DHCPv4IpRange.RangeInfo</b> of any entry in the <b>DHCPv4MScope.DHCPv4IPRangesList</b>,
return ERROR_DHCP_INVALID_RANGE.</p>
</li><li><p><span><span> 
</span></span>If <b>ElementType</b> is set to any one of the following values
DhcpIpRanges, DhcpIpRangesDhcpBootp, or DhcpIpRangesBootpOnly, <b>ForceFlag</b>
is set to DhcpNoForce, and if there is any entry in the <b>DHCPv4MClientsList</b>
having an IPv4 address from within the IPv4 Range specified by <b>IpRange</b>
field of the <i>RemoveElementInfo</i> input parameter, return
ERROR_DHCP_ELEMENT_CANT_REMOVE. </p>
<p>Otherwise, delete the <b>DHCPv4IPRange</b>
entry corresponding to the <b>IpRange</b> field of the <i>RemoveElementInfo</i>
input parameter from the <b>DHCPv4IPRangesList</b>.</p>
</li><li><p><span><span> 
</span></span>Return ERROR_SUCCESS.</p>
</li></ul><p><b>Exceptions Thrown:</b> No exceptions SHOULD be 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>