DhcpCreateOption function (dhcpsapi.h)
The DhcpCreateOption function creates an option definition for the default user and vendor class at the default option level.
Syntax
DWORD DHCP_API_FUNCTION DhcpCreateOption(
[in] DHCP_CONST WCHAR *ServerIpAddress,
[in] DHCP_OPTION_ID OptionID,
[in] DHCP_CONST DHCP_OPTION *OptionInfo
);
Parameters
[in] ServerIpAddress
Unicode string containing the IPv4 address of the DHCP server.
[in] OptionID
DHCP_OPTION_ID value that contains the unique option ID number (also called an "option code") of the new option. Many of these option ID numbers are defined; a complete list of standard DHCP and BOOTP option codes can be found in DHCP Options and BOOTP Vendor Extensions.
[in] OptionInfo
DHCP_OPTION structure that contains information describing the new DHCP option, including the name, an optional comment, and any related data items.
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 |
---|---|
|
An error occurred while accessing the DHCP server database. |
|
The specified option definition already exists in the DHCP server database. |
Remarks
An option is a client configuration parameter assigned by a DHCP server to DHCP and BOOTP clients. For example, some commonly used options include IP addresses for gateways (subnet routers), WINS servers, and DNS servers. Typically, these options are enabled and configured for a particular scope, but default options can be created for all scopes served by a given DHCP server.
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 |