The R_DhcpV4AddPolicyRange method adds an IP address range to a policy.

 DWORD R_DhcpV4AddPolicyRange(
   [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 structure (section 2.2.1.2.1) that contains the IPv4 subnet ID for which the policy is being set.

PolicyName: A pointer to a null-terminated Unicode string that contains the name of the policy inside the subnet identified by the SubnetAddress parameter for which the IP address range is being set.

Range: This is a pointer to a type DHCP_IP_RANGE structure (section 2.2.1.2.31) that specifies the IP address range to be added to 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 IP range is not contained within the IP address range of the scope, or the specified policy IP range is not valid.

0x00004E8A

ERROR_DHCP_POLICY_RANGE_EXISTS

The specified policy IP range overlaps one of the policy IP address ranges specified.

0x00004EA7

ERROR_DHCP_POLICY_FQDN_RANGE_UNSUPPORTED

Ranges are not allowed to be added to the given policy.

The opnum field value for this method is 113.

When processing this call, the DHCP server MUST do the following:

Exceptions Thrown: No exceptions are thrown beyond those thrown by the underlying RPC protocol [MS-RPCE].