Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
2.0 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997-1998.
  5. //
  6. // File: usnlist.hxx
  7. //
  8. // Contents: List of usn flush info
  9. //
  10. // History: 07-May-97 SitaramR Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #pragma once
  14. #include <usninfo.hxx>
  15. //+-------------------------------------------------------------------------
  16. //
  17. // Class: CUsnFlushInfoList
  18. //
  19. // Purpose: List of usn flush info
  20. //
  21. // History: 07-May-97 SitaramR Created
  22. //
  23. //--------------------------------------------------------------------------
  24. class CUsnFlushInfoList
  25. {
  26. public:
  27. CUsnFlushInfoList() {}
  28. void SetUsns( ULONG cEntries,
  29. USN_FLUSH_INFO const * const * ppUsnEntries )
  30. {
  31. //
  32. // Make a copy of usn entries
  33. //
  34. _aUsnFlushInfo.Clear();
  35. for ( unsigned i=0; i<cEntries; i++ )
  36. {
  37. XPtr<CUsnFlushInfo> xInfo( new CUsnFlushInfo( ppUsnEntries[i]->volumeId,
  38. ppUsnEntries[i]->usnHighest ) );
  39. _aUsnFlushInfo.Add( xInfo.GetPointer(), i );
  40. xInfo.Acquire();
  41. }
  42. }
  43. USN GetUsn( VOLUMEID volId )
  44. {
  45. //
  46. // Search for volumeId in the list of usn entries
  47. //
  48. for ( unsigned i=0; i<_aUsnFlushInfo.Count(); i++ )
  49. {
  50. if ( _aUsnFlushInfo[i]->VolumeId() == volId )
  51. return _aUsnFlushInfo[i]->UsnHighest();
  52. }
  53. //
  54. // Not found, so return an usn of 0
  55. //
  56. return 0;
  57. }
  58. ULONG Count()
  59. {
  60. return _aUsnFlushInfo.Count();
  61. }
  62. CUsnFlushInfo *Get( unsigned index )
  63. {
  64. return _aUsnFlushInfo.Get( index );
  65. }
  66. void Add( CUsnFlushInfo * pInfo, unsigned i )
  67. {
  68. _aUsnFlushInfo.Add( pInfo, i );
  69. }
  70. private:
  71. CCountedDynArray<CUsnFlushInfo> _aUsnFlushInfo;
  72. };