DhcpHlprCreateV4Policy function (dhcpsapi.h)

The DhcpHlprCreateV4Policy function allocates and initializes a DHCP server policy structure.

Syntax

DWORD DHCP_API_FUNCTION DhcpHlprCreateV4Policy(
  [in]  LPWSTR              PolicyName,
  [in]  BOOL                fGlobalPolicy,
  [in]  DHCP_IP_ADDRESS     Subnet,
  [in]  DWORD               ProcessingOrder,
  [in]  DHCP_POL_LOGIC_OPER RootOperator,
  [in]  LPWSTR              Description,
  [in]  BOOL                Enabled,
  [out] LPDHCP_POLICY       *Policy
);

Parameters

[in] PolicyName

A null-terminated unicode string that contains the name of the DHCP server policy to create.

[in] fGlobalPolicy

If TRUE a server level policy is created. Otherwise, a scope level policy is created

[in] Subnet

DHCP_IP_ADDRESS structure that contains the IPv4 subnet address of the scope level policy to create.

[in] ProcessingOrder

Integer that specifies the processing order of the DHCP server policy. 1 indicates the highest priority and MAX_DWORD indicates the lowest.

[in] RootOperator

DHCP_POL_LOGIC_OPER enumeration that defines how the policy condition is to be evaluated in terms of the results of its constituents.

[in] Description

A pointer to a null-terminated Unicode string that contains the description of the DHCP server policy.

[in] Enabled

TRUE if the policy is enabled. Otherwise, it is FALSE.

[out] Policy

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 or an error code from DHCP Server Management API Error Codes.

Value Meaning
ERROR_INVALID_PARAMETER
One or more of the parameters were invalid.
ERROR_NOT_ENOUGH_MEMORY
Not enough memory available.

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

See also

DhcpHlprAddV4PolicyCondition

DhcpHlprAddV4PolicyExpr

DhcpHlprAddV4PolicyRange

DhcpHlprFreeV4Policy

DhcpHlprIsV4PolicySingleUC

DhcpHlprIsV4PolicyValid

DhcpHlprIsV4PolicyWellFormed

DhcpHlprModifyV4PolicyExpr

DhcpHlprResetV4PolicyExpr