The R_DhcpServerSetConfig method sets/modifies the DHCPv4 server settings. There is an extension method R_DhcpServerSetConfigV4 (section 3.1.4.40) that sets some additional settings on the DHCPv4 server.

 DWORD R_DhcpServerSetConfig(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] DWORD FieldsToSet,
   [in, ref] LPDHCP_SERVER_CONFIG_INFO ConfigInfo
 );

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

FieldsToSet: A DWORD that contains the bitmask of the fields in the ConfigInfo structure to set. This method can be called with a value for FieldsToSet.

The bit mapping for the various values for FieldsToSet is listed in the following table:

FieldsToSet

Bit

Set_APIProtocolSupport

0x00000001

Set_DatabaseName

0x00000002

Set_DatabasePath

0x00000004

Set_BackupPath

0x00000008

Set_BackupInterval

0x00000010

Set_DatabaseLoggingFlag

0x00000020

Set_RestoreFlag

0x00000040

Set_DatabaseCleanupInterval

0x00000080

Set_DebugFlag

0x00000100

The DHCP Server ignores the bits not specified in the table.

Most of the settings are effective immediately. The DHCPv4 server needs to be restarted for the following settings to become effective:

ConfigInfo: A pointer of type DHCP_SERVER_CONFIG_INFO (section 2.2.1.2.53) structure that contains the settings for the DHCPv4 server. The value that is passed here depends on the FieldsToSet parameter. Details of the dependencies follow the return value description.

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. Otherwise, the return value 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.

The opnum field value for this method is 25.

When processing this call, the DHCP server MUST do the following:

Exceptions Thrown: No exceptions SHOULD be thrown beyond those thrown by the underlying RPC protocol [MS-RPCE].