<div class="content" name="NetrGetDCName" uuid="ddd7452f-4b7d-47e6-895b-5b23d9dd2120"><p>The <b>NetrGetDCName</b> method MAY<a id="Appendix_A_Target_162"></a><a aria-label="Product behavior note 162" href="0c858a52-732a-43ec-85dd-e44b357c1898#Appendix_A_162" data-linktype="relative-path">&lt;162&gt;</a> be used to retrieve the <span><a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_0334e0bd-2755-42f6-aeff-2d4a22bf4abf" data-linktype="relative-path">NetBIOS
name</a></span> of the <span><a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_663cb13a-8b75-477f-b6e1-bea8f2fba64d" data-linktype="relative-path">PDC</a></span> for the
specified domain. </p><dl>
<dd>
<div><pre> NET_API_STATUS NetrGetDCName(
   [in, string] LOGONSRV_HANDLE ServerName,
   [in, unique, string, range(0,256)] wchar_t* DomainName,
   [out, string] wchar_t** Buffer
 );
</pre></div>
</dd></dl><p><b>ServerName: </b>The custom <span><a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_44deb72d-c62b-4335-90e4-b9fd4dd782ed" data-linktype="relative-path">binding
handle</a></span>, as defined in section <span><a href="3b224201-b531-43e2-8c79-b61f6dea8640" data-linktype="relative-path">3.5.4.1</a></span>, that
represents the connection to a <span><a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_76a05049-3531-4abd-aec8-30e19954b4bd" data-linktype="relative-path">domain controller</a></span>.</p><p><b>DomainName: </b>A null-terminated <span><a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_c305d0ab-8b94-461a-bd76-13b40cb8c4d8" data-linktype="relative-path">Unicode</a></span>
string that specifies the NetBIOS name of the domain.</p><p><b>Buffer: </b>A pointer to a null-terminated Unicode
string that contains the NetBIOS name of the PDC for the specified domain. The
server name returned by this method is prefixed by two backslashes (\\).</p><p><b>Return Values: </b>The method returns 0x00000000
on success; otherwise, it MUST return a nonzero error code and SHOULD return
the following error code.</p><dl>
<dd>
<dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return Value/Code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0x00000035 ERROR_ BAD_ NETPATH</td>
  <td>The network path was not found.</td>
 </tr></tbody></table>
</dd></dl></dd>
<dd>
<p>Verify that the client has sufficient privileges.
The server determines if the client has sufficient privileges (as specified in
section <span><a href="1ec94886-2b64-45af-b68e-3d9faa36617c" data-linktype="relative-path">3.5.4.2</a></span>). If the
server is not a domain controller the Access Request mask is set to
NETLOGON_WKSTA_RPC_ACCESS. If the server is a domain controller the Access
Request mask is set to NETLOGON_DCLOC_RPC_ACCESS.<a id="Appendix_A_Target_163"></a><a aria-label="Product behavior note 163" href="0c858a52-732a-43ec-85dd-e44b357c1898#Appendix_A_163" data-linktype="relative-path">&lt;163&gt;</a> If the
client does not have sufficient privileges the server MUST return
ERROR_ACCESS_DENIED.</p>
</dd>
<dd>
<p>If the <i>DomainName</i> parameter is not NULL and
is not a valid NetBIOS name format, the server MUST return NERR_DCNotFound (<span><a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a></span>
section <span><a href="../ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d" data-linktype="relative-path">2.2</a></span>).</p>
</dd></dl><p>The server MUST attempt to locate a PDC for the domain
specified by the client. The server MUST return NERR_DCNotFound if the PDC
could not be located for the specified domain. The server SHOULD<a id="Appendix_A_Target_164"></a><a aria-label="Product behavior note 164" href="0c858a52-732a-43ec-85dd-e44b357c1898#Appendix_A_164" data-linktype="relative-path">&lt;164&gt;</a> implement alternate means of
locating DCs: for example, a static list in a file, or two methods detailed in <span><a href="../ms-adts/d2435927-0999-4c62-8c6d-13ba31a52e1a" data-linktype="relative-path">[MS-ADTS]</a></span>
section <span><a href="../ms-adts/3e9711af-9067-435e-93fb-09182053cef7" data-linktype="relative-path">6.3.6</a></span>.</p><p>NetrGetDcName returns the name of the discovered PDC.</p></div>