<div class="content"><p align="right"><a href="https://msdn.microsoft.com/en-us/library/6595931d-2fe5-4097-9270-f6bada5d9242" data-linktype="external">msdn link</a></p><p>(Protocol Version 3) The ApiOpenResourceEx method SHOULD<a id="Appendix_A_Target_99"></a><a aria-label="Product behavior note 99" href="1d58eff8-a042-478c-972c-8e9c76a3f978#Appendix_A_99" data-linktype="relative-path">&lt;99&gt;</a> establish context on the <a href="694e5e7a-5833-4f3d-b47e-323ee1d452c2#gt_434b0234-e970-4e8c-bdfa-e16a30d96703" data-linktype="relative-path">server</a> about the interaction
of a client with the specified cluster resource by using the current <a href="694e5e7a-5833-4f3d-b47e-323ee1d452c2#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a> connection.
ApiOpenResourceEx returns a context handle so that the client can refer to the <a href="694e5e7a-5833-4f3d-b47e-323ee1d452c2#gt_94e97f15-2f1a-406f-a740-607bb97761ec" data-linktype="relative-path">resource</a> in subsequent
method calls.</p><p>The server MUST determine the level of access to be granted
to the client (section <a href="a249a463-3d3b-4058-abf6-3024d81806a0" data-linktype="relative-path">3.1.4</a>).
Upon success, the server MUST associate that level of access with the resource
context it has established.</p><p>The client has several ways to determine the resource name
to specify for the <i>lpszResourceName</i> parameter. A resource can have a
well-known name if it was configured as such by using implementation-specific
methods between servers. Or, a client can use <a href="3901b3f0-1737-481f-9815-282471183abd" data-linktype="relative-path">ApiCreateEnum</a> with
enumeration type CLUSTER_ENUM_RESOURCE, as specified in section 3.1.4.2.8. This
method obtains a list of all resource names in the <a href="694e5e7a-5833-4f3d-b47e-323ee1d452c2#gt_93ba0f62-7125-4a3e-ab60-5fd4f504bc8c" data-linktype="relative-path">cluster state</a>. The client
can then examine names or open resources to call additional methods to
determine on which resources to operate.</p><p>The server SHOULD accept an ApiOpenResourceEx request if its
<a href="694e5e7a-5833-4f3d-b47e-323ee1d452c2#gt_a93e2fea-3006-4a06-b48f-fdb36d9abac9" data-linktype="relative-path">protocol server state</a> is
read-only, and MUST accept the processing request if it is in the read/write
state, as specified in section <a href="756547e7-ca64-4b7c-9f1b-2b1fbc6153d3" data-linktype="relative-path">3.1.1</a>.</p><dl>
<dd>
<div><pre> HRES_RPC ApiOpenResourceEx(
   [in, string] LPCWSTR lpszResourceName,
   [in] DWORD dwDesiredAccess,
   [out] DWORD * lpdwGrantedAccess,
   [out] error_status_t *Status,
   [out] error_status_t *rpc_status
 );
</pre></div>
</dd></dl><p><b>lpszResourceName: </b>A <a href="694e5e7a-5833-4f3d-b47e-323ee1d452c2#gt_b069acb4-e364-453e-ac83-42d469bb339e" data-linktype="relative-path">Unicode string</a> that
contains the name of the resource for which to establish context on the server.
For version 3.0, the server MUST also accept the resource unique ID as returned
by the <a href="832368a8-f72f-43dc-a172-00eb0f10d387" data-linktype="relative-path">ApiGetResourceId</a>
method.</p><p><b>dwDesiredAccess: </b>The value for this parameter
is the same as specified for <i>dwDesiredAccess</i> in <a href="00ce494d-0c74-44fd-8276-c73665cf616b" data-linktype="relative-path">ApiOpenClusterEx</a>.</p><p><b>lpdwGrantedAccess: </b>The value for this
parameter is the same as specified for <i>lpdwGrantedAccess</i> in
ApiOpenClusterEx.</p><p><b>Status: </b>Indicates the status of this
operation. The server MUST set <i>Status</i> to the following error codes for
the specified conditions.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>ERROR_SUCCESS</p>
  <p>0x0000000</p>
  </td>
  <td>
  <p>Success.</p>
  </td>
 </tr><tr>
  <td>
  <p>ERROR_ACCESS_DENIED</p>
  <p>0x00000005</p>
  </td>
  <td>
  <p><i>dwDesiredAccess</i> indicates a level of access
  exceeding what the client is entitled to (section 3.1.4).</p>
  </td>
 </tr><tr>
  <td>
  <p>ERROR_INVALID_PARAMETER</p>
  <p>0x00000057</p>
  </td>
  <td>
  <p><i>dwDesiredAccess</i> is invalid, as specified
  earlier in this section.</p>
  </td>
 </tr><tr>
  <td>
  <p>RPC_S_PROCNUM_OUT_OF_RANGE</p>
  <p>0x000006D1</p>
  </td>
  <td>
  <p>The server does not support this method.</p>
  </td>
 </tr><tr>
  <td>
  <p>ERROR_RESOURCE_NOT_FOUND</p>
  <p>0x0000138f</p>
  </td>
  <td>
  <p>A resource that matches name <i>lpszResourceName</i>
  was not found in the <a href="694e5e7a-5833-4f3d-b47e-323ee1d452c2#gt_feef37b3-c173-4f51-aab6-b55a6366259b" data-linktype="relative-path">cluster</a>
  configuration.</p>
  </td>
 </tr></tbody></table>
</dd>
<dd>
<p>For any other condition, the server sets <i>Status</i>
to a value that is not one of the values listed in the preceding table. The
client MUST treat all values that are not listed in the preceding table the
same, except as specified in section <a href="ca75805a-4b39-4074-8b5b-dbaae6e81b1f" data-linktype="relative-path">3.2.4.6</a>.</p>
</dd></dl><p><b>rpc_status: </b>A 32-bit integer used to indicate
success or failure. The RPC runtime MUST indicate, by writing to this parameter,
whether it succeeded in executing this method on the server. The encoding of
the value passed in this parameter MUST conform to encoding for comm_status and
fault_status, as specified in Appendix E of <a href="https://go.microsoft.com/fwlink/?LinkId=89824" data-linktype="external">[C706]</a>.</p><p><b>Return Values: </b>The method MUST return a valid <a href="5a619b4b-0af5-4c7a-b37b-ae2d50755abd" data-linktype="relative-path">HRES_RPC</a> (section 2.2.1.4)
context handle to indicate success; otherwise, it MUST return NULL.</p></div>