<div class="content" name="LsarSetForestTrustInformation" uuid="16be42bc-e85c-4135-b183-aacb88106306"><p>The LsarSetForestTrustInformation method is invoked to
establish a <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_5ee032d0-d944-4acb-bbb5-b1cfc7df6db6" data-linktype="relative-path">trust</a></span> relationship
with another <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_fd104241-4fb3-457c-b2c4-e0c18bb20b62" data-linktype="relative-path">forest</a></span> by attaching
a set of records called the <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_8c0b82d9-efec-4723-95a9-8564edf9ba44" data-linktype="relative-path">forest trust information</a></span>
to the <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_f2ceef4e-999b-4276-84cd-2e2829de5fc4" data-linktype="relative-path">trusted domain object</a></span>.</p><dl>
<dd>
<div><pre> NTSTATUS LsarSetForestTrustInformation(
   [in] LSAPR_HANDLE PolicyHandle,
   [in] PLSA_UNICODE_STRING TrustedDomainName,
   [in] LSA_FOREST_TRUST_RECORD_TYPE HighestRecordType,
   [in] PLSA_FOREST_TRUST_INFORMATION ForestTrustInfo,
   [in] unsigned char CheckOnly,
   [out] PLSA_FOREST_TRUST_COLLISION_INFORMATION* CollisionInfo
 );
</pre></div>
</dd></dl><p><b>PolicyHandle: </b>An <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a></span> context handle
obtained from either <span><a href="2a482ccf-1f89-4693-8594-855ff738ae8a" data-linktype="relative-path">LsarOpenPolicy</a></span> or <span><a href="9456a963-7c21-4710-af77-d0a2f5a72d6b" data-linktype="relative-path">LsarOpenPolicy2</a></span>.</p><p><b>TrustedDomainName: </b>The name of the trusted
domain object on which to set the forest trust information.</p><p><b>HighestRecordType: </b>The highest ordinal <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_035d9ce5-f117-4251-8d4d-127c462ec4a0" data-linktype="relative-path">forest
trust</a></span> record type that the caller understands.</p><p><b>ForestTrustInfo: </b>The forest trust information
that the caller is trying to set on the trusted domain object.</p><p><b>CheckOnly: </b>If not 0, the operation is
read-only and does not alter the state of the server&#39;s database.</p><p><b>CollisionInfo: </b>Used to return information
about collisions between different sets of forest trust information in the
server&#39;s database.</p><p><b>Return Values: </b>The following is a summary of
the return values that an implementation MUST return, as specified by the
message processing that follows.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0x00000000 STATUS_SUCCESS</td>
  <td>The request was successfully completed.</td>
 </tr><tr>
  <td>0xC0000022 STATUS_ACCESS_DENIED</td>
  <td>The caller does not have the permissions to perform this operation.</td>
 </tr><tr>
  <td>0xC00000DD STATUS_INVALID_DOMAIN_STATE</td>
  <td>The domain is not the root domain of the forest, or the forest is not at DS_BEHAVIOR_WIN2003 forest functional level.</td>
 </tr><tr>
  <td>0xC00000DE STATUS_INVALID_DOMAIN_ROLE</td>
  <td>The server is not the primary domain controller.</td>
 </tr><tr>
  <td>0xC00000DF STATUS_NO_SUCH_DOMAIN</td>
  <td>The trusted domain object with the name in the TrustedDomainName parameter does not exist.</td>
 </tr><tr>
  <td>0xC0000008 STATUS_INVALID_HANDLE</td>
  <td>PolicyHandle is not a valid handle.</td>
 </tr><tr>
  <td>0xC000000D STATUS_INVALID_PARAMETER</td>
  <td>Some of the parameters supplied were invalid.</td>
 </tr></tbody></table>
