<div class="content" name="SamrLookupNamesInDomain" uuid="d91271c6-7b2e-4194-9927-8fabfa429f90"><p>The SamrLookupNamesInDomain method translates a set of
account names into a set of <span><a href="7b2aeb27-92fc-41f6-8437-deb65d950921#gt_df3d0b61-56cd-4dac-9402-982f1fedc41c" data-linktype="relative-path">RIDs</a></span>.</p><dl>
<dd>
<div><pre> long SamrLookupNamesInDomain(
   [in] SAMPR_HANDLE DomainHandle,
   [in, range(0,1000)] unsigned long Count,
   [in, size_is(1000), length_is(Count)] 
     RPC_UNICODE_STRING Names[*],
   [out] PSAMPR_ULONG_ARRAY RelativeIds,
   [out] PSAMPR_ULONG_ARRAY Use
 );
</pre></div>
</dd></dl><p><b>DomainHandle: </b>An RPC context handle, as
specified in section <span><a href="8138c078-d881-4d1f-b378-94b4c34a287a" data-linktype="relative-path">2.2.7.2</a></span>,
representing a <span><a href="7b2aeb27-92fc-41f6-8437-deb65d950921#gt_2346e8d0-b0a0-481f-b644-85c45c60d4d1" data-linktype="relative-path">domain object</a></span>.</p><p><b>Count: </b>The number of elements in <i>Names</i>.
The maximum value of 1,000 is chosen to limit the amount of memory that the
client can force the server to allocate.</p><p><b>Names: </b>An array of strings that are to be
mapped to RIDs.</p><p><b>RelativeIds: </b>An array of RIDs of <span><a href="7b2aeb27-92fc-41f6-8437-deb65d950921#gt_8d10bd9d-392e-431b-8218-742bdac19815" data-linktype="relative-path">accounts</a></span>
that correspond to the elements in <i>Names</i>.</p><p><b>Use: </b>An array of SID_NAME_USE enumeration
values that describe the type of account for each entry in <i>RelativeIds</i>.</p><p>This protocol asks the RPC runtime, via the <b>strict_context_handle</b>
attribute, to reject the use of context handles created by a method of a
different RPC interface than this one, as specified in <span><a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a></span>
section <span><a href="../ms-rpce/38ae9f5a-dac2-46ad-b2b7-9c43f211d9f6" data-linktype="relative-path">3</a></span>.</p><p>On receiving this message, the server MUST process the data
from the message subject to the following constraints:</p><ol><li><p><span>    </span>The server MUST
return an error if <i>DomainHandle.HandleType</i> is not equal to
&#34;Domain&#34;.</p>
</li><li><p><span>    </span><i>DomainHandle.GrantedAccess</i>
MUST have the required access specified in section <span><a href="87bacbd0-7b8b-429f-abc6-4b3d895d4e90" data-linktype="relative-path">3.1.2.2</a></span>. Otherwise,
the server MUST return STATUS_ACCESS_DENIED.</p>
</li><li><p><span>    </span>Let U be the set
of all <span><a href="7b2aeb27-92fc-41f6-8437-deb65d950921#gt_60122e64-9d34-40ee-a387-782eaf7adf2f" data-linktype="relative-path">database objects</a></span>
whose <b>objectSid</b>&#39;s <span><a href="7b2aeb27-92fc-41f6-8437-deb65d950921#gt_9066e9dc-8275-4452-9073-daab5fd427c5" data-linktype="relative-path">domain prefix</a></span>
matches the domain prefix of the <span><a href="7b2aeb27-92fc-41f6-8437-deb65d950921#gt_b0276eb2-4e65-4cf1-a718-e0920a614aca" data-linktype="relative-path">domain</a></span> referenced by
<i>DomainHandle.Object</i>.</p>
</li><li><p><span>    </span>For each element
in <i>Names</i> that matches a database object&#39;s <b>sAMAccountName</b>
attribute value in the set U, the server MUST fill in <i>RelativeIds</i> and <i>Use</i>
as follows:</p>
<ol><li><p><span>   
</span>Let &#39;i&#39; be the current element of <i>Names</i>.</p>
</li><li><p><span>   
</span><b>RelativeIds.Element[i]</b> is the RID of the matched object&#39;s <b>objectSid</b>
attribute value.</p>
</li><li><p><span>   
</span><b>Use.Element[i]</b> is set as follows.</p>
<table><thead>
  <tr>
   <th>
   <p>objectClass</p>
   </th>
   <th>
   <p>GroupType</p>
   </th>
   <th>
   <p>Use</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>User</p>
  </td>
  <td>
  <p>n/a</p>
  </td>
  <td>
  <p>SidTypeUser</p>
  </td>
 </tr><tr>
  <td>
  <p>Group</p>
  </td>
  <td>
  <p>GROUP_TYPE_ACCOUNT_GROUP</p>
  </td>
  <td>
  <p>SidTypeGroup</p>
  </td>
 </tr><tr>
  <td>
  <p>Group</p>
  </td>
  <td>
  <p>GROUP_TYPE_UNIVERSAL_GROUP</p>
  </td>
  <td>
  <p>SidTypeGroup</p>
  </td>
 </tr><tr>
  <td>
  <p>Group</p>
  </td>
  <td>
  <p>Any value not matching the above criteria for Group</p>
  </td>
  <td>
  <p>SidTypeAlias</p>
  </td>
 </tr></tbody></table>
</li></ol></li><li><p><span>    </span>For each element
in <i>Names</i> that does not match a database object&#39;s <b>sAMAccountName</b>
attribute value in the set U, the server MUST fill in <i>RelativeIds</i> and <i>Use</i>
as follows:</p>
<ol><li><p><span>   
</span>Let &#39;i&#39; be the current element of <i>Names</i>.</p>
</li><li><p><span>   
</span>RelativeIds.Element[i] is 0.</p>
</li><li><p><span>   
</span><b>Use.Element[i]</b> is SidTypeUnknown.</p>
</li></ol></li><li><p><span>    </span>Otherwise:</p>
<ol><li><p><span>   
</span><b>RelativeIds.Count</b> MUST be set to the input parameter <i>Count</i>
on successful completion of the method.</p>
</li><li><p><span>   
</span><b>Use.Count</b> MUST be set to the input parameter <i>Count</i> on
successful completion of the method.</p>
</li><li><p><span>   
</span>If the number of matched accounts is equal to the input parameter <i>Count</i>,
STATUS_SUCCESS MUST be returned.</p>
</li><li><p><span>   
</span>If the number of matched accounts is less than the input parameter <i>Count</i>
but greater than 0, STATUS_SOME_NOT_MAPPED MUST be returned. Note that this is
not an error condition.</p>
</li><li><p><span>   
</span>If the number of matched accounts is 0, STATUS_NONE_MAPPED MUST be
returned.</p>
</li></ol></li></ol></div>