<div class="content" name="FAX_ConnectionRefCount" uuid="a92941ac-bd07-4a71-af85-c2c157c97cf9"><p>The <b>FAX_ConnectionRefCount (Opnum 1)</b> method is called
by the client.<a id="Appendix_A_Target_73"></a><a aria-label="Product behavior note 73" href="056171e7-80bc-45ff-8107-66ba3abb2023#Appendix_A_73" data-linktype="relative-path">&lt;73&gt;</a></p><p>In response, the server MUST connect, disconnect, or release
a connection between the fax client and the fax server. </p><p>If this call is successfully made with a <i>Connect</i>
argument value of Connect (0x00000001), the client SHOULD retain the RPC
binding handle used for the <i>hBinding</i> argument and reuse it as the RPC
binding handle input argument for all subsequent fax server calls made, until
the connection with the server is disconnected.</p><dl>
<dd>
<div><pre> error_status_t FAX_ConnectionRefCount(
   [in] handle_t hBinding,
   [in, out] PRPC_FAX_SVC_HANDLE Handle,
   [in] DWORD Connect,
   [out] LPDWORD CanShare
 );
</pre></div>
</dd></dl><p><b>hBinding: </b>The <a href="46aba9c4-ebb1-4b10-86ac-4bb3025657b9#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a> binding handle that is
provided by the client RPC layer when the RPC call is made. If the <i>Connect</i>
parameter is set to Disconnect (0x00000000), the client SHOULD reuse the RPC
binding handle used for the <b>FAX_ConnectFaxServer</b> (section <a href="5cbfd38d-7a14-4560-ad24-9ed78f19a3bb" data-linktype="relative-path">3.1.4.1.10</a>) call or for
the previous call to this method used to connect to the fax server.</p><p><b>Handle: </b>The connection handle that references
a connection to the fax server. If <i>Connect</i> is set to 0x00000001
(Connect), a new handle is returned in this parameter. Otherwise, this
parameter MUST be set to a handle returned from a previous call to this method,
or to <b>FAX_ConnectFaxServer</b>.</p><p><b>Connect: </b>A <b>DWORD</b> (<a href="../ms-dtyp/cca27429-5689-4a16-b2b4-9325d93e4ba2" data-linktype="relative-path">[MS-DTYP]</a>
section <a href="../ms-dtyp/262627d8-3418-4627-9218-4ffe110850b2" data-linktype="relative-path">2.2.9</a>)
value that specifies connection information.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>Disconnect 0x00000000</td>
  <td>Close the fax server connection. The handle specified in Handle MUST have been returned by a previous call to FAX_ConnectFaxServer or FAX_ConnectionRefCount with a Connect value of 1 (Connect). After this call, the handle in Handle will be invalid and MUST NOT be used in any subsequent calls.</td>
 </tr><tr>
  <td>Connect 0x00000001</td>
  <td>Connect to the fax server. Calling FAX_ConnectionRefCount with this value is equivalent to calling FAX_ConnectFaxServer with an API version of FAX_API_VERSION_0.</td>
 </tr><tr>
  <td>Release 0x00000002</td>
  <td>Release a connection to the fax server. The handle specified in Handle MUST have been returned by a previous call to FAX_ConnectFaxServer or FAX_ConnectionRefCount with a Connect value of 1 (Connect). After this call, the handle in Handle MUST NOT be used in any subsequent calls except a call to FAX_ConnectionRefCount with a Connect value of 0 (Disconnect).</td>
 </tr></tbody></table>
</dd>
<dd>
<p>If <b>FAX_ConnectionRefCount</b> is called in a
sequence, and varying values are given for this parameter on the same <i>Handle</i>,
the following holds true:</p>
</dd></dl><ol><li><p><span>   
</span>The call sequence SHOULD have values for the <i>Connect</i> argument in
the following order:</p>
<ol><li><p><span>    </span>1 (Connect): To
obtain a valid <i>Handle</i> and connect to the fax server. (This call is
optional and can be replaced by a <b>FAX_ConnectFaxServer</b> call.</p>
</li><li><p><span>    </span>2 (Release):
Step &#34;1 (Connect)&#34; is mandatory for this call to succeed.</p>
</li><li><p><span>    </span>0 (Disconnect):
Step &#34;1 (Connect)&#34; is mandatory for this call to succeed.</p>
</li></ol></li><li><p><span>   
</span>The following sequence of calls on the same handle MUST result in an
ERROR_INVALID_PARAMETER error:</p>
<ol><li><p><span>    </span>Consecutive
calls with a <i>Connect</i> argument value of 2 (Release) or 0 (Disconnect) without
obtaining a valid Handle in between two calls (through step &#34;1
(Connect)&#34; above).</p>
</li><li><p><span>    </span>A call with a <i>Connect</i>
argument value of 0 (Disconnect) following a call with a <i>Connect</i>
argument value of 2 (Release).</p>
</li></ol></li></ol><p><b>CanShare: </b>The server MUST return a nonzero
value in the <b>DWORD</b> referenced by this parameter if the fax <a href="46aba9c4-ebb1-4b10-86ac-4bb3025657b9#gt_569f1f1c-f426-46fa-91d2-3d1eb0b19aa1" data-linktype="relative-path">print queues</a> can be shared
as described in section <a href="bd422bcf-7ce8-4576-addb-89345ea84f9f" data-linktype="relative-path">3.1.1</a>,
and a zero value otherwise.<a id="Appendix_A_Target_74"></a><a aria-label="Product behavior note 74" href="056171e7-80bc-45ff-8107-66ba3abb2023#Appendix_A_74" data-linktype="relative-path">&lt;74&gt;</a></p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Possible value</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0x00000000</td>
  <td>The fax print queues can be shared.</td>
 </tr><tr>
  <td>0x00000001 — 0xFFFFFFFF</td>
  <td>The fax print queues cannot be shared.</td>
 </tr></tbody></table>
</dd></dl><p><b>Return Values: </b>This method MUST return
0x00000000 (ERROR_SUCCESS) for success; otherwise, it MUST return one of the
following error codes, one of the fax-specific errors that are defined in
section <a href="cbe6c4fb-4dda-4f6c-9701-0d490ba0d105" data-linktype="relative-path">2.2.52</a>, or one
of the other standard errors defined in <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>
section <a href="../ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d" data-linktype="relative-path">2.2</a>.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>ERROR_ACCESS_DENIED 0x00000005</td>
  <td>Access is denied. The Connect parameter is set to a value of 0x00000001 (Connect), and the client&#39;s fax user account does not have the ALL_FAX_USER_ACCESS_RIGHTS access rights required for the connect operation.</td>
 </tr><tr>
  <td>ERROR_INVALID_PARAMETER 0x00000057</td>
  <td>The parameter is incorrect. This error code is returned if any of the following conditions are met: § The Connect parameter is set to a value of 0x00000000 (Disconnect) or to a value of 0x00000002 (Release), and the Handle parameter is set to a NULL value.&lt;75&gt; § The Connect parameter is set to a value of 0x00000001 (Connect), and the CanShare parameter is set to a NULL pointer value.&lt;76&gt; § The Connect parameter is set to a value other than 0x00000000 (Disconnect), 0x00000001 (Connect), or 0x00000002 (Release).</td>
 </tr></tbody></table>
</dd></dl><p>Fax clients call this method to connect or disconnect from
the fax server.</p><p><b>Exceptions Thrown: </b>No exceptions are thrown
except those that are thrown by the underlying RPC protocol, <a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a>.</p></div>