<div class="content"><p> </p><p>The <b>FAX_OpenPort (Opnum 2)</b> method is called by the
client. In response, the server opens a fax port for subsequent use in other
fax methods, and it returns a fax port handle for use by the fax client
application.</p><p>In response, the server MUST validate whether the client&#39;s
fax user account has access to open the specified fax port. The server MUST
validate that the DeviceId argument that is passed by the client is for a valid
device. If the Flags argument specifies PORT_OPEN_MODIFY, the server MUST also
confirm that the specified port has not yet been opened for modification, and
if the port is already opened for modification, the server MUST fail the
request by returning ERROR_INVALID_HANDLE. To indicate success, the server MUST
return a new port handle to the client.</p><dl>
<dd>
<div><pre> error_status_t FAX_OpenPort(
   [in] handle_t hBinding,
   [in] DWORD DeviceId,
   [in] DWORD Flags,
   [out] PRPC_FAX_PORT_HANDLE FaxPortHandle
 );
</pre></div>
</dd></dl><p><b>hBinding: </b>The RPC binding handle for this
call. The client SHOULD reuse the RPC binding handle used as an input <i>hBinding</i>
argument for the <b>FAX_ConnectFaxServer</b> (section <span><a href="5cbfd38d-7a14-4560-ad24-9ed78f19a3bb" data-linktype="relative-path">3.1.4.1.10</a></span>)
or <b>FAX_ConnectionRefCount</b> (section <span><a href="a92941ac-bd07-4a71-af85-c2c157c97cf9" data-linktype="relative-path">3.1.4.1.11</a></span>) method
call used to connect to the fax server.</p><p><b>DeviceId: </b>A <b>DWORD</b> (<span><a href="../ms-dtyp/cca27429-5689-4a16-b2b4-9325d93e4ba2" data-linktype="relative-path">[MS-DTYP]</a></span>
section <span><a href="../ms-dtyp/262627d8-3418-4627-9218-4ffe110850b2" data-linktype="relative-path">2.2.9</a></span>)
variable that is the line identifier for the device (port). The client SHOULD
call the <b>FAX_EnumPorts</b> (section <span><a href="7143a58b-d7c5-4353-8857-39c7f708e778" data-linktype="relative-path">3.1.4.1.28</a></span>) method
to retrieve a valid value for this parameter.</p><p><b>Flags: </b>A <b>DWORD</b> variable that contains a
set of bit flags defining the access mode for the port.<a id="Appendix_A_Target_137"></a><a aria-label="Product behavior note 137" href="056171e7-80bc-45ff-8107-66ba3abb2023#Appendix_A_137" data-linktype="relative-path">&lt;137&gt;</a></p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value/code</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>0x00000000</p>
  </td>
  <td>
  <p>No port access mode flags are specified.</p>
  </td>
 </tr><tr>
  <td>
  <p>PORT_OPEN_QUERY</p>
  <p>0x00000001</p>
  </td>
  <td>
  <p>The port access mode that is required to obtain a fax
  port handle. This access mode is also required to call the <b>FAX_GetPort</b> (section
  <span><a href="f7fa6fcf-ace1-47a2-b2a4-f5e408212d78" data-linktype="relative-path">3.1.4.1.51</a></span>)
  method to query fax port information.<a id="Appendix_A_Target_138"></a><a aria-label="Product behavior note 138" href="056171e7-80bc-45ff-8107-66ba3abb2023#Appendix_A_138" data-linktype="relative-path">&lt;138&gt;</a> </p>
  </td>
 </tr><tr>
  <td>
  <p>PORT_OPEN_MODIFY</p>
  <p>0x00000002</p>
  </td>
  <td>
  <p>The port access mode to change the configuration of a
  fax port. The fax server can use this port access mode to allow execution of
  the <b>FAX_SetPort</b> (section <span><a href="e3e3dbb9-5f2d-4537-a6a1-3a7b534c5f71" data-linktype="relative-path">3.1.4.1.88</a></span>)
  method. This access mode also includes the allowance that is associated with
  the PORT_OPEN_QUERY access mode.<a id="Appendix_A_Target_139"></a><a aria-label="Product behavior note 139" href="056171e7-80bc-45ff-8107-66ba3abb2023#Appendix_A_139" data-linktype="relative-path">&lt;139&gt;</a></p>
  </td>
 </tr></tbody></table>
</dd></dl><p><b>FaxPortHandle: </b>A pointer to a variable that
receives a fax port handle as described in Fax Data Types (section <span><a href="46c77dee-7306-4b22-a407-070b221ae620" data-linktype="relative-path">2.2.74</a></span>)
which is required on subsequent calls by other fax client methods. This method
SHOULD return a NULL handle to indicate an error.</p><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 <span><a href="cbe6c4fb-4dda-4f6c-9701-0d490ba0d105" data-linktype="relative-path">2.2.52</a></span>, or one of
the other standard errors defined in <span><a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a></span>
section <span><a href="../ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d" data-linktype="relative-path">2.2</a></span>.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>ERROR_ACCESS_DENIED</p>
  <p>0x00000005</p>
  </td>
  <td>
  <p>Access is denied: the client&#39;s fax user account does
  not have either the FAX_ACCESS_QUERY_CONFIG or the FAX_ACCESS_MANAGE_CONFIG
  access permissions.</p>
  </td>
 </tr><tr>
  <td>
  <p>ERROR_INVALID_HANDLE</p>
  <p>0x00000006</p>
  </td>
  <td>
  <p>The call was made with the <i>Flags</i> argument
  containing the PORT_OPEN_MODIFY flag and the port is already opened to be
  modified by another call.</p>
  </td>
 </tr><tr>
  <td>
  <p>ERROR_BAD_UNIT</p>
  <p>0x00000014</p>
  </td>
  <td>
  <p>The system cannot find the port for the receiving
  device by using the line identifier specified by the <i>DeviceId</i> argument.</p>
  </td>
 </tr><tr>
  <td>
  <p>ERROR_INVALID_PARAMETER</p>
  <p>0x00000057</p>
  </td>
  <td>
  <p>The <i>FaxPortHandle</i> argument is NULL.<a id="Appendix_A_Target_140"></a><a aria-label="Product behavior note 140" href="056171e7-80bc-45ff-8107-66ba3abb2023#Appendix_A_140" data-linktype="relative-path">&lt;140&gt;</a></p>
  </td>
 </tr></tbody></table>
</dd></dl><p><b>Exceptions Thrown:</b> No exceptions are thrown
except those that are thrown by the underlying <span><a href="46aba9c4-ebb1-4b10-86ac-4bb3025657b9#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a></span> protocol, <span><a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a></span>.</p></div>