DhcpV4SetOptionValues function (dhcpsapi.h)
The DhcpV4SetOptionValues function sets option codes and their associated data values for a specific scope defined on the DHCP server. This function extends the functionality provided by DhcpSetOptionValuesV5 by allowing the caller to specify a policy for the options.
Syntax
DWORD DHCP_API_FUNCTION DhcpV4SetOptionValues(
[in, optional] LPWSTR ServerIpAddress,
[in] DWORD Flags,
[in, optional] LPWSTR PolicyName,
[in, optional] LPWSTR VendorName,
[in] LPDHCP_OPTION_SCOPE_INFO ScopeInfo,
[in] LPDHCP_OPTION_VALUE_ARRAY OptionValues
);
Parameters
[in, optional] ServerIpAddress
Pointer to a null-terminated Unicode string that represents the IP address or hostname of the DHCP server.
[in] Flags
Reserved. Must be 0.
[in, optional] PolicyName
A null-terminated Unicode string that represents the name of the policy inside the subnet of the option value to set. The subnet is identified by the SubnetScopeInfo member of ScopeInfo.
[in, optional] VendorName
A null-terminated Unicode string that represents the vendor of the option. This parameter is optional, and if NULL, the option value is set for the default vendor.
[in] ScopeInfo
Pointer to a DHCP_OPTION_SCOPE_INFO structure that contains information describing the DHCP scope of the option values to set. This parameter specifies whether the option value is set for the default, server, or scope level, or for an IPv4 reservation.
[in] OptionValues
Pointer to a DHCP_OPTION_VALUE_ARRAY structure that contains a list of option codes and the corresponding data value that will be set.
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 |
---|---|
|
One or more of the parameters were invalid. |
|
The specified IPv4 subnet does not exist. |
|
The class name being used is unknown or incorrect. |
|
The specified policy name does not exist. |
|
The specified option definition does not exist on the DHCP server database. |
|
The specified DHCP client is not a reserved client. |
Remarks
OptionValues and its member, Values, should be free using DhcpRpcFreeMemory.
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 |