The R_DhcpV4CreatePolicy method creates the policy according to the data specified in the policy data structure.

 DWORD R_DhcpV4CreatePolicy(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] LPDHCP_POLICY pPolicy
 );

ServerIpAddress: The IP address/host name of the DHCP server. This parameter is unused.

pPolicy: This is a pointer to a type DHCP_POLICY (section 2.2.1.2.110) and contains the members of the policy to be created.

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.

0x00004E8C

ERROR_DHCP_RANGE_INVALID_IN_SERVER_POLICY

A policy range has been specified for a server level policy.

0x00004E8D

ERROR_DHCP_INVALID_POLICY_EXPRESSION

The specified conditions or expressions of the policy are invalid.

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 invalid.

0x00004E89

ERROR_DHCP_POLICY_EXISTS

The specified policy name exists at the specified level (server or scope).

0x00004E8A

ERROR_DHCP_POLICY_RANGE_EXISTS

The specified policy IP range overlaps the policy IP ranges of an existing policy at the specified scope.

0x00004E8E

ERROR_DHCP_INVALID_PROCESSING_ORDER

The specified processing order is greater than the maximum processing order of the existing policies at the specified level (server or scope).

0x00004E4C

ERROR_DHCP_CLASS_NOT_FOUND

The vendor class or user class reference in the conditions of the policy does not exist.

0x00004EAC

ERROR_DHCP_POLICY_FQDN_RANGE_UNSUPPORTED

Ranges are not allowed to be set on the given policy.

The opnum field value for this method is 108.

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 specified in [MS-RPCE].