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.

152 lines
3.7 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Copyright (C) Microsoft Corporation, 1992 - 1997
  4. //
  5. // File: vrtenum.hxx
  6. //
  7. // Contents: Virtual roots enumerator
  8. //
  9. // History: 25-Jul-93 KyleP Created
  10. //
  11. //--------------------------------------------------------------------------
  12. #pragma once
  13. #include <catalog.hxx>
  14. #include <propret.hxx>
  15. #include <ciintf.h>
  16. //+-------------------------------------------------------------------------
  17. //
  18. // Class: CVRootEnum
  19. //
  20. // Purpose: Enumerate virtual root metadata
  21. //
  22. // History: 13-Apr-96 KyleP Created
  23. //
  24. //--------------------------------------------------------------------------
  25. class CVRootEnum : public CGenericPropRetriever, ICiCScopeEnumerator
  26. {
  27. public:
  28. //
  29. // From IUnknown
  30. //
  31. virtual SCODE STDMETHODCALLTYPE QueryInterface( REFIID riid, void **ppvObject );
  32. virtual ULONG STDMETHODCALLTYPE AddRef();
  33. virtual ULONG STDMETHODCALLTYPE Release();
  34. //
  35. // From CGenericPropRetriever
  36. //
  37. SCODE STDMETHODCALLTYPE BeginPropertyRetrieval( WORKID wid );
  38. SCODE STDMETHODCALLTYPE IsInScope( BOOL *pfInScope);
  39. SCODE STDMETHODCALLTYPE EndPropertyRetrieval();
  40. //
  41. // From ICiCScopeEnumerator
  42. //
  43. SCODE STDMETHODCALLTYPE Begin();
  44. SCODE STDMETHODCALLTYPE CurrentDocument( WORKID *pWorkId);
  45. SCODE STDMETHODCALLTYPE NextDocument( WORKID *pWorkId );
  46. SCODE STDMETHODCALLTYPE RatioFinished( ULONG *pulDenominator,
  47. ULONG *pulNumerator);
  48. SCODE STDMETHODCALLTYPE End();
  49. CVRootEnum( PCatalog & cat,
  50. ICiQueryPropertyMapper *pQueryPropMapper,
  51. CSecurityCache & secCache,
  52. BOOL fUsePathAlias );
  53. protected:
  54. virtual ~CVRootEnum();
  55. WORKID NextObject();
  56. //
  57. // Stat properties.
  58. //
  59. inline UNICODE_STRING const * GetName();
  60. inline UNICODE_STRING const * GetShortName();
  61. UNICODE_STRING const * GetPath();
  62. UNICODE_STRING const * GetVirtualPath();
  63. inline LONGLONG CreateTime();
  64. inline LONGLONG ModifyTime();
  65. inline LONGLONG AccessTime();
  66. inline LONGLONG ObjectSize();
  67. inline ULONG Attributes();
  68. BOOL GetVRootType( ULONG & ulType );
  69. inline void PurgeCachedInfo();
  70. UNICODE_STRING _Name; // Filename
  71. UNICODE_STRING _Path; // Full path sans filename
  72. UNICODE_STRING _VPath; // Full path sans filename
  73. private:
  74. WORKID _widCurrent; // Wid on which the vroot enumerator
  75. // is currently positioned
  76. BOOL Refresh( BOOL fFast ); // Refresh stat properties
  77. unsigned _iBmk; // Bookmark into virtual roots
  78. BOOL _fFindLoaded:1; // True if finddata is loaded
  79. BOOL _fFastFindLoaded:1; // True if GetFileAttributesEx called
  80. ULONG _Type; // Root type.
  81. enum FastStat
  82. {
  83. fsCreate = 0x1,
  84. fsModify = 0x2,
  85. fsAccess = 0x4,
  86. fsSize = 0x8,
  87. fsAttrib = 0x10
  88. };
  89. ULONG _fFastStatLoaded;
  90. ULONG _fFastStatNeverLoad;
  91. WIN32_FIND_DATA _finddata; // Stat buffer for current wid
  92. UNICODE_STRING _ShortName; // Filename
  93. CLowerFunnyPath _lcaseFunnyPath; // Buffer for path
  94. XGrowable<WCHAR> _xwcsVPath; // Buffer for virtual path
  95. };
  96. inline void CVRootEnum::PurgeCachedInfo()
  97. {
  98. _fFindLoaded = FALSE;
  99. _fFastFindLoaded = FALSE;
  100. _fFastStatLoaded = 0;
  101. _fFastStatNeverLoad = 0;
  102. _Path.Length = 0xFFFF;
  103. _VPath.Length = 0xFFFF;
  104. }
  105. inline UNICODE_STRING const * CVRootEnum::GetName()
  106. {
  107. return( &_Name );
  108. }