<div class="content"><p> </p><p>The <b>R_DhcpCreateOptionV6</b> method creates an option
definition for a specified user class or vendor class at the default option
level. The option ID specifies the identifier of the option. If the user class
or vendor class is not specified, the option definition is created for the default
user class or vendor class.</p><dl>
<dd>
<div><pre> DWORD R_DhcpCreateOptionV6(
   [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 OptionInfo
 );
</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 definition is created 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 created 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 created 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 created.</p><p><b>ClassName: </b>A pointer to a null-terminated
Unicode string that contains the name of the user class for which the option
definition is created. 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 for which the option
definition is created. This parameter is optional. If vendor class name is not
specified, then the option definition is created for the default vendor class.</p><p><b>OptionInfo: </b>This is a pointer to a <span><a href="855b6a9a-e6e4-4c9d-a732-aadad749ca03" data-linktype="relative-path">DHCP_OPTION (section 2.2.1.2.25)</a></span>
structure that contains the information about the option definition.</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>0x00004E29</p>
  <p>ERROR_DHCP_OPTION_EXITS</p>
  </td>
  <td>
  <p>The specified option definition already exists in the
  DHCP server database.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00004E2D</p>
  <p>ERROR_DHCP_JET_ERROR</p>
  </td>
  <td>
  <p>An error occurred while accessing the DHCP server
  database.</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 opnum field value for this method is 47.</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 Flags parameter MUST pass one of the validations given in the
Flags field description. Otherwise, the method returns ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>Validate the <b>DefaultValue</b> data structure, pointed to by
the <b>OptionInfo</b> parameter, by checking that its <b>Elements</b> member is
not NULL and that its <b>NumElements</b> member is not zero.  If either check
fails, return ERROR_INVALID_PARAMETER.</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), then return ERROR_DHCP_INVALID_PARAMETER_OPTION32.</p>
</li><li><p><span><span> 
</span></span> If <i>ClassName</i> is not NULL, retrieve the <b>DHCPv6ClassDef</b>
entry corresponding to the <b>ClassName</b> 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, use the default user class (section <span><a href="1361cc31-22d9-4128-a9db-529841dd1ac4" data-linktype="relative-path">3.1.1.20</a></span>)
for the retrieval of <b>DHCPv6ClassedOptionDef</b>.</p>
</li><li><p><span><span> 
</span></span>If <i>VendorName</i> is not NULL, retrieve the <b>DHCPv6ClassDef</b>
entry corresponding to the <b>VendorName</b> 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, use the default vendor class (section 3.1.1.20)
for the retrieval of <b>DHCPv6ClassedOptionDef</b>.</p>
</li><li><p><span><span> 
</span></span>Retrieve the <b>DHCPv6ClassedOptionDef</b> object for the
specified user and vendor class from <b>DHCPv6ClassedOptionDefList</b>. If it
is not found, return ERROR_FILE_NOT_FOUND.</p>
</li><li><p><span><span> 
</span></span>If a <b>DHCPv6OptionDef</b> object already exists in <b>DHCPv6ClassedOptionDef.DHCPv6OptionDefList</b>
for that specific option ID and specific user and vendor class, return the
error ERROR_DHCP_OPTION_EXITS.</p>
</li><li><p><span><span> 
</span></span>Add a <b>DHCPv6OptionDef</b> object initiated from the
information in <b>OptionInfo</b> to <b>DHCPv6ClassedOptionDef.DHCPv6OptionDefList</b>.</p>
</li><li><p><span><span> 
</span></span>Return ERROR_SUCCESS.</p>
</li></ul></div>