<div class="content"><p> </p><p>The <b>R_DhcpV4SetOptionValues</b> method sets the specified
option values for a <span><a href="a9d6a415-4de6-4058-befe-ca2e42764485#gt_52323544-69e0-4172-8921-2711cbda988e" data-linktype="relative-path">policy</a></span> at the
specified level.</p><dl>
<dd>
<div><pre> DWORD R_DhcpV4SetOptionValues(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] DWORD Flags,
   [in, string, unique] WCHAR* PolicyName,
   [in, string, unique] WCHAR* VendorName,
   [in] LPDHCP_OPTION_SCOPE_INFO ScopeInfo,
   [in] LPDHCP_OPTION_VALUE_ARRAY OptionValues
 );
</pre></div>
</dd></dl><p><b>ServerIpAddress: </b>The IP address/host name of
the DHCP server. This parameter is unused.</p><p><b>Flags: </b>This is of type <span><a href="../ms-dtyp/262627d8-3418-4627-9218-4ffe110850b2" data-linktype="relative-path">DWORD</a></span>
that specifies that the option value is set for a specific or default vendor
class.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>DHCP_FLAGS_OPTION_DEFAULT</p>
  <p>0x00000000</p>
  </td>
  <td>
  <p>The <span><a href="a9d6a415-4de6-4058-befe-ca2e42764485#gt_da9bfcf7-a7e0-4cf0-ac87-ffdd83a5f25b" data-linktype="relative-path">option definition</a></span>
  is set for the default vendor class.</p>
  </td>
 </tr><tr>
  <td>
  <p>DHCP_FLAGS_OPTION_IS_VENDOR</p>
  <p>0x00000003</p>
  </td>
  <td>
  <p>If a bitwise AND operation with this bitmask yields a
  nonzero value, it indicates that the option definition is set for a specific
  vendor class.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p><b>PolicyName: </b>A pointer to a null-terminated
Unicode string that contains the name of the policy inside the subnet
identified by the <b>SubnetScopeInfo</b> member of the <i>ScopeInfo</i>
parameter for which the option value is being set.</p><p><b>VendorName: </b>A pointer to a null-terminated
Unicode string that contains the name of the vendor class to which the option
value is being set. This parameter is optional. If the vendor class is not
specified, the option value is set for a default vendor class.</p><p><b>ScopeInfo: </b>This is a pointer to a type <b>DHCP_OPTION_SCOPE_INFO</b>
structure (section <span><a href="177415f4-85c1-4496-a414-4938dca18b93" data-linktype="relative-path">2.2.1.2.41</a></span>) that
contains information describing the DHCPv4 scope for which this option value is
set. This value contains the server or scope level at which the option values are
set.</p><p><b>OptionValues: </b>This is a pointer to a type <b>DHCP_OPTION_VALUE_ARRAY</b>
structure (section <span><a href="313eaf77-256b-44d3-b303-8cca3f158939" data-linktype="relative-path">2.2.1.2.43</a></span>) that
points to the location that contains one or more option identifiers, along with
the values.</p><p><b>Return Values: </b>A 32-bit unsigned integer value
that indicates return status. A return value of ERROR_SUCCESS (0x00000000)
indicates that the operation was completed successfully. Otherwise, it contains
a Win32 error code, as specified in <span><a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a></span>.
This error code value can correspond to a DHCP-specific failure, which takes a
value between 20000 and 20099, or to any generic failure.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>0x00000000</p>
  <p>ERROR_SUCCESS</p>
  </td>
  <td>
  <p>The call was successful.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00004E25</p>
  <p>ERROR_DHCP_SUBNET_NOT_PRESENT</p>
  </td>
  <td>
  <p>The specified IPv4 subnet does not exist on the DHCP
  server.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00004E2A</p>
  <p>ERROR_DHCP_OPTION_NOT_PRESENT</p>
  </td>
  <td>
  <p>The specified option definition does not exist on the
  DHCP server database.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00004E32</p>
  <p>ERROR_DHCP_NOT_RESERVED_CLIENT</p>
  </td>
  <td>
  <p>The specified DHCP client is not a reserved client.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00004E4C</p>
  <p>ERROR_DHCP_CLASS_NOT_FOUND</p>
  </td>
  <td>
  <p>The class name being used is unknown or incorrect.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00004E8FL</p>
  <p>ERROR_DHCP_POLICY_NOT_PRESENT</p>
  </td>
  <td>
  <p>The specified policy name does not exist.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00004EA8L</p>
  <p>ERROR_DHCP_POLICY_FQDN_OPTION_UNSUPPORTED</p>
  </td>
  <td>
  <p>The option value cannot be specified because the
  policy contains an FQDN-based condition.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p>The opnum field value for this method is 102.</p><p>When processing this call, the DHCP server MUST do the