</dd></dl><p>Processing instructions:</p><p>This message takes six arguments:</p><p><i>PolicyHandle</i>: Open handle to the policy object. If
the handle is not a valid context handle to the policy object or <i>PolicyHandle</i>.HandleType
does not equal &#34;Policy&#34;, the server MUST return
STATUS_INVALID_HANDLE. <i>PolicyHandle</i>.GrantedAccess MUST NOT be considered
for this call because the access check MUST happen on the trusted domain
object.</p><p><i>TrustedDomainName</i>: The name of the trusted domain
object to set forest trust information on.</p><p>The server MUST return STATUS_INVALID_DOMAIN_STATE if any of
the following conditions is TRUE.</p><ul><li><p><span><span> 
</span></span>The <b>DnsForestName</b> and <b>DnsDomainName</b> fields in DNS
Domain Information (see section <span><a href="c939c70e-8cf0-4d90-a9cc-1c5002951723" data-linktype="relative-path">3.1.1.1</a></span>) do not
contain the same value.</p>
</li><li><p><span><span> 
</span></span><span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_e467d927-17bf-49c9-98d1-96ddf61ddd90" data-linktype="relative-path">Active Directory</a></span> is
not running on this machine.</p>
</li></ul><p>The server MUST return STATUS_INVALID_DOMAIN_ROLE if the
IsEffectiveRoleOwner function specified 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/111c589d-284a-427a-91e9-9031a3767597" data-linktype="relative-path">3.1.1.5.1.8</a></span>
returns FALSE with the roleObject parameter set to default NC.</p><p>If a trusted domain object by the name <i>TrustedDomainName</i>
does not exist, the server MUST return STATUS_NO_SUCH_DOMAIN.</p><p>The server MUST verify that the caller has access to the
trusted domain object as specified in section <span><a href="e5e1e32e-4066-435d-b669-044fe997eaf7" data-linktype="relative-path">3.1.4.2.1</a></span> with <i>DesiredAccess</i>
set to TRUSTED_SET_AUTH. There is no method-specific portion of this check.</p><p>The server MUST also make sure that the <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_0b8230da-0fd8-492c-b84a-d8467c3dc1ef" data-linktype="relative-path">trust
attributes</a></span> associated with the trusted domain object referenced by
the <i>TrustedDomainName</i> parameter has the
TRUST_ATTRIBUTE_FOREST_TRANSITIVE set. If the attribute is not present, the
server MUST return STATUS_INVALID_PARAMETER.</p><p><i>HighestRecordType</i>: The caller sets this argument to
the highest <span><a href="700a91e8-a1a4-4e1b-9ad6-096b3cf0bef0" data-linktype="relative-path">LSA_FOREST_TRUST_RECORD_TYPE</a></span>
enumeration value recognized by the caller. If this argument is greater in
value than the highest record type recognized by the server, the server MUST
return STATUS_INVALID_PARAMETER.</p><p><i>ForestTrustInfo</i>: A collection of forest trust records
identifying the topology of the <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_3b76a71f-9697-4836-9c69-09899b23c21b" data-linktype="relative-path">trusted forest</a></span>. The
server MUST verify that the forest trust information supplied by the caller is
valid by performing a consistency check, as specified in [MS-ADTS] section <span><a href="../ms-adts/fe369d31-cc17-4ad7-849e-769403bc2c41" data-linktype="relative-path">6.1.6</a></span>.
Note that &#34;consistent&#34; does not necessarily mean
&#34;collision-free&#34;. The method for determining collisions is specified
in section <span><a href="f0e0eefd-e53c-463b-b816-86fb21931366" data-linktype="relative-path">3.1.4.7.16.1</a></span>. </p><p>Records supplied by the caller in the Data field (section <span><a href="08cf1a65-ef7c-46d3-aa4d-558f5135df3d" data-linktype="relative-path">2.2.7.21</a></span>),
using the opaque LSA_FOREST_TRUST_BINARY_DATA structure (section <span><a href="d4859b44-b776-4237-baa1-12dc28c19634" data-linktype="relative-path">2.2.7.23</a></span>),
MUST be parsed using the SubRecordType field. If SubRecordType ([MS-ADTS]
section <span><a href="../ms-adts/96e44639-eb3e-48c3-a565-1d67cceb3bad" data-linktype="relative-path">6.1.6.9.3</a></span>)
is a known record type, the record MUST be validated\persisted as that record
type (section <span><a href="0228f75e-9725-479c-b4cd-1cacd667343c" data-linktype="relative-path">3.1.1.5</a></span>). </p><p>ForestTrustScannerInfo (section <span><a href="ee2806eb-20d1-4089-97f2-db7384ea4933" data-linktype="relative-path">2.2.7.31</a></span>) records
MUST contain DnsName and NetbiosName data, but are not otherwise validated.
Note that collision name checking is not done on ForestTrustScannerInfo
records.</p><p><i>CheckOnly</i>: Perform a read-only probing operation. The
results will not be persisted in the Local Security Authority (Domain Policy)
database, but the set of collision records returned in <i>CollisionInfo</i>
will be accurate as though the information was persisted.</p><p><i>CollisionInfo</i>: A list of collision records. The
request is considered successful even if a non-empty set of collisions is
returned. The rules for generating collision information are specified in
section 3.1.4.7.16.1.</p><p>The server MUST store the generated <i>ForestTrustInfo</i>
in the Forest Trust Information attribute specified in section 3.1.1.5.</p></div>