Leaked source code of windows server 2003
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.

145 lines
4.1 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1998.
  5. //
  6. // File: UPDATE.HXX
  7. //
  8. // Contents: Scaffolding
  9. //
  10. // History: 05-Aug-90 KyleP Added header.
  11. // 05-Jan-96 KyleP Convert to UniCode
  12. //
  13. //--------------------------------------------------------------------------
  14. #pragma once
  15. #include <doclist.hxx>
  16. #include <fullpath.hxx>
  17. #include <ffenum.hxx>
  18. class CImpersonateRemoteAccess;
  19. class CiCat;
  20. //+---------------------------------------------------------------------------
  21. //
  22. // Class: CTraverse
  23. //
  24. // Purpose: A general purpose class to traverse a directory recursively.
  25. //
  26. // History: 3-15-96 srikants Split from CUpdate
  27. //
  28. //----------------------------------------------------------------------------
  29. class CTraverse : public CLowerFunnyStack
  30. {
  31. public:
  32. CTraverse( CiCat & cat, BOOL & fAbort, BOOL fProcessRoot );
  33. void DoIt( const CLowerFunnyPath & lcaseFunnyRootPath );
  34. virtual BOOL IsEligibleForTraversal( const CLowerFunnyPath & lcaseFunnyDir ) const
  35. {
  36. return TRUE;
  37. }
  38. virtual BOOL ProcessFile( const CLowerFunnyPath & lcaseFunnyPath ) = 0;
  39. virtual void TraversalIdle( BOOL fStalled = FALSE ) {}
  40. protected:
  41. enum { FINDFIRST_SIZE = 0x1000 };
  42. CiCat & _cat;
  43. BOOL & _fAbort; // flag set to TRUE if the scan must
  44. BOOL _fProcessRoot; // Should the rootPath be processed ?
  45. XArray<BYTE> _xbBuf; // Buffer for FindFirst data
  46. CDirEntry * _pCurEntry; // Current entry
  47. NTSTATUS _status; // Error noticed
  48. private:
  49. BOOL Traverse ( XPtr<CLowerFunnyPath> & xLowerFunnyPath,
  50. CImpersonateRemoteAccess & remoteAccess );
  51. ULONG _cProcessed; // for backing off on scans
  52. };
  53. //+---------------------------------------------------------------------------
  54. //
  55. // Class: CUpdate
  56. //
  57. // Purpose: Update catalog and content index
  58. //
  59. // Interface:
  60. //
  61. // History: 02-Apr-92 BartoszM Created.
  62. //
  63. //----------------------------------------------------------------------------
  64. class CUpdate : public CTraverse
  65. {
  66. public:
  67. CUpdate( CiCat& cat,
  68. ICiManager & ciManager,
  69. const CLowerFunnyPath & lcaseFunnyRootPath,
  70. PARTITIONID PartId,
  71. BOOL fIncrem,
  72. BOOL fDoDeletions,
  73. BOOL & fAbort,
  74. BOOL fProcessRoot );
  75. void EndProcessing();
  76. virtual BOOL IsEligibleForTraversal( const CLowerFunnyPath & lcaseFunnyDir ) const;
  77. virtual BOOL ProcessFile( const CLowerFunnyPath & lcaseFunnyPath );
  78. private:
  79. void Add( WORKID wid );
  80. BOOL ProcessFileInternal( const CLowerFunnyPath & lcaseFunnyPath );
  81. ICiManager & _ciManager;
  82. unsigned _cDoc;
  83. CDocList _docList;
  84. BOOL _fIncrem; // incremental update
  85. BOOL _fDoDeletions; // delete un-seen entries
  86. PARTITIONID _PartId;
  87. // be aborted
  88. FILETIME _timeLastUpd;
  89. };
  90. //+---------------------------------------------------------------------------
  91. //
  92. // Class: CRenameDir
  93. //
  94. // Purpose: Rename files in old dir to files in new dir
  95. //
  96. // History: 20-Mar-96 SitaramR Created
  97. //
  98. //----------------------------------------------------------------------------
  99. class CRenameDir : public CTraverse
  100. {
  101. public:
  102. CRenameDir( CiCat & cicat,
  103. const CLowerFunnyPath & lcaseFunnyDirOldName,
  104. const CLowerFunnyPath & lcaseFunnyDirNewName,
  105. BOOL & fAbort,
  106. VOLUMEID volumeId );
  107. virtual BOOL ProcessFile( const CLowerFunnyPath & lcaseFunnyNewFileName );
  108. private:
  109. CiCat & _cicat;
  110. unsigned _uLenDirOldName;
  111. unsigned _uLenDirNewName;
  112. VOLUMEID _volumeId;
  113. CLowerFunnyPath _lowerFunnyDirOldName;
  114. };