<div class="content" name="EnumHistory" uuid="f30e859e-fe7c-47da-a91c-2ff26e391b02"><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>0x00000000 S_OK</td>
  <td>The call was successful.</td>
 </tr><tr>
  <td>0x00000002 ERROR_PATH_NOT_FOUND</td>
  <td>The system cannot find the file specified.</td>
 </tr><tr>
  <td>0x00000008 ERROR_NOT_ENOUGH_MEMORY</td>
  <td>Not enough storage is available to process this command.</td>
 </tr><tr>
  <td>0x00000012 ERROR_NO_MORE_ITEMS</td>
  <td>There are no more history versions.</td>
 </tr><tr>
  <td>0x0000007A ERROR_INSUFFICIENT_BUFFER</td>
  <td>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.</td>
 </tr><tr>
  <td>0x80070005 ERROR_ACCESS_DENIED</td>
  <td>Access is denied.</td>
 </tr><tr>
  <td>0x80070057 E_INVALIDARG</td>
  <td>One or more arguments are invalid.</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>