DhcpV4SetOptionValue function
The DhcpV4SetOptionValue function sets information for a specific option value on the DHCP server. This function extends the functionality provided by DhcpSetOptionValueV5 by allowing the caller to specify a policy for the option.
Syntax
DWORD DHCP_API_FUNCTION DhcpV4SetOptionValue( _In_opt_ LPWSTR ServerIpAddress, _In_ DWORD Flags, _In_ DHCP_OPTION_ID OptionId, _In_opt_ LPWSTR PolicyName, _In_opt_ LPWSTR VendorName, _In_ LPDHCP_OPTION_SCOPE_INFO ScopeInfo, _In_ LPDHCP_OPTION_DATA OptionValue );
Parameters
- ServerIpAddress [in, optional]
-
Pointer to a null-terminated Unicode string that represents the IP address or hostname of the DHCP server.
- Flags [in]
-
Indicates whether the option is for a specific or default vendor.
Flags Meaning - 0x00000000
The option value is retrieved for a default vendor.
- DHCP_FLAGS_OPTION_IS_VENDOR
- 0x00000003
The option value is retrieved for a specific vendor. The vendor is in VendorName.
- OptionId [in]
-
DHCP_OPTION_ID structure that specifies the unique option code for the option value to retrieve. A complete list of standard DHCP and BOOTP option codes can be found at http://www.ietf.org/rfc/rfc2132.txt
- PolicyName [in, optional]
-
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.
- VendorName [in, optional]
-
A null-terminated Unicode string that represents the vendor of the option. This parameter is optional, and should be NULL when Flags is not DHCP_FLAGS_OPTION_IS_VENDOR. If the vendor is not specified, the option value is set for the default vendor.
- ScopeInfo [in]
-
Pointer to a DHCP_OPTION_SCOPE_INFO structure that contains information on the scope of the option value to set.
- OptionValue [in]
-
Pointer to a DHCP_OPTION_DATA structure that contains the data value corresponding to the DHCP option code specified by OptionID.
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. |
Requirements
|
Minimum supported client | None supported [desktop apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
Send comments about this topic to Microsoft
Build date: 2/28/2013