<div class="content" name="NetrLogonGetTrustRid" uuid="1d6fad9e-763d-495f-9bed-18c79304c3d7"><p>The <b>NetrLogonGetTrustRid</b> method SHOULD<a id="Appendix_A_Target_241"></a><a aria-label="Product behavior note 241" href="0c858a52-732a-43ec-85dd-e44b357c1898#Appendix_A_241" data-linktype="relative-path">&lt;241&gt;</a> be used to obtain the <span><a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_df3d0b61-56cd-4dac-9402-982f1fedc41c" data-linktype="relative-path">RID</a></span>
of the account whose password is used by <span><a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_76a05049-3531-4abd-aec8-30e19954b4bd" data-linktype="relative-path">domain controllers</a></span>
in the specified domain for establishing the <span><a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_08ce423c-9f9c-48ed-afa8-8b64c04ecdca" data-linktype="relative-path">secure channel</a></span> from
the server receiving this call. </p><dl>
<dd>
<div><pre> NET_API_STATUS NetrLogonGetTrustRid(
   [in, unique, string] LOGONSRV_HANDLE ServerName,
   [in,string,unique,range(0, 256)] wchar_t* DomainName,
   [out] ULONG * Rid
 );
</pre></div>
</dd></dl><p><b>ServerName: </b>The custom binding handle, as
defined in section <span><a href="3b224201-b531-43e2-8c79-b61f6dea8640" data-linktype="relative-path">3.5.4.1</a></span>. </p><p><b>DomainName: </b>The null-terminated Unicode string
that contains the <span><a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_604dcfcd-72f5-46e5-85c1-f3ce69956700" data-linktype="relative-path">DNS</a></span> or <span><a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_0334e0bd-2755-42f6-aeff-2d4a22bf4abf" data-linktype="relative-path">NetBIOS
name</a></span> of the primary or <span><a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_5ee032d0-d944-4acb-bbb5-b1cfc7df6db6" data-linktype="relative-path">trusted</a></span> domain. If
this parameter is NULL, this method uses the name of the <span><a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_387021de-3d6b-4372-835f-0d68c50cb496" data-linktype="relative-path">primary
domain</a></span> of the server.</p><p><b>Rid: </b>A pointer to an unsigned long that
receives the RID of the account.</p><p><b>Return Values: </b>The method returns 0x00000000
on success; otherwise, it returns a nonzero error code.</p><p>The server SHOULD<a id="Appendix_A_Target_242"></a><a aria-label="Product behavior note 242" href="0c858a52-732a-43ec-85dd-e44b357c1898#Appendix_A_242" data-linktype="relative-path">&lt;242&gt;</a> return
ERROR_ACCESS_DENIED if the caller is not local.</p><p>If <i>ServerName</i> equals NULL and <i>DomainName</i>
equals NULL, the server determines if the client has sufficient <span><a href="b5e7d25a-40b2-41c8-9611-98f53358af66#gt_d8092e10-b227-4b44-b015-511bb8178940" data-linktype="relative-path">privilege</a></span>
(as specified in section <span><a href="1ec94886-2b64-45af-b68e-3d9faa36617c" data-linktype="relative-path">3.5.4.2</a></span>) with the
Access Request mask set to NETLOGON_FTINFO_ACCESS.</p><p>Otherwise, the server determines if the client has
sufficient privilege (as specified in section 3.5.4.2) with the Access Request
mask set to NETLOGON_SERVICE_ACCESS.</p><p>If the client does not have sufficient privilege, the server
MUST return ERROR_ACCESS_DENIED.</p><p>If <i>ServerName</i> equals NULL, then the call MUST be made
to the local machine. If the <i>DomainName</i> is the same as the domain that
the machine is joined to, the call MUST succeed, and the server MUST return the
<b>AccountRid</b> of the machine in the domain. If the <i>DomainName</i> is a
different domain, the server MUST return ERROR_NO_SUCH_DOMAIN.</p><p>If both <i>ServerName</i> and <i>DomainName</i> are NULL, the
server MUST return the RID for the computer account of the caller. Otherwise,
the RID for the account identified by <i>ServerName</i> and <i>DomainName</i>
MUST be returned.</p><p>The server uses the server name passed in the <i>ServerName</i>
parameter to look up the domain for the request. If the name is not found, the
server MUST return ERROR_INVALID_COMPUTERNAME.</p><p>If the RID cannot be determined, the server SHOULD return
ERROR_TRUSTED_RELATIONSHIP_FAILURE.</p></div>