3.2.4.115 R_DhcpV4RemovePolicyRange (Opnum 114)
The R_DhcpV4RemovePolicyRange method removes the specified IP address range from the list of IP address ranges of the policy.
-
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 );
ServerIpAddress: The IP address/host name of the DHCP server. This parameter is unused.
SubnetAddress: This is of type DHCP_IP_ADDRESS (section 2.2.1.2.1) that contains the IPv4 subnet ID that contains the policy identified by the PolicyName parameter.
PolicyName: A pointer to a null-terminated Unicode string that contains the name of the policy inside the subnet identified by the SubnetAddress parameter from which the IP address range is being deleted.
Range: This is a pointer to a structure of type DHCP_IP_RANGE (section 2.2.1.2.31) that specifies the IP address range to be deleted from the policy.
Return Values: 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 [MS-ERREF]. This error code value can correspond to a DHCP-specific failure, which takes a value between 20000 and 20099, or to any generic failure.
-
Return value/code
Description
0x00000000
ERROR_SUCCESS
The call was successful.
0x00004E25
ERROR_DHCP_SUBNET_NOT_PRESENT
The specified IPv4 subnet does not exist.
0x00004E8F
ERROR_DHCP_POLICY_NOT_FOUND
The specified policy does not exist.
0x00004E8B
ERROR_DHCP_POLICY_RANGE_BAD
The specified policy range is not contained within the IP address range of the scope.
The opnum field value for this method is 114.
When processing this call, the DHCP server MUST do the following:
If the PolicyName parameter, Range parameter, or SubnetAddress parameter is NULL, return ERROR_INVALID_PARAMETER.
Validate whether this method is authorized for read write/access as specified in section 3.5.5. If not, return ERROR_ACCESS_DENIED.
Retrieve the DHCPv4Scope ADM element entry corresponding to the SubnetAddress parameter from the server ADM element DHCPv4ScopesList. If the DHCPv4Scope entry is not present, return ERROR_DHCP_SUBNET_NOT_PRESENT.
Retrieve the DHCPv4Scope.DHCPv4ScopePolicyList ADM element from DHCPv4Scope. Retrieve the DHCPv4Policy ADM element entry from the DHCPv4ScopePolicyList ADM element corresponding to the specified PolicyName. If no DHCPv4Policy has the specified PolicyName, return ERROR_DHCP_POLICY_NOT_FOUND.
Retrieve the DHCPv4Policy.Policy.Ranges ADM element. Retrieve the DHCP_IP_RANGE structure in the Elements ADM element from the DHCPv4Policy.Policy.Ranges that has the same StartAddress ADM element and EndAddress ADM element as the specified Range parameter. If none of the DHCPv4Policy.Policy.Ranges has the same StartAddress and EndAddress as the specified Range parameter, return ERROR_POLICY_RANGE_BAD.
Delete the DHCP_IP_RANGE structure in the Elements ADM element from the same DHCPv4Policy.Policy.Ranges as the specified Range parameter.
Return ERROR_SUCCESS.
Exceptions Thrown: No exceptions are thrown beyond those thrown by the underlying RPC protocol [MS-RPCE].