following:</p><ul><li><p><span><span> 
</span></span>If the <i>OptionValues</i> parameter or the <i>ScopeInfo</i>
parameter is NULL, the method returns ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>The <i>Flags</i> parameter MUST pass one of the validations given
in the <i>Flags</i> parameter description. Otherwise, the method returns
ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>If the <b>ScopeType</b> member in the <i>ScopeInfo</i> parameter
is DhcpReservedOptions enumeration value or DhcpMScopeOptions enumeration value
and the <i>PolicyName</i> parameter is not NULL, the method returns
ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>If the <b>Values</b> member of the <i>OptionValues</i> parameter
is NULL, return ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>Validate whether this method is authorized for read/write access
as specified in section <span><a href="38840bd0-0a5a-47ed-bc69-0dd870d33aec" data-linktype="relative-path">3.5.5</a></span>. If not, return
ERROR_ACCESS_DENIED.</p>
</li><li><p><span><span> 
</span></span>Validate whether the policy specified in the PolicyName parameter
contains a condition of Type DhcpAttrFqdn or DhcpAttrFqdnSingleLabel, as
defined in the <span><a href="f05fc88f-3ac7-4c44-9998-40e4acaeb776" data-linktype="relative-path">DHCP_POL_ATTR_TYPE (section 2.2.1.1.23)</a></span>
enumeration. If it does, and if any of the values for the <i>OptionId</i>
parameters specified in the <i>OptionValues</i> parameter specify values other
than DNS settings (81) or lease time (51), return
ERROR_DHCP_POLICY_FQDN_OPTION_UNSUPPORTED.<a id="Appendix_A_Target_74"></a><a aria-label="Product behavior note 74" href="afab0546-79ae-4764-8dab-27a85cca5145#Appendix_A_74" data-linktype="relative-path">&lt;74&gt;</a></p>
</li><li><p><span><span> 
</span></span>For each <b>Values</b> member in the <b>DHCP_OPTION_VALUE</b>
structure element in the <i>OptionValues</i> parameter of the <b>DHCP_OPTION_VALUE_ARRAY</b>
structure, validate the data pointed to by the <b>Value</b> member. If the <b>Elements</b>
member of the <b>DHCP_OPTION_DATA</b> structure is NULL or the <b>NumElements</b>
member is 0, return ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>If the <i>VendorName</i> parameter is not NULL, retrieve the <b>DHCPv4ClassDef</b>
ADM element entry corresponding to the <i>VendorName</i> parameter from the
server ADM element <b>DHCPv4ClassDefList</b>. If the <b>DHCPv4ClassDef</b> ADM
element entry is not found, return ERROR_DHCP_CLASS_NOT_FOUND. If the <i>VendorName</i>
parameter is NULL, it refers to the default vendor class (see section <span><a href="6c69e0bd-f280-46d9-93b4-054370c6428c" data-linktype="relative-path">3.1.1.11</a></span>).</p>
</li><li><p><span><span> 
</span></span>If the <i>ScopeType</i> member in the <i>ScopeInfo</i> parameter
is set to DhcpDefaultOptions:</p>
<ul><li><p><span><span>  </span></span>Iterate
through the server ADM element <b>DHCPv4OptionDefList</b> and retrieve the <b>DHCPv4OptionDef.DHCPv4ClassedOptDefList</b>
ADM element corresponding to the vendor class specified by the <i>VendorName</i>
parameter. If there is no <b>DHCPv4OptionDef</b> ADM element entry
corresponding to the specified vendor class, return ERROR_DHCP_CLASS_NOT_FOUND.</p>
</li><li><p><span><span>  </span></span>For
each <b>DHCP_OPTION_VALUE</b> structure in the <b>DHCP_OPTION_VALUE_ARRAY</b>
structure in the <i>OptionValues</i> parameter:</p>
<ul><li><p><span><span> 
</span></span>If there is no <b>DHCPv4ClassedOptDef</b> ADM element entry in
the <b>DHCPv4ClassedOptDefList</b> ADM element corresponding to the <b>OptionID</b>
member in the <b>DHCP_OPTION_VALUE</b> structure, return
ERROR_DHCP_OPTION_NOT_PRESENT.</p>
</li><li><p><span><span> 
</span></span>Modify the retrieved <b>DHCPv4ClassedOptDef</b> entry with
information in the corresponding <b>DHCP_OPTION_VALUE</b> structure element.</p>
</li></ul></li><li><p><span><span>  </span></span>Return
ERROR_SUCCESS.</p>
</li></ul></li><li><p><span><span> 
</span></span>If the <b>ScopeType</b> member in the <i>ScopeInfo</i> parameter
contains the DhcpGlobalOptions enumeration value:</p>
<ul><li><p><span><span>  </span></span>Retrieve
the server ADM element <b>DHCPv4ServerPolicyList</b>. Retrieve the <b>DHCPv4Policy</b>
ADM element from the <b>DHCPv4ServerPolicyList</b> ADM element that has the
same name as the <i>PolicyName</i> parameter. If there is no policy with the
specified name, return ERROR_DHCP_POLICY_NOT_FOUND.</p>
</li><li><p><span><span>  </span></span>Retrieve
each <b>DHCPv4PolicyOptionValue</b> ADM element from the server ADM element <b>DHCPv4ServerPolicyOptionValuesList</b>.
Get the <b>DHCPv4PolicyOptionValue</b> ADM element for which the <b>DHCPv4PolicyOptionValue.PolicyName</b>
ADM element and the <b>DHCPv4PolicyOptionValue.VendorName</b> ADM element match
the <i>PolicyName</i> parameter and the <i>VendorName</i> parameter passed to
the method.</p>
</li><li><p><span><span>  </span></span>For
each <b>DHCP_OPTION_VALUE</b> structure in the <i>OptionValues</i> parameter,
perform the following steps:</p>
<ol><li><p><span>    </span>Retrieve the <b>DHCPv4PolicyOptionValue.DHCPv4ClassedOptionValues</b>
ADM element list.</p>
</li><li><p><span>    </span>If there is a <b>DHCPv4ClassedOptValue</b>
ADM element that contains the same <b>OptionID</b> ADM element as the <b>OptionID</b>
member in the <b>DHCP_OPTION_VALUE</b> structure, delete the <b>DHCPv4ClassedOptValue</b>
ADM element.</p>
</li><li><p><span>    </span>Create a <b>DHCPv4ClassedOptValue</b>
ADM element with the <b>OptionID</b> ADM element set to the <b>OptionID</b>
member in the <b>DHCP_OPTION_VALUE</b> structure and the data member of the <b>DHCPv4ClassedOptValue</b>
ADM element set to the <b>Value</b> member in the <b>DHCP_OPTION_VALUE</b>
structure passed to the method. Add the created <b>DHCPv4ClassedOptValue</b>
ADM element to the <b>DHCPv4PolicyOptionValue.DHCPv4ClassedOptionValues</b> ADM
element list.</p>
<p>After performing these steps for all <b>DHCP_OPTION_VALUE</b>
structure elements in the <i>OptionValues</i> parameter, return ERROR_SUCCESS.</p>
</li></ol></li></ul></li><li><p><span><span> 
</span></span>If the <i>ScopeInfo</i> parameter contains the <b>SubnetScopeInfo</b>
member:</p>
<ul><li><p><span><span>  </span></span>Retrieve
the server ADM element <b>DHCPv4ScopesList</b>. Retrieve the <b>DHCPv4Scope</b>
ADM element that contains the same IP address as the IP address in the <b>SubnetScopeInfo</b>
member. If there is no scope with the specified IP address, return
ERROR_DHCP_SUBNET_NOT_PRESENT.</p>
</li><li><p><span><span>  </span></span>Retrieve
the <b>DHCPv4Scope.DHCPv4ScopePolicyList</b> ADM element. Retrieve the <b>DHCPv4Policy</b>
ADM element from the <b>DHCPv4Scope.DHCPv4ScopePolicyList</b> ADM element with
the specified <i>PolicyName</i> parameter. If there is no policy with the
specified name, return ERROR_DHCP_POLICY_NOT_FOUND.</p>
</li><li><p><span><span>  </span></span>Retrieve
each <b>DHCPv4PolicyOptionValue</b> ADM element from the scope ADM element <b>DHCPv4Scope.DHCPv4ScopePolicyOptionValuesList</b>.
Get the <b>DHCPv4PolicyOptionValue</b> ADM element for which the <b>DHCPv4PolicyOptionValue.PolicyName</b>
ADM element and the <b>DHCPv4PolicyOptionValue.VendorName</b> ADM element match
the <i>PolicyName</i> parameter and the <i>VendorName</i> parameter passed to
the method.</p>
</li><li><p><span><span>  </span></span>For
each <b>DHCP_OPTION_VALUE</b> structure in the <i>OptionValues</i> parameter,
perform the following steps:</p>
<ol><li><p><span>    </span>Retrieve the <b>DHCPv4PolicyOptionValue.DHCPv4ClassedOptionValues</b>
ADM element list.</p>
</li><li><p><span>    </span>If there is a <b>DHCPv4ClassedOptValue</b>
ADM element that contains the same <b>OptionID</b> ADM element as the <b>OptionID</b>
member in the <b>DHCP_OPTION_VALUE</b> structure, delete the <b>DHCPv4ClassedOptValue</b>
ADM element.</p>
</li><li><p><span>    </span>Create a <b>DHCPv4ClassedOptValue</b>
ADM element with the <b>OptionID</b> ADM element set to the <b>OptionID</b>
member in the <b>DHCP_OPTION_VALUE</b> structure and the data member of the <b>DHCPv4ClassedOptValue</b>
ADM element set to the <b>Value</b> member in the <b>DHCP_OPTION_VALUE</b>
structure. Add the created <b>DHCPv4ClassedOptValue</b> ADM element to the <b>DHCPv4PolicyOptionValue.DHCPv4ClassedOptionValues</b>
ADM element list, and return ERROR_SUCCESS.</p>
</li></ol></li><li><p><span><span>  </span></span>After
performing these steps for all <b>DHCP_OPTION_VALUE</b> structure elements in
the <i>OptionValues</i> parameter, return ERROR_SUCCESS.</p>
</li></ul></li></ul><p><b>Exceptions Thrown:</b> No exceptions are thrown beyond
those thrown by the underlying RPC protocol <span><a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a></span>.</p></div>