<div class="content" name="FAX_EnumMessagesEx" uuid="43cf8eed-1cf3-4240-80c5-6f8d1d082084"><p>The <b>FAX_EnumMessagesEx (Opnum 91)</b> method is called by
the client. This message differs from the <b>FAX_EnumMessages</b> (section <a href="365c2295-c0f9-44bd-a72b-6db0b16c0f8f" data-linktype="relative-path">3.1.4.1.24</a>) in that this
function takes a <i>level</i> parameter, which differentiates the type of
message information structure that the function returns.</p><p>In response, the server MUST validate that the <i>hEnum</i>
argument that is passed by the client was created as part of a prior <b>FAX_StartMessagesEnum</b>
(section <a href="702db5ea-5293-46f3-b11e-ad8f477bbe26" data-linktype="relative-path">3.1.4.1.98</a>) or
<b>FAX_StartMessagesEnumEx</b> (section <a href="1911d0be-4274-4da1-944d-100ae92d8d74" data-linktype="relative-path">3.1.4.1.99</a>) call. The
server MUST validate that the <i>dwNumMessages</i> argument is not zero.</p><p>On success, the server MUST return information regarding
messages. The server MUST return the size of the returned information and the
number of messages for which it could successfully retrieve the information.
The latter value MUST NOT exceed <i>dwNumMessages</i>. The server MUST return
the level of information. This return value is decided by whether the client
used <b>FAX_StartMessagesEnum</b> or <b>FAX_StartMessagesEnumEx</b> to start
the enumeration of messages.</p><p>The client SHOULD free the returned buffer.</p><p>Protocol version FAX_API_VERSION_0 (0x00000000),
FAX_API_VERSION_1 (0x00010000), and  FAX_API_VERSION_2 (0x00020000) fax servers
SHOULD NOT implement this call. The fax client MUST NOT call this method if the
protocol version reported by the server is FAX_API_VERSION_0 (0x00000000),
FAX_API_VERSION_1 (0x00010000), or FAX_API_VERSION_2 (0x00020000). For more
information, see <b>FAX_ConnectFaxServer</b> (section <a href="5cbfd38d-7a14-4560-ad24-9ed78f19a3bb" data-linktype="relative-path">3.1.4.1.10</a>).</p><dl>
<dd>
<div><pre> error_status_t FAX_EnumMessagesEx(
   [in, ref] RPC_FAX_MSG_ENUM_HANDLE hEnum,
   [in] DWORD dwNumMessages,
   [out, size_is(,*lpdwBufferSize)] 
     LPBYTE* lppBuffer,
   [out, ref] LPDWORD lpdwBufferSize,
   [out, ref] LPDWORD lpdwNumMessagesRetrieved,
   [out, ref] LPDWORD lpdwLevel
 );
</pre></div>
</dd></dl><p><b>hEnum: </b>The enumeration handle returned through
the <i>lpHandle</i> output argument by <b>FAX_StartMessagesEnum</b> or <b>FAX_StartMessagesEnumEx</b>.</p><p><b>dwNumMessages: </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 indicates the maximum number of messages that the caller requires to
enumerate. This value MUST NOT be zero.</p><p><b>lppBuffer: </b>A pointer to an array of <b>FAX_MESSAGE_1</b>
(section <a href="353bdf06-225c-4274-b24b-d7832a196675" data-linktype="relative-path">2.2.37</a>)
structures that contain <i>lpdwNumMessagesRetrieved</i> entries.</p><p><b>lpdwBufferSize: </b>A pointer to a <b>DWORD</b>
value that specifies the size, in bytes, of the buffer.</p><p><b>lpdwNumMessagesRetrieved: </b>A pointer to a <b>DWORD</b>
value that indicates the actual number of retrieved messages. This value SHOULD
NOT exceed <i>dwNumMessages</i>.</p><p><b>lpdwLevel: </b>A pointer to a <b>DWORD</b> value
that indicates the structure to return.</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 <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_NOT_ENOUGH_MEMORY 0x00000008</td>
  <td>The fax server failed to allocate memory for the return buffer.</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: § One or more of the pointer values specified by the following arguments are NULL: lppBuffer, lpdwBufferSize, lpdwNumMessagesRetrieved, and lpdwLevel. § hEnum is NULL&lt;90&gt; or is an invalid handle that is not returned by a call to FAX_StartMessagesEnum or FAX_StartMessagesEnumEx &lt;91&gt;. § dwNumMessages is zero.</td>
 </tr><tr>
  <td>ERROR_BUFFER_OVERFLOW 0x0000006F</td>
  <td>The fax server encountered an integer overflow condition while processing the request for the maximum number of messages specified by the dwNumMessages argument.</td>
 </tr><tr>
  <td>ERROR_NO_MORE_ITEMS 0x00000103</td>
  <td>No more data is available. The method reached the end of the lppBuffer message buffer and there are no more messages to be enumerated.</td>
 </tr><tr>
  <td>FAX_ERR_SRV_OUTOFMEMORY 0x00001B59</td>
  <td>The fax server failed to allocate memory needed for internal execution of the command.</td>
 </tr></tbody></table>
</dd></dl><p>The client implementation assumes that this method is incremental
and uses an internal context cursor to point to the next set of messages to
retrieve for each call. The cursor is set to point to the beginning of the
messages in the archive after a successful call to <b>FAX_StartMessagesEnum</b>
or <b>FAX_StartMessagesEnumEx</b>. Each successful call to <b>FAX_EnumMessagesEx</b>
advances the cursor by the number of messages retrieved. After the cursor
reaches the end of the enumeration, the method fails with the 0x00000103
(ERROR_NO_MORE_ITEMS) error code. The <b>FAX_EndMessagesEnum</b> (section <a href="df9d34cf-780d-4e26-af24-eadb73ef443f" data-linktype="relative-path">3.1.4.1.16</a>) method can
then be called to halt the enumeration of messages.</p><p><b>Exceptions Thrown: </b>No exceptions are thrown
except those that are thrown by the underlying <a href="46aba9c4-ebb1-4b10-86ac-4bb3025657b9#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a> protocol, <a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a>.</p></div>