<div class="content"><p align="right"><a href="https://msdn.microsoft.com/en-us/library/2b0173e2-8c45-4fde-8967-ad1cbbc7e593" data-linktype="external">msdn link</a></p><p>The <b>DsrGetSiteName</b> method 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> return the <a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_8abdc986-5679-42d9-ad76-b11eb5a0daba" data-linktype="relative-path">site</a> name for the specified
computer that receives this call. </p><dl>
<dd>
<div><pre> NET_API_STATUS DsrGetSiteName(
   [in, unique, string] LOGONSRV_HANDLE ComputerName,
   [out, string] wchar_t** SiteName
 );
</pre></div>
</dd></dl><p><b>ComputerName: </b>The custom <a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_44deb72d-c62b-4335-90e4-b9fd4dd782ed" data-linktype="relative-path">binding handle</a> (defined in
section <a href="3b224201-b531-43e2-8c79-b61f6dea8640" data-linktype="relative-path">3.5.4.1</a>).</p><p><b>SiteName: </b>A null-terminated <a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_c305d0ab-8b94-461a-bd76-13b40cb8c4d8" data-linktype="relative-path">Unicode</a> string that
contains the name of the site in which the computer that receives this call
resides. </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><table><thead>
  <tr>
   <th>
   <p>Return Value/Code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>0x0000077F</p>
  <p>ERROR_NO_SITENAME</p>
  </td>
  <td>
  <p>No site name is available for this machine.</p>
  </td>
 </tr></tbody></table><p>If the computer has been configured with a SiteName, it MUST
return the SiteName immediately.</p><p>If the DynamicSiteNameSetTime plus the
DynamicSiteNameTimeout is less than the current time (meaning that the
DynamicSiteNameSetTime is older than allowed by DynamicSiteNameTimeout), then:</p><ul><li><p><span><span> 
</span></span>The server MUST locate a <a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_76a05049-3531-4abd-aec8-30e19954b4bd" data-linktype="relative-path">domain controller</a> in the
domain. The server SHOULD<a id="Appendix_A_Target_165"></a><a aria-label="Product behavior note 165" href="0c858a52-732a-43ec-85dd-e44b357c1898#Appendix_A_165" data-linktype="relative-path">&lt;165&gt;</a>
implement alternate means to locate DCs: for example, a static list in a file,
or the two methods detailed in <a href="../ms-adts/d2435927-0999-4c62-8c6d-13ba31a52e1a" data-linktype="relative-path">[MS-ADTS]</a>
section <a href="../ms-adts/3e9711af-9067-435e-93fb-09182053cef7" data-linktype="relative-path">6.3.6</a>.
If the server cannot locate a DC for the domain, then the server MUST return
ERROR_NO_SUCH_DOMAIN.</p>
</li><li><p><span><span> 
</span></span>The server then populates the <i>SiteName</i> parameter with the
NETLOGON_SAM_LOGON_RESPONSE_EX message ([MS-ADTS] section <a href="../ms-adts/8401a33f-34a8-40ca-bf03-c3484b66265f" data-linktype="relative-path">6.3.1.9</a>)
by setting the <i>SiteName</i> parameter to
NETLOGON_SAM_LOGON_RESPONSE_EX.ClientSiteName. The server stores the discovered
site name in <b>DynamicSiteName</b>.</p>
</li><li><p><span><span> 
</span></span>The server sets the DynamicSiteNameSetTime to the current time.</p>
</li></ul><p>Otherwise, <b>DynamicSiteName</b> MUST be returned
immediately as the <i>SiteName</i> parameter.</p><p>If it is determined that the server that receives this call
has no site name, the server MUST return ERROR_NO_SITENAME.</p><p>This method also returns errors based on Common Error
Processing Rules B and C, specified in section <a href="2d776bfc-e81f-4c8f-9da8-4c2920f65413" data-linktype="relative-path">3</a>.</p></div>