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.

153 lines
4.8 KiB

  1. //+------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1998.
  5. //
  6. // File: ciprop.hxx
  7. //
  8. // Contents: Content index property retriever
  9. //
  10. // Classes: CCiPropRetriever
  11. //
  12. // History: 12-Dec-96 SitaramR Created
  13. //
  14. //-------------------------------------------------------------------
  15. #pragma once
  16. #include <propret.hxx>
  17. #include <twidhash.hxx>
  18. // maximum size for the hash table used to hold depth and in-scope
  19. // information for directories encountered as matches are tested to
  20. // see if they're in scope. The hash table
  21. // is seeded with the scopes for the query - and so will always
  22. // have the basic scope information. We stop adding to the hashtable
  23. // when it reaches this max size.
  24. const unsigned MAX_HASHED_DIRECTORIES = 700;
  25. //+---------------------------------------------------------------------------
  26. //
  27. // Class: CCiPropRetriever
  28. //
  29. // Purpose: Retrieves content index properties
  30. //
  31. // History: 12-Dec-96 SitaramR Created
  32. //
  33. //----------------------------------------------------------------------------
  34. class CCiPropRetriever : public CGenericPropRetriever
  35. {
  36. public:
  37. //
  38. // From CGenericPropRetriever
  39. //
  40. virtual SCODE STDMETHODCALLTYPE BeginPropertyRetrieval( WORKID wid );
  41. virtual SCODE STDMETHODCALLTYPE IsInScope( BOOL *pfInScope);
  42. virtual SCODE STDMETHODCALLTYPE EndPropertyRetrieval();
  43. //
  44. // Local methods
  45. //
  46. CCiPropRetriever( PCatalog & cat,
  47. ICiQueryPropertyMapper *pQueryPropMapper,
  48. CSecurityCache & secCache,
  49. BOOL fUsePathAlias,
  50. CRestriction * pScope );
  51. protected:
  52. virtual ~CCiPropRetriever() {}
  53. //
  54. // Stat properties.
  55. //
  56. inline UNICODE_STRING const * GetName();
  57. UNICODE_STRING const * GetShortName();
  58. UNICODE_STRING const * GetPath();
  59. UNICODE_STRING const * GetVirtualPath();
  60. LONGLONG CreateTime();
  61. LONGLONG ModifyTime();
  62. LONGLONG AccessTime();
  63. LONGLONG ObjectSize();
  64. ULONG Attributes();
  65. BOOL InScope( WORKID wid ); // Refresh path + test path
  66. inline void PurgeCachedInfo();
  67. UNICODE_STRING _Name; // Filename
  68. UNICODE_STRING _Path; // Full path sans filename
  69. UNICODE_STRING _VPath; // Full path sans filename
  70. private:
  71. BOOL Refresh( BOOL fFast ); // Refresh stat properties
  72. BOOL IsInScope( WORKID wid );
  73. void AddVirtualScopeRestriction( CScopeRestriction const & scp );
  74. void AddScopeRestriction( const CLowerFunnyPath & lcaseFunnyPhysPath,
  75. BOOL fIsDeep );
  76. unsigned FetchVPathInVScope( XGrowable<WCHAR> & xwcVPath,
  77. WCHAR const * pwcVScope,
  78. const unsigned cwcVScope,
  79. const BOOL fVScopeDeep );
  80. unsigned FetchVirtualPath( XGrowable<WCHAR> & xwcVPath );
  81. enum FastStat
  82. {
  83. fsCreate = 0x1,
  84. fsModify = 0x2,
  85. fsAccess = 0x4,
  86. fsSize = 0x8,
  87. fsAttrib = 0x10
  88. };
  89. BOOL FetchI8StatProp( CCiPropRetriever::FastStat fsProp,
  90. PROPID pid,
  91. LONGLONG * pDestination );
  92. BOOL _fFindLoaded:1; // True if finddata is loaded
  93. BOOL _fFastFindLoaded:1; // True if GetFileAttributesEx called
  94. ULONG _fFastStatLoaded; // Bit flags of loaded stat props
  95. ULONG _fFastStatNeverLoad;
  96. WIN32_FIND_DATA _finddata; // Stat buffer for current wid
  97. UNICODE_STRING _ShortName; // Filename
  98. CRestriction * _pScope;
  99. TWidHashTable<CDirWidHashEntry> _hTable; // hash table used to hold depth
  100. // and in-scope information for directories encountered as
  101. // matches are tested to see if they're in scope. The hash
  102. // table is seeded with the scopes for the query - and so
  103. // will always have the basic scope information.
  104. BOOL _fAllInScope; // TRUE if scope equals whole catalog
  105. BOOL _fNoneInScope; // TRUE if scope doesn't include any part of catalog
  106. BOOL _fAllScopesShallow; // TRUE if all scopes are shallow
  107. XGrowable<WCHAR> _xwcPath; // Buffer for path
  108. XGrowable<WCHAR> _xwcVPath; // Buffer for virtual path
  109. };
  110. inline void CCiPropRetriever::PurgeCachedInfo()
  111. {
  112. _fFindLoaded = FALSE;
  113. _fFastFindLoaded = FALSE;
  114. _fFastStatLoaded = 0;
  115. _fFastStatNeverLoad = 0;
  116. _Path.Length = flagNoValueYet;
  117. _VPath.Length = flagNoValueYet;
  118. _Name.Length = flagNoValueYet;
  119. }