<div class="content"><p align="right"><a href="https://msdn.microsoft.com/en-us/library/373a4b1e-1e8d-4572-9c25-0bd7b045d3a3" data-linktype="external">msdn link</a></p><p>The LsarCreateTrustedDomain method is invoked to create an
object of type <a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_f2f00d47-6cf2-4b32-b8f7-b63e38e2e9c4" data-linktype="relative-path">trusted
domain</a> in the server&#39;s database.</p><dl>
<dd>
<div><pre> NTSTATUS LsarCreateTrustedDomain(
   [in] LSAPR_HANDLE PolicyHandle,
   [in] PLSAPR_TRUST_INFORMATION TrustedDomainInformation,
   [in] ACCESS_MASK DesiredAccess,
   [out] LSAPR_HANDLE* TrustedDomainHandle
 );
</pre></div>
</dd></dl><p><b>PolicyHandle: </b>An <a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a> context handle obtained
from either <a href="2a482ccf-1f89-4693-8594-855ff738ae8a" data-linktype="relative-path">LsarOpenPolicy</a>
or <a href="9456a963-7c21-4710-af77-d0a2f5a72d6b" data-linktype="relative-path">LsarOpenPolicy2</a>.</p><p><b>TrustedDomainInformation: </b>Information about
the new <a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_f2ceef4e-999b-4276-84cd-2e2829de5fc4" data-linktype="relative-path">trusted domain
object (TDO)</a> to be created.</p><p><b>DesiredAccess: </b>An access mask that specifies
the desired access to the TDO handle.</p><p><b>TrustedDomainHandle: </b>Used to return the handle
for the newly created TDO.</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>
  <p>0x00000000</p>
  <p>STATUS_SUCCESS</p>
  </td>
  <td>
  <p>The request was successfully completed.</p>
  </td>
 </tr><tr>
  <td>
  <p>0xC0000022</p>
  <p>STATUS_ACCESS_DENIED</p>
  </td>
  <td>
  <p>The caller does not have the permissions to perform
  this operation.</p>
  </td>
 </tr><tr>
  <td>
  <p>0xC000000D</p>
  <p>STATUS_INVALID_PARAMETER</p>
  </td>
  <td>
  <p>One of the supplied arguments is invalid.</p>
  </td>
 </tr><tr>
  <td>
  <p>0xC0000300</p>
  <p>STATUS_NOT_SUPPORTED_ON_SBS</p>
  </td>
  <td>
  <p>The operation is not supported on a particular
  product.<a id="Appendix_A_Target_101"></a><a aria-label="Product behavior note 101" href="2a769a08-e023-459f-aebe-4fb3f595c0b7#Appendix_A_101" data-linktype="relative-path">&lt;101&gt;</a></p>
  </td>
 </tr><tr>
  <td>
  <p>0xC00002B1</p>
  <p>STATUS_DIRECTORY_SERVICE_REQUIRED</p>
  </td>
  <td>
  <p>The <a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_e467d927-17bf-49c9-98d1-96ddf61ddd90" data-linktype="relative-path">Active
  Directory</a> <a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_2dc07ca2-2b40-437e-a5ec-ed28ebfb116a" data-linktype="relative-path">service</a>
  was not available on the server.</p>
  </td>
 </tr><tr>
  <td>
  <p>0xC0000078</p>
  <p>STATUS_INVALID_SID</p>
  </td>
  <td>
  <p>The <a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_83f2020d-0804-4840-a5ac-e06439d50f8d" data-linktype="relative-path">security
  identifier</a> of the trusted domain is not valid.</p>
  </td>
 </tr><tr>
  <td>
  <p>0xC00002E9</p>
  <p>STATUS_CURRENT_DOMAIN_NOT_ALLOWED</p>
  </td>
  <td>
  <p><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_5ee032d0-d944-4acb-bbb5-b1cfc7df6db6" data-linktype="relative-path">Trust</a>
  cannot be established with the current <a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_b0276eb2-4e65-4cf1-a718-e0920a614aca" data-linktype="relative-path">domain</a>.</p>
  </td>
 </tr><tr>
  <td>
  <p>0xC0000035</p>
  <p>STATUS_OBJECT_NAME_COLLISION</p>
  </td>
  <td>
  <p>Another TDO already exists that matches some of the
  identifying information of the supplied information.</p>
  </td>
 </tr><tr>
  <td>
  <p>0xC0000008</p>
  <p>STATUS_INVALID_HANDLE</p>
  </td>
  <td>
  <p><i>PolicyHandle</i> is not a valid handle.</p>
  </td>
 </tr><tr>
  <td>
  <p>0xC0000401</p>
  <p>STATUS_PER_USER_TRUST_QUOTA_EXCEEDED</p>
  </td>
  <td>
  <p>The caller&#39;s quota for the maximum number of TDOs that
  can be created by control access right Create-Inbound-Trust is exceeded.</p>
  </td>
 </tr><tr>
  <td>
  <p>0xC0000402</p>
  <p>STATUS_ALL_USER_TRUST_QUOTA_EXCEEDED</p>
  </td>
  <td>
  <p>The combined users&#39; quota for the maximum number of
  TDOs that can be created by control access right Create-Inbound-Trust is
  exceeded.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p>Processing:</p><p>This message MUST be processed in an identical manner to <a href="6817095d-d341-4d03-93d7-e9bdca2d3eef" data-linktype="relative-path">LsarCreateTrustedDomainEx</a>
with the following mapping as input parameters.</p><p><i>PolicyHandle</i>: Same.</p><p><i>TrustedDomainInformation</i>:</p><ul><li><p><span><span> 
</span></span><b>Name:</b> Comes from <i>TrustedDomainInformation</i>. Name
input parameter.</p>
</li><li><p><span><span> 
</span></span><b>FlatName:</b> Comes from <i>TrustedDomainInformation</i>. Name
input parameter.</p>
</li><li><p><span><span> 
</span></span><b>SID:</b> Comes from <i>TrustedDomainInformation</i>. Security
identifier (SID) input parameter.</p>
</li><li><p><span><span> 
</span></span><b>TrustDirection:</b> TRUST_DIRECTION_OUTBOUND.</p>
</li><li><p><span><span> 
</span></span><b>TrustType:</b> TRUST_TYPE_DOWNLEVEL.</p>
</li><li><p><span><span> 
</span></span><b>TrustAttributes:</b> 0.</p>
</li></ul><p><i>AuthenticationInformation</i>: NULL.</p><p><i>DesiredAccess</i>: Same.</p><p><i>TrustedDomainHandle</i>: Same.</p></div>