<div class="content"><p align="right"><a href="https://msdn.microsoft.com/en-us/library/0aee1c31-ec40-4633-bb56-0cf8429093c0" data-linktype="external">msdn link</a></p><p>The SamrOpenUser method obtains a handle to a user, given a <a href="7b2aeb27-92fc-41f6-8437-deb65d950921#gt_df3d0b61-56cd-4dac-9402-982f1fedc41c" data-linktype="relative-path">RID</a>.</p><dl>
<dd>
<div><pre> long SamrOpenUser(
   [in] SAMPR_HANDLE DomainHandle,
   [in] unsigned long DesiredAccess,
   [in] unsigned long UserId,
   [out] SAMPR_HANDLE* UserHandle
 );
</pre></div>
</dd></dl><p><b>DomainHandle: </b>An RPC context handle, as
specified in section <a href="8138c078-d881-4d1f-b378-94b4c34a287a" data-linktype="relative-path">2.2.7.2</a>,
representing a <a href="7b2aeb27-92fc-41f6-8437-deb65d950921#gt_2346e8d0-b0a0-481f-b644-85c45c60d4d1" data-linktype="relative-path">domain object</a>.</p><p><b>DesiredAccess: </b>An <a href="../ms-dtyp/7a53f60e-e730-4dfe-bbe9-b21b62eb790b" data-linktype="relative-path">ACCESS_MASK</a>
that indicates the requested access for the returned handle. See section <a href="c0be3f43-bcf9-43ee-b027-3d02ab372c53" data-linktype="relative-path">2.2.1.7</a> for a list of user
access values.</p><p><b>UserId: </b>A RID of a user account.</p><p><b>UserHandle: </b>An RPC context handle, as
specified in section 2.2.7.2.</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 <a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a>
section <a href="../ms-rpce/38ae9f5a-dac2-46ad-b2b7-9c43f211d9f6" data-linktype="relative-path">3</a>.</p><p>Upon receiving this message, the server MUST process the
data from the message according to the constraints in section <a href="fb25440b-269d-4220-99f2-8b29841cb1ce" data-linktype="relative-path">3.1.5.1.6</a>, with the
following values:</p><ul><li><p><span><span> 
</span></span>Target-Rid: <i>UserId</i></p>
</li><li><p><span><span> 
</span></span>Target-Object-Type: A <a href="7b2aeb27-92fc-41f6-8437-deb65d950921#gt_e767a471-c3fa-4e4b-a40c-daeb08f82a17" data-linktype="relative-path">user object</a> (that is, a
database with the objectClass user or derived from user).</p>
</li><li><p><span><span> 
</span></span>Generic-Access-Mask-Mapping-Table:</p>
<table><thead>
  <tr>
   <th>
   <p>Incoming bit</p>
   </th>
   <th>
   <p>Translated bits</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>GENERIC_READ</p>
  </td>
  <td>
  <p>USER_READ</p>
  </td>
 </tr><tr>
  <td>
  <p>GENERIC_WRITE</p>
  </td>
  <td>
  <p>USER_WRITE</p>
  </td>
 </tr><tr>
  <td>
  <p>GENERIC_EXECUTE</p>
  </td>
  <td>
  <p>USER_EXECUTE</p>
  </td>
 </tr><tr>
  <td>
  <p>GENERIC_ALL</p>
  </td>
  <td>
  <p>USER_ALL_ACCESS</p>
  </td>
 </tr></tbody></table>
</li><li><p><span><span> 
</span></span>Desired-Access-Mapping-Table:</p>
<table><thead>
  <tr>
   <th>
   <p>DesiredAccess</p>
   </th>
   <th>
   <p>Access mask</p>
   </th>
   <th>
   <p>Object ACE type</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>USER_READ_GENERAL</p>
  </td>
  <td>
  <p>ACTRL_DS_READ_PROP</p>
  </td>
  <td>
  <p>59ba2f42-79a2-11d0-9020-00c04fc2d3cf</p>
  </td>
 </tr><tr>
  <td>
  <p>USER_READ_PREFERENCES</p>
  </td>
  <td>
  <p>ACTRL_DS_READ_PROP</p>
  </td>
  <td>
  <p>59ba2f42-79a2-11d0-9020-00c04fc2d3cf</p>
  </td>
 </tr><tr>
  <td>
  <p>USER_READ_LOGON</p>
  </td>
  <td>
  <p>ACTRL_DS_READ_PROP</p>
  </td>
  <td>
  <p>5f202010-79a5-11d0-9020-00c04fc2d4cf</p>
  </td>
 </tr><tr>
  <td>
  <p>USER_READ_ACCOUNT</p>
  </td>
  <td>
  <p>ACTRL_DS_READ_PROP</p>
  </td>
  <td>
  <p>4c164200-20c0-11d0-a768-00aa006e0529</p>
  </td>
 </tr><tr>
  <td>
  <p>USER_WRITE_PREFERENCES</p>
  </td>
  <td>
  <p>ACTRL_DS_WRITE_PROP</p>
  </td>
  <td>
  <p>59ba2f42-79a2-11d0-9020-00c04fc2d3cf</p>
  </td>
 </tr><tr>
  <td>
  <p>USER_WRITE_ACCOUNT</p>
  </td>
  <td>
  <p>ACTRL_DS_WRITE_PROP</p>
  </td>
  <td>
  <p>59ba2f42-79a2-11d0-9020-00c04fc2d3cf</p>
  </td>
 </tr><tr>
  <td>
  <p>USER_WRITE_ACCOUNT</p>
  </td>
  <td>
  <p>ACTRL_DS_WRITE_PROP</p>
  </td>
  <td>
  <p>5f202010-79a5-11d0-9020-00c04fc2d4cf</p>
  </td>
 </tr><tr>
  <td>
  <p>USER_WRITE_ACCOUNT</p>
  </td>
  <td>
  <p>ACTRL_DS_WRITE_PROP</p>
  </td>
  <td>
  <p>4c164200-20c0-11d0-a768-00aa006e0529</p>
  </td>
 </tr><tr>
  <td>
  <p>USER_CHANGE_PASSWORD</p>
  </td>
  <td>
  <p>ACTRL_DS_CONTROL_ACCESS</p>
  </td>
  <td>
  <p>ab721a53-1e2f-11d0-9819-00aa0040529b</p>
  </td>
 </tr><tr>
  <td>
  <p>USER_FORCE_PASSWORD_CHANGE</p>
  </td>
  <td>
  <p>ACTRL_DS_CONTROL_ACCESS</p>
  </td>
  <td>
  <p>00299570-246d-11d0-a768-00aa006e0529</p>
  </td>
 </tr><tr>
  <td>
  <p>USER_LIST_GROUPS</p>
  </td>
  <td>
  <p>ACTRL_DS_READ_PROP</p>
  </td>
  <td>
  <p>bf967991-0de6-11d0-a285-00aa003049e2</p>
  </td>
 </tr><tr>
  <td>
  <p>USER_READ_GROUP_INFORMATION</p>
  </td>
  <td>
  <p>ACTRL_DS_READ_PROP</p>
  </td>
  <td>
  <p> </p>
  </td>
 </tr><tr>
  <td>
  <p>USER_WRITE_GROUP_INFORMATION</p>
  </td>
  <td>
  <p>ACTRL_DS_WRITE_PROP</p>
  </td>
  <td>
  <p> </p>
  </td>
 </tr><tr>
  <td>
  <p>ACCESS_SYSTEM_SECURITY</p>
  </td>
  <td>
  <p>ACCESS_SYSTEM_SECURITY</p>
  </td>
  <td>
  <p> </p>
  </td>
 </tr><tr>
  <td>
  <p>WRITE_OWNER</p>
  </td>
  <td>
  <p>WRITE_OWNER</p>
  </td>
  <td>
  <p> </p>
  </td>
 </tr><tr>
  <td>
  <p>WRITE_DAC</p>
  </td>
  <td>
  <p>WRITE_DAC</p>
  </td>
  <td>
  <p> </p>
  </td>
 </tr><tr>
  <td>
  <p>DELETE</p>
  </td>
  <td>
  <p>DELETE</p>
  </td>
  <td>
  <p> </p>
  </td>
 </tr></tbody></table>
</li><li><p><span><span> 
</span></span>Output-Handle: <i>UserHandle</i></p>
</li></ul></div>