<div class="content" name="R_DhcpSetDnsRegCredentials" uuid="f0f3cdd1-3fdb-4d10-97ee-e1e59c81ee3a"><p>The <b>R_DhcpSetDnsRegCredentials</b> method sets the DNS
user name and credentials in the DHCP server which is used for DNS
registrations for the DHCP client lease record.</p><dl>
<dd>
<div><pre> DWORD R_DhcpSetDnsRegCredentials(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in, string, unique] LPWSTR Uname,
   [in, string, unique] LPWSTR Domain,
   [in, string, unique] LPWSTR Passwd
 );
</pre></div>
</dd></dl><p><b>ServerIpAddress: </b>The IP address/host name of
the DHCP server. This parameter is unused.</p><p><b>Uname: </b>A pointer to a null-terminated Unicode
string that contains the user name for the DNS credentials.</p><p><b>Domain: </b>A pointer to a null-terminated Unicode
string that contains the <a href="a9d6a415-4de6-4058-befe-ca2e42764485#gt_45a1c9f1-0263-49a8-97c7-7aca1a99308c" data-linktype="relative-path">domain
name</a> for the DNS credentials.</p><p><b>Passwd: </b>A pointer to a run-encoded,
null-terminated Unicode string that contains the password for the DNS user
name.<a id="Appendix_A_Target_53"></a><a aria-label="Product behavior note 53" href="afab0546-79ae-4764-8dab-27a85cca5145#Appendix_A_53" data-linktype="relative-path">&lt;53&gt;</a></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 <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>.
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>0x00000000 ERROR_SUCCESS</td>
  <td>The call was successful.</td>
 </tr></tbody></table>
</dd></dl><p>The opnum field value for this method is 43.</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 <a href="38840bd0-0a5a-47ed-bc69-0dd870d33aec" data-linktype="relative-path">3.5.5</a>. If not,
return the error ERROR_ACCESS_DENIED.</p>
</li><li><p><span><span> 
</span></span>Run-decode the <i>Passwd</i> parameter to convert it into the
original clear-text form.<a id="Appendix_A_Target_54"></a><a aria-label="Product behavior note 54" href="afab0546-79ae-4764-8dab-27a85cca5145#Appendix_A_54" data-linktype="relative-path">&lt;54&gt;</a></p>
</li><li><p><span><span> 
</span></span>Store the information provided in <i>Uname</i>, <i>Domain</i>, <i>Passwd</i>
fields into the corresponding fields in the server ADM element <b>DHCPServerDnsRegCredentials</b>.</p>
</li><li><p><span><span> 
</span></span>Remove the old DHCP-DNS registration, as specified by the <a href="https://go.microsoft.com/fwlink/?LinkId=210548" data-linktype="external">[MSDN-FreeCredentialsHandle]</a>
function. If the removal succeeds, register the DHCP server credentials with
DNS as specified by the <a href="https://go.microsoft.com/fwlink/?LinkId=210547" data-linktype="external">[MSDN-AcquireCredentialsHandle]</a>
function. Return ERROR_SUCCESS, whether these registration APIs fail or
succeed.</p>
</li></ul><p><b>Exceptions Thrown:</b> No exceptions are thrown beyond
those thrown by the underlying RPC protocol <a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a>.</p></div>