<div class="content"><p>The EnumHistory method returns an enumerated history entry
with a supplied index.</p><dl>
<dd>
<div><pre> HRESULT EnumHistory(
     [in, out, size_is(MD_BACKUP_MAX_LEN)] LPWSTR  pszMDHistoryLocation,
     [out] DWORD *pdwMDMajorVersion,
     [out] DWORD *pdwMDMinorVersion,
     [out] PFILETIME  pftMDHistoryTime,
     [in]  DWORD dwMDEnumIndex);
 };
</pre></div>
</dd></dl><p><b>pszMDHistoryLocation: </b>A pointer to a Unicode
string that on input contains the path to the history files being enumerated.
If this is an empty string, the server SHOULD use a default path. If an empty
string is passed in, the default history path will be written to the buffer.<a id="Appendix_A_Target_22"></a><a aria-label="Product behavior note 22" href="88fd1df0-e63e-41ca-9bf3-bedcab57cd86#Appendix_A_22" data-linktype="relative-path">&lt;22&gt;</a></p><p><b>pwdMDMajorVersion: </b>A pointer to an integer
value containing the predecimal version number for the current enumerated
history entry.</p><p><b>pwdMDMinorVersion: </b>A pointer to an integer
value containing the postdecimal version number for the current enumerated
history entry.</p><p><b>pftdMDHistoryTime: </b>A pointer to a <a href="../ms-dtyp/2c57429b-fdd4-488f-b5fc-9e4cf020fcdf" data-linktype="relative-path">FILETIME</a>
structure containing the time stamp for the current enumerated history entry.</p><p><b>dwMDEnumIndex: </b>An integer value containing the
current index of the history entry to be enumerated. This value SHOULD start at
zero on the first call and SHOULD be increased by one on subsequent calls until
the last entry in the history is reached. This indexing is controlled by the
client, so the client is responsible for selecting the next history file to be
enumerated.</p><p><b>Return Values: </b>A signed 32-bit value that
indicates return status. If the method returns a negative value, it failed. If
the 12-bit facility code (bits 16–27) is set to 0x007, the value contains a
Win32 error code in the lower 16 bits. Zero or positive values indicate
success, with the lower 16 bits in positive nonzero values containing warnings
or flags defined in the method implementation. For more information about Win32
error codes and <a href="../ms-dtyp/a9046ed2-bfb2-4d56-a719-2824afce59ac" data-linktype="relative-path">HRESULT</a>
values, see <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>0x00000000</p>
  <p>S_OK</p>
  </td>
  <td>
  <p>The call was successful.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000002</p>
  <p>ERROR_PATH_NOT_FOUND</p>
  </td>
  <td>
  <p>The system cannot find the file specified.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000008</p>
  <p>ERROR_NOT_ENOUGH_MEMORY</p>
  </td>
  <td>
  <p>Not enough storage is available to process this
  command.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000012</p>
  <p>ERROR_NO_MORE_ITEMS</p>
  </td>
  <td>
  <p>There are no more history versions.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x0000007A</p>
  <p>ERROR_INSUFFICIENT_BUFFER</p>
  </td>
  <td>
  <p>The data area passed to a system call is too small. In
  this case the location string does not have enough space to return the path
  to the history location.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x80070005</p>
  <p>ERROR_ACCESS_DENIED</p>
  </td>
  <td>
  <p>Access is denied.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x80070057</p>
  <p>E_INVALIDARG</p>
  </td>
  <td>
  <p>One or more arguments are invalid.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p><b>Exceptions Thrown: </b>No exceptions are thrown
beyond those thrown by the underlying <a href="1243ba70-74ca-44f9-be0b-dfd6697010b4#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><p>The <a href="1243ba70-74ca-44f9-be0b-dfd6697010b4#gt_e127848e-c66d-427d-b3aa-9f904fa4ada7" data-linktype="relative-path">opnum</a>
field value for this method is 39.</p><p>When processing this call, the server MUST do the following:</p><ul><li><p><span><span> 
</span></span>If the string passed by the client in the <i>pszMDHistoryLocation</i>
parameter is not null-terminated and less than 100 <a href="../ms-dtyp/7df7c1d5-492c-4db4-a992-5cd9e887c5d7" data-linktype="relative-path">WCHARs</a>,
an E_INVALIDARG error code will be returned.</p>
</li><li><p><span><span> 
</span></span>If the <i>pszMDHistoryLocation</i> parameter is an empty string,
the default history directory will be used, and this value will be written to
the <i>pszMDHistoryLocation</i> buffer. Therefore, the history location buffer
needs to be large enough to hold this string. Thus, it is expected that the
client pass a buffer of 100 WCHARs, even in the case where an empty string is
passed.</p>
</li><li><p><span><span> 
</span></span>The server will find the history entry that corresponds to the
location passed in and the index number. For instance: </p>
<p>If the index is zero
based, then:</p>
<ul><li><p><span><span>  </span></span>If
the index passed is 3, then the server looks for the fourth file (file number
4) in the directory.</p>
</li><li><p><span><span>  </span></span>If
the index passed is 4, then the server looks for the fifth file (file number 5)
in the directory.</p>
</li></ul></li><li><p><span><span> 
</span></span>Once the history entry is found, the server will return the
version number of the history entry in the two version parameters. The server
also will return the file time stamp information in the <i>pftdMDHistoryTime</i>
parameter.</p>
</li><li><p><span><span> 
</span></span>If the index is past the last file in the history location, the
server MUST return an ERROR_NO_MORE_ITEMS error code to indicate that there are
no more items to the client.</p>
</li></ul></div>