DhcpV4CreatePolicy function (dhcpsapi.h)
The DhcpV4CreatePolicy function creates a new policy on the DHCP Server.
Syntax
DWORD DHCP_API_FUNCTION DhcpV4CreatePolicy(
[in, optional] LPWSTR ServerIpAddress,
[in] LPDHCP_POLICY pPolicy
);
Parameters
[in, optional] ServerIpAddress
Pointer to a null-terminated Unicode string that represents the IP address or hostname of the DHCP server.
[in] pPolicy
Pointer to a DHCP_POLICY structure that contains the parameters of the policy to create.
Return value
If the function succeeds, it returns ERROR_SUCCESS.
If the function fails, it returns one of the following error codes.
Value | Meaning |
---|---|
|
The specified IPv4 subnet does not exist. |
|
A policy range has been specified for a server level policy. |
|
The specified conditions or expressions of the policy are invalid. |
|
The specified policy IP range is not contained within the IP address range of the scope or the specified policy IP range is invalid. |
|
The specified policy name exists at the specified level (server or scope). |
|
The specified policy IP range overlaps with the policy IP ranges of an existing policy at the specified scope. |
|
The specified processing order is greater than the maximum processing order of the existing policies at the specified level (server or scope). |
|
The vendor class or user class reference in the conditions of the policy does not exist. |
|
The parameters were invalid. |
Requirements
Requirement | Value |
---|---|
Minimum supported client | None supported |
Minimum supported server | Windows Server 2012 [desktop apps only] |
Target Platform | Windows |
Header | dhcpsapi.h |
Library | Dhcpsapi.lib |
DLL | Dhcpsapi.dll |