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.

146 lines
4.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 2000.
  5. //
  6. // File: EBUFHDLR.HXX
  7. //
  8. // Contents: Class to manage entry buffers
  9. //
  10. // Classes: CEntryBufferHandler
  11. //
  12. // History: 18-Mar-93 AmyA Created.
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #ifdef DISPLAY_INCLUDES
  17. #pragma message( "#include <" __FILE__ ">..." )
  18. #endif
  19. #include <pfilter.hxx>
  20. #include <fdaemon.hxx>
  21. #include "entrybuf.hxx"
  22. class CKeyBuf;
  23. class CPidMapper;
  24. //+---------------------------------------------------------------------------
  25. //
  26. // Class: CEntryBufferHandler
  27. //
  28. // Purpose: To prepare keys in the CEntryBuffer for passing into the
  29. // volatile index
  30. //
  31. // History: 18-Mar-93 AmyA Created from portions of CWordList.
  32. //
  33. // Notes: This is where a call to the API to pass a pointer to a
  34. // CEntryBuffer to CWordlist goes.
  35. //
  36. //----------------------------------------------------------------------------
  37. class CEntryBufferHandler : INHERIT_UNWIND
  38. {
  39. DECLARE_UNWIND
  40. public:
  41. CEntryBufferHandler( ULONG cbMemory,
  42. BYTE * buffer,
  43. CFilterDaemon& fDaemon,
  44. CiProxy & ciProxy,
  45. CPidMapper & pidMap );
  46. void SetWid( WORKID wid );
  47. void AddEntry( const CKeyBuf & key, OCCURRENCE occ );
  48. void Done();
  49. void FlushBuffer();
  50. BOOL WordListFull() { return _wordListFull; }
  51. void Init();
  52. inline const ULONG GetFilteredBlockCount() const { return _cFilteredBlocks; }
  53. void InitFilteredBlockCount( ULONG ulMaxFilteredBlocks )
  54. {
  55. _cFilteredBlocks = 0;
  56. _ulMaxFilteredBlocks = ulMaxFilteredBlocks;
  57. }
  58. inline BOOL StoreValue( CFullPropSpec const & prop,
  59. CStorageVariant const & var );
  60. inline BOOL StoreSecurity( PSECURITY_DESCRIPTOR pSD, ULONG cbSD );
  61. private:
  62. ULONG _CurrentWidIndex; // Index of current workid.
  63. CEntryBuffer _entryBuf;
  64. BOOL _wordListFull; // set in FlushBuffer
  65. CFilterDaemon & _filterDaemon; // all wordlist calls go to this
  66. ULONG _cFilteredBlocks; // Number of filtered blocks through
  67. // this buffer
  68. ULONG _ulMaxFilteredBlocks; // Max number of blocks that can
  69. // be filtered thru this buffer
  70. };
  71. //+---------------------------------------------------------------------------
  72. //
  73. // Member: CEntryBufferHandler::StoreValue
  74. //
  75. // Synopsis: Store a property value.
  76. //
  77. // Arguments: [prop] -- Property descriptor
  78. // [var] -- Value
  79. //
  80. // Returns: TRUE if the property is in the schema
  81. //
  82. // History: 21-Dec-95 KyleP Created
  83. //
  84. //----------------------------------------------------------------------------
  85. inline BOOL CEntryBufferHandler::StoreValue( CFullPropSpec const & prop,
  86. CStorageVariant const & var )
  87. {
  88. BOOL fCanStore = TRUE; // err on the side of safety
  89. _filterDaemon.FilterStoreValue( _CurrentWidIndex,
  90. prop,
  91. var,
  92. fCanStore );
  93. return fCanStore;
  94. }
  95. //+---------------------------------------------------------------------------
  96. //
  97. // Member: CEntryBufferHandler::StoreSecurity
  98. //
  99. // Synopsis: Store security information for a file.
  100. //
  101. // Arguments: [pSD] -- pointer to a security descriptor
  102. // [cbSD] -- size in bytes of pSD
  103. //
  104. // History: 07 Feb 96 AlanW Created
  105. //
  106. //----------------------------------------------------------------------------
  107. inline BOOL CEntryBufferHandler::StoreSecurity( PSECURITY_DESCRIPTOR pSD,
  108. ULONG cbSD )
  109. {
  110. BOOL fCanStore;
  111. _filterDaemon.FilterStoreSecurity( _CurrentWidIndex,
  112. pSD,
  113. cbSD,
  114. fCanStore );
  115. return fCanStore;
  116. }