<div class="content"><p> </p><p>The <b>R_DhcpSetOptionValueV6</b> method creates option
value when called for the first time, else it modifies the option value of a
specific option on the DHCPv6 server for a specific user class and vendor
class. <i>ScopeInfo</i> defines the scope on which this option value is set. If
the user class and vendor class is not provided, the default user class and
vendor class is taken.</p><dl>
<dd>
<div><pre> DWORD R_DhcpSetOptionValueV6(
     [in, unique, string]  DHCP_SRV_HANDLE ServerIpAddress,
     [in]    DWORD Flags,
     [in]    DHCP_OPTION_ID OptionId,
     [in, string, unique]   WCHAR *ClassName,
     [in, string, unique]   WCHAR *VendorName,
     [in]    LPDHCP_OPTION_SCOPE_INFO6 ScopeInfo,
     [in]    LPDHCP_OPTION_DATA OptionValue
 );
</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>,
specifying 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>Option definition is set/modified for a 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/modified for a
  specific vendor class.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p><b>OptionID: </b>This is of type <span><a href="4a0bb785-ceec-4f7a-b4a7-64555f6e0b62" data-linktype="relative-path">DHCP_OPTION_ID (section 2.2.1.2.3)</a></span>,
containing the option identifier for the option being set/modified.</p><p><b>ClassName: </b>A pointer to a null-terminated
Unicode string that contains the name of the user class to which the option
value is being set. This parameter is optional.</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 a vendor class is not
specified, the option value is set for the default vendor class.</p><p><b>ScopeInfo: </b>This is a pointer to a <span><a href="35c698cc-7141-4985-9940-87361653c79d" data-linktype="relative-path">DHCP_OPTION_SCOPE_INFO6 (section 2.2.1.2.30)</a></span>
structure that contains information describing the DHCPv6 scope this option
value is set on. This value defines that option value is being set at the
default, server, or scope level or for an IPv6 reservation.</p><p><b>OptionValue: </b>A pointer to <span><a href="6b01abaa-f56b-4a9b-9596-64c7813fdfe7" data-linktype="relative-path">DHCP_OPTION_DATA (section 2.2.1.2.24)</a></span>
structure that contains the option value that is set for an option
corresponding to the <i>OptionID</i>. For Dynamic DNS update settings, see
section <span><a href="17acb876-ed9f-4ecd-b7bc-1a3ff34952cd" data-linktype="relative-path">3.3.2</a></span>.</p><p><b>Return Values: </b>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 <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 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>0x00004E2A</p>
  <p>ERROR_DHCP_OPTION_NOT_PRESENT</p>
  </td>
  <td>
  <p>The option to be modified does not exist.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00004E59</p>
  <p>ERROR_DHCP_INVALID_PARAMETER_OPTION32</p>
  </td>
  <td>
  <p>The information refresh time option value is invalid,
  as it is less than the minimum option value.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p>The <span><a href="a9d6a415-4de6-4058-befe-ca2e42764485#gt_e127848e-c66d-427d-b3aa-9f904fa4ada7" data-linktype="relative-path">opnum</a></span> field value
for this method is 52.</p><p>When processing this call, the DHCP server MUST do the
following:</p><ul><li><p><span><span> 
</span></span>Validate if this method is authorized for read/write access per
section <span><a href="38840bd0-0a5a-47ed-bc69-0dd870d33aec" data-linktype="relative-path">3.5.5</a></span>. If not,
return the error ERROR_ACCESS_DENIED.</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>Validate the data pointed to by the input parameter <i>OptionValue</i>.
If the <b>Elements</b> member of the
DHCP_OPTION_DATA (section 2.2.1.2.24) structure is NULL or the <b>NumElements</b>
member is 0, return ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>If <i>ClassName</i> is not NULL, retrieve the <b>DHCPv6ClassDef</b>
entry corresponding to the <i>ClassName</i> from the server ADM element <b>DHCPv6ClassDefList</b>.
If the <b>DHCPv6ClassDef</b> entry is not found, return ERROR_FILE_NOT_FOUND.
If <i>ClassName</i> is NULL, it refers to the default user class (section <span><a href="8a151805-0803-42fe-b201-e2ff378ffa8b" data-linktype="relative-path">3.1.1.17</a></span>).</p>
</li><li><p><span><span> 
</span></span>If <i>VendorName</i> is not NULL, retrieve the <b>DHCPv6ClassDef</b>
entry corresponding to the <i>VendorName</i> from the server ADM element <b>DHCPv6ClassDefList</b>.
If the <b>DHCPv6ClassDef</b> entry is not found, return ERROR_FILE_NOT_FOUND.
If <i>VendorName</i> is NULL, it refers to the default vendor class (section
3.1.1.17).</p>
</li><li><p><span><span> 
</span></span>Retrieve the <b>DHCPv6ClassedOptionDef</b> object from <b>DHCPv6ClassedOptionDefList</b>
for the specific user class and vendor class. If it is not found, return
ERROR_FILE_NOT_FOUND.</p>
</li><li><p><span><span> 
</span></span>If the <i>ScopeInfo</i> parameter contains DhcpDefaultOptions6,
retrieve the <b>DHCPv6OptionDef</b> object corresponding to <i>OptionID</i>
from <b>DHCPv6ClassedOptionDef.DHCPv6OptionDefList</b>. If it is not found,
return ERROR_DHCP_OPTION_NOT_PRESENT.</p>
</li><li><p><span><span> 
</span></span>If the option specified is Information Refresh Time Option
(option identifier 32) and the value specified is less than the minimum
specified (<span><a href="https://go.microsoft.com/fwlink/?LinkId=208766" data-linktype="external">[RFC4242]</a></span>
section 3.1), return ERROR_DHCP_INVALID_PARAMETER_OPTION32.</p>
</li><li><p><span><span> 
</span></span>If the <i>ScopeInfo</i> parameter contains DhcpGlobalOptions6 or
DhcpDefaultOptions6:</p>
<ul><li><p><span><span>  </span></span>Retrieve
the <b>DHCPv6ServerClassedOptValueList.DHCPv6ClassedOptValue</b> object
corresponding to the user class and vendor class specified. If it is not found,
create a new <b>DHCPv6ClassedOptValue</b> object corresponding to the specified
user class and vendor class. </p>
</li><li><p><span><span>  </span></span>Retrieve
the <b>DHCPv6OptionValue</b> object corresponding to the <i>OptionID</i>
parameter from <b>DHCPv6ClassedOptValue.DHCPv6OptionValueList</b>. If found,
remove it from <b>DHCPv6OptionValueList</b>.</p>
</li><li><p><span><span>  </span></span>Add
a new <b>DHCPv6OptionValue</b> object having <b>DHCPv6OptionValue.OptionData</b>
equal to the <i>OptionValue</i> parameter.</p>
</li></ul></li><li><p><span><span> 
</span></span>If the <i>ScopeInfo</i> parameter contains DhcpScopeOptions6:</p>
<ul><li><p><span><span>  </span></span>Retrieve
the <b>DHCPv6Scope</b> object corresponding to the <i>ScopeInfo</i> parameter
from <b>DHCPv6ScopeList</b>. If the corresponding <b>DHCPv6Scope</b> object is
not defined, return ERROR_FILE_NOT_FOUND.</p>
</li><li><p><span><span>  </span></span>Retrieve
the <b>DHCPv6Scope.DHCPv6ScopeClassedOptValueList.DHCPv6ClassedOptValue</b>
object for the specific user and vendor class. If it is not found, create a new
<b>DHCPv6ClassedOptValue</b> object corresponding to the specified user class
and vendor class.</p>
</li><li><p><span><span>  </span></span>Retrieve
the <b>DHCPv6ClassedOptValue.DHCPv6OptionValueList.DHCPv6OptionValue</b> object
corresponding to the <b>OptionID</b> parameter. If found, remove it from <b>DHCPv6OptionValueList</b>.</p>
</li><li><p><span><span>  </span></span>Add
a new <b>DHCPv6OptionValue</b> object having <b>DHCPv6OptionValue.OptionData</b>
equal to <b>Optionvalue</b>.</p>
</li></ul></li><li><p><span><span> 
</span></span>If the <i>ScopeInfo</i> parameter contains DhcpReservedOptions6:</p>
<ul><li><p><span><span>  </span></span>Retrieve
the <b>DHCPv6Scope</b> object and the <b>DHCPv6Scope.DHCPv6ReservationList.DHCPv6Reservation</b>
object corresponding to <i>ScopeInfo</i>. If the corresponding <b>DHCPv6Scope</b>
object or the <b>DHCPv6Reservation</b> object is not found, return
ERROR_INVALID_PARAMETER.<a id="Appendix_A_Target_56"></a><a aria-label="Product behavior note 56" href="afab0546-79ae-4764-8dab-27a85cca5145#Appendix_A_56" data-linktype="relative-path">&lt;56&gt;</a></p>
</li><li><p><span><span>  </span></span>Retrieve
the <b>DHCPv6Reservation.DHCPv6ResvClassedOptValueList.DHCPv6ClassedOptValue</b>
object for the specific user and vendor class. If it is not found, create a new
<b>DHCPv6ClassedOptValue</b> object corresponding to the specified user class
and vendor class.</p>
</li><li><p><span><span>  </span></span>Retrieve
the <b>DHCPv6ClassedOptValue.DHCPv6OptionValueList.DHCPv6OptionValue</b> object
corresponding to the <b>OptionID</b> parameter. If the object is found, remove
it from <b>DHCPv6OptionValueList</b>.</p>
</li><li><p><span><span>  </span></span>Add
a new <b>DHCPv6OptionValue</b> object having <b>DHCPv6OptionValue.OptionData</b>
equal to <b>Optionvalue</b>.</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>