The R_DhcpSetOptionValue method creates the option value when called for the first time. Otherwise, it modifies the option value for a specific option associated with the default user class and vendor class pair. The values can be set at the default, server, scope, multicast scope, or reservation level on the DHCPv4 server. The ScopeInfo parameter defines the level at which this option value is set.

 DWORD R_DhcpSetOptionValue(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] DHCP_OPTION_ID OptionID,
   [in, ref] LPDHCP_OPTION_SCOPE_INFO ScopeInfo,
   [in, ref] LPDHCP_OPTION_DATA OptionValue
 );

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

OptionID: This is of type DHCP_OPTION_ID (section 2.2.1.2.3), containing the option identifier for the option being set or modified.

ScopeInfo: This is a pointer to a DHCP_OPTION_SCOPE_INFO (section 2.2.1.2.41) structure that contains information describing the level (that is, default, server, scope, multicast scope, or reservation level) at which this option value is set on.

OptionValue: A pointer to a DHCP_OPTION_DATA (section 2.2.1.2.24) structure that contains the option value to be set. For Dynamic DNS update settings, see section 3.3.1.

Return Values: A 32-bit unsigned integer value that indicates return status. A return value ERROR_SUCCESS (0x00000000) indicates that the operation was completed successfully, else 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 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 on the DHCP server.

0x00004E2A

ERROR_DHCP_OPTION_NOT_PRESENT

The specified option definition does not exist on the DHCP server database.

0x00004E4C

ERROR_DHCP_CLASS_NOT_FOUND

The class name being used is unknown or incorrect.

0x00004E32

ERROR_DHCP_NOT_RESERVED_CLIENT

The specified DHCP client is not a reserved client.

The opnum field value for this method is 12.

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