DhcpSetOptionValuesV5 function (dhcpsapi.h)

The DhcpSetOptionValuesV5 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 DhcpSetOptionValues by allowing the caller to specify a class and/or vendor for the options.

Syntax

DWORD DhcpSetOptionValuesV5(
  [in] LPWSTR                    ServerIpAddress,
  [in] DWORD                     Flags,
  [in] LPWSTR                    ClassName,
  [in] LPWSTR                    VendorName,
  [in] LPDHCP_OPTION_SCOPE_INFO  ScopeInfo,
  [in] LPDHCP_OPTION_VALUE_ARRAY OptionValues
);

Parameters

[in] ServerIpAddress

Unicode string that specifies the IPv4 address of the DHCP server.

[in] Flags

This parameter must be set to 0 and ignored upon receipt.

[in] ClassName

Unicode string that specifies the DHCP class of the options. This parameter is optional.

[in] VendorName

Unicode string that specifies the vendor of the options. If no vendor class is specified, then the option value is set for the default vendor class. This parameter is optional.

[in] ScopeInfo

Pointer to a DHCP_OPTION_SCOPE_INFO structure that contains information describing the DHCP scope these option values will be set on. This parameter indicates 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 for them.

Return value

This function returns ERROR_SUCCESS upon a successful call. Otherwise, it returns one of the DHCP Server Management API Error Codes.

Return code Description
ERROR_DHCP_JET_ERROR
An error occurred while accessing the DHCP server database.
ERROR_DHCP_SUBNET_NOT_PRESENT
The specified IPv4 subnet does not exist on the DHCP server.
ERROR_DHCP_OPTION_NOT_PRESENT
The specified option definition could not be found in the DHCP server database.
ERROR_DHCP_NOT_RESERVED_CLIENT
The specified DHCP client is not an IPv4 reserved client.
ERROR_DHCP_CLASS_NOT_FOUND
The specified class name cannot be found in the DHCP server database.

Remarks

The caller of this function must release the memory pointed to by OptionValues after the call completes.

Requirements

Requirement Value
Minimum supported client None supported
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header dhcpsapi.h
Library Dhcpsapi.lib
DLL Dhcpsapi.dll

See also

DHCP_OPTION_SCOPE_INFO

DHCP_OPTION_VALUE_ARRAY

DhcpSetOptionValueV5

DhcpSetOptionValues