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.

180 lines
4.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1998.
  5. //
  6. // File: FILTMAN.HXX
  7. //
  8. // Contents: Filter Manager
  9. //
  10. // Classes: CFilterManager
  11. // CFilterAgent
  12. //
  13. // History: 03-Jan-95 BartoszM Created from parts of CResMan
  14. //
  15. //----------------------------------------------------------------------------
  16. #pragma once
  17. #include <fdaemon.hxx>
  18. #include "wordlist.hxx"
  19. class CContentIndex;
  20. class CDocList;
  21. class CEntryBuffer;
  22. class CGetFilterDocsState;
  23. class CFilterManager;
  24. class CResManager;
  25. const LONGLONG eSigFilterAgent = 0x20544741544c4946i64; // "FILTAGT"
  26. class CFilterAgent: INHERIT_UNWIND
  27. {
  28. INLINE_UNWIND(CFilterAgent)
  29. public:
  30. CFilterAgent ( CFilterManager& filterMan, CResManager& resman );
  31. ~CFilterAgent ();
  32. void LokWakeUp ();
  33. void LokCancel ();
  34. void StopFiltering();
  35. BOOL IsStopped () const { return _fStopFilter; }
  36. BOOL PutToSleep ();
  37. void Wait(DWORD dwMilliseconds) { _eventUpdate.Wait( dwMilliseconds ); }
  38. void SlowDown () {}
  39. #ifdef CIEXTMODE
  40. void CiExtDump(void *ciExtSelf);
  41. #endif
  42. private:
  43. //
  44. // This MUST be the first variable in this class.
  45. //
  46. const LONGLONG _sigFilterAgent;
  47. CResManager& _resman;
  48. CFilterManager& _filterMan;
  49. // Mutex used when atomically accessing both
  50. // the flag and the event
  51. CMutexSem _mutex;
  52. BOOL _fStopFilter;
  53. CEventSem _eventUpdate;
  54. // CFilterDaemon _fdaemon;
  55. // CThread _thrFilter;
  56. //
  57. // Downlevel filter daemon
  58. //
  59. static DWORD WINAPI FilterThread( void* filterMan );
  60. };
  61. const LONGLONG eSigFiltMan = 0x204e414d544c4946i64; // "FILTMAN"
  62. //+---------------------------------------------------------------------------
  63. //
  64. // Class: CFilterManager
  65. //
  66. // Purpose: Manages Filtering
  67. //
  68. // Interface: CFilterManager
  69. //
  70. // History: 03-Jan-95 BartoszM Created from parts of CResMan
  71. //
  72. //----------------------------------------------------------------------------
  73. class CFilterManager : public CiProxy
  74. {
  75. friend class CFilterAgent;
  76. public:
  77. CFilterManager( CResManager& resman );
  78. virtual ~CFilterManager() {}
  79. NTSTATUS Dismount();
  80. //
  81. // Filter daemon proxy
  82. //
  83. SCODE FilterReady ( BYTE * docBuffer, ULONG & cb, ULONG cMaxDocs );
  84. SCODE FilterMore ( STATUS const * aStatus, ULONG count );
  85. SCODE FilterDataReady ( BYTE const * pEntryBuf, ULONG cb );
  86. SCODE FilterDone ( STATUS const * aStatus, ULONG count);
  87. SCODE FilterStoreValue( WORKID widFake,
  88. CFullPropSpec const & ps,
  89. CStorageVariant const & var,
  90. BOOL & fCanStore );
  91. SCODE FilterStoreSecurity( WORKID widFake,
  92. PSECURITY_DESCRIPTOR pSD,
  93. ULONG cbSD,
  94. BOOL & fCanStore );
  95. //
  96. // PPidConverter
  97. //
  98. SCODE FPSToPROPID( CFullPropSpec const & fps, PROPID & pid );
  99. #ifdef CIEXTMODE
  100. void CiExtDump(void *ciExtSelf);
  101. #endif
  102. private:
  103. void CleanupPartialWordList();
  104. BOOL LokGetFilterDocs( ULONG cMaxDocs,
  105. ULONG & cDocs,
  106. CGetFilterDocsState & state
  107. );
  108. void NewWordList ();
  109. void LokNoFailRemoveWordlist( CPartition * pPart );
  110. void LokCompleteRequestPending();
  111. BOOL LokIsGoodTimeToFilter();
  112. BOOL IsGoodTimeToFilter();
  113. //
  114. // This MUST be the first variable in this class.
  115. //
  116. const LONGLONG _sigFiltMan;
  117. LONGLONG _LastResourceCheck;
  118. BOOL _LastResourceStatus;
  119. CResManager& _resman;
  120. PWordList _pWordList;
  121. const CDocList & _docList;
  122. CFilterAgent _filterAgent;
  123. CDocList _retryFailList; // temporary used for doing error
  124. // reporting on files > max retries.
  125. BOOL _fWaitOnNoDocs; // Flag set to TRUE if the filter thread
  126. // should wait when there are no docs.
  127. const BOOL _fPushFiltering; // Push/simple model of filtering ?
  128. };