<div class="content" name="DsrGetSiteName" uuid="2b0173e2-8c45-4fde-8967-ad1cbbc7e593"><p>The <b>DsrGetSiteName</b> method SHOULD<a id="Appendix_A_Target_168"></a><a aria-label="Product behavior note 168" href="0c858a52-732a-43ec-85dd-e44b357c1898#Appendix_A_168" data-linktype="relative-path">&lt;168&gt;</a> return the <span><a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_8abdc986-5679-42d9-ad76-b11eb5a0daba" data-linktype="relative-path">site</a></span>
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 <span><a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_44deb72d-c62b-4335-90e4-b9fd4dd782ed" data-linktype="relative-path">binding
handle</a></span> (defined in section <span><a href="3b224201-b531-43e2-8c79-b61f6dea8640" data-linktype="relative-path">3.5.4.1</a></span>).</p><p><b>SiteName: </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 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>0x0000077F ERROR_NO_SITENAME</td>
  <td>No site name is available for this machine.</td>
 </tr></tbody></table><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_169"></a><a aria-label="Product behavior note 169" href="0c858a52-732a-43ec-85dd-e44b357c1898#Appendix_A_169" data-linktype="relative-path">&lt;169&gt;</a> If the
client does not have sufficient privileges the server MUST return ERROR_ACCESS_DENIED.</p><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 <span><a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_76a05049-3531-4abd-aec8-30e19954b4bd" data-linktype="relative-path">domain controller</a></span> in
the domain. The server SHOULD<a id="Appendix_A_Target_170"></a><a aria-label="Product behavior note 170" href="0c858a52-732a-43ec-85dd-e44b357c1898#Appendix_A_170" data-linktype="relative-path">&lt;170&gt;</a>
implement alternate means to locate DCs: for example, a static list in a file,
or the 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>.
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 <span><a href="../ms-adts/8401a33f-34a8-40ca-bf03-c3484b66265f" data-linktype="relative-path">6.3.1.9</a></span>)
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 <span><a href="2d776bfc-e81f-4c8f-9da8-4c2920f65413" data-linktype="relative-path">3</a></span>.</p></div>