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.

300 lines
7.3 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997 - 1998.
  5. //
  6. // File: CINULCAT.HXX
  7. //
  8. // Contents: Null catalog
  9. //
  10. // History: 09-Jul-97 KrishnaN Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #pragma once
  14. #include <catalog.hxx>
  15. #include <spropmap.hxx>
  16. #include <cistore.hxx>
  17. #include <pidtable.hxx>
  18. #include <imprsnat.hxx>
  19. #include <ciintf.h>
  20. #include <pidremap.hxx>
  21. #include "statmon.hxx"
  22. class CClientDocStore;
  23. //+---------------------------------------------------------------------------
  24. //
  25. // Class: CiNullCat
  26. //
  27. // Purpose: Null Catalog.
  28. //
  29. // History: 09-Jul-97 KrishnaN Created
  30. //
  31. //----------------------------------------------------------------------------
  32. class CiNullCat: public PCatalog
  33. {
  34. public:
  35. CiNullCat ( CClientDocStore & docStore);
  36. ~CiNullCat ();
  37. // Tell the world we are a dummy ...
  38. BOOL IsNullCatalog()
  39. {
  40. return TRUE;
  41. }
  42. const WCHAR * GetName()
  43. {
  44. return 0;
  45. }
  46. const WCHAR * GetCatDir()
  47. {
  48. return 0;
  49. }
  50. PStorage& GetStorage ()
  51. {
  52. Win4Assert( !"Not supported for Null Catalog" );
  53. return *(CiStorage *)0;
  54. }
  55. WCHAR * GetDriveName()
  56. {
  57. return 0;
  58. }
  59. CCiScopeTable * GetScopeTable()
  60. {
  61. return 0;
  62. }
  63. CScopeFixup * GetScopeFixup()
  64. {
  65. return &_scopeFixup;
  66. }
  67. unsigned WorkIdToPath ( WORKID wid, CFunnyPath& funnyPath )
  68. {
  69. Win4Assert( !"Not supported for Null Catalog" );
  70. return 0;
  71. }
  72. void UpdateDocuments( WCHAR const* rootPath=0,
  73. ULONG flag=UPD_FULL )
  74. {
  75. Win4Assert( !"Not supported for Null Catalog" );
  76. }
  77. unsigned ReserveUpdate( WORKID wid )
  78. {
  79. Win4Assert( !"Downlevel CI feature called" );
  80. THROW( CException( E_NOTIMPL ) );
  81. return 1;
  82. }
  83. NTSTATUS ForceMerge( PARTITIONID partID )
  84. {
  85. Win4Assert( !"Not supported for Null Catalog" );
  86. return 0;
  87. }
  88. NTSTATUS AbortMerge( PARTITIONID partID )
  89. {
  90. Win4Assert( !"Not supported for Null Catalog" );
  91. return 0;
  92. }
  93. void SetPartition( PARTITIONID PartId )
  94. {
  95. Win4Assert( !"Not supported for Null Catalog" );
  96. }
  97. PARTITIONID GetPartition() const
  98. {
  99. Win4Assert( !"Not supported for Null Catalog" );
  100. return 1;
  101. }
  102. const WCHAR * GetScopesKey()
  103. {
  104. return _xScopesKey.Get();
  105. }
  106. void FlushScanStatus()
  107. {
  108. Win4Assert( !"Not supported for Null Catalog" );
  109. }
  110. void Update( unsigned iHint,
  111. WORKID wid,
  112. PARTITIONID partid,
  113. USN usn,
  114. ULONG flags )
  115. {
  116. Win4Assert( !"Not supported for Null Catalog" );
  117. }
  118. SCODE CreateContentIndex()
  119. {
  120. Win4Assert( !"Not supported for Null Catalog" );
  121. return E_NOTIMPL;
  122. }
  123. void EmptyContentIndex()
  124. {
  125. Win4Assert( !"Not supported for Null Catalog" );
  126. }
  127. void ShutdownPhase2();
  128. SCODE CiState( CI_STATE & state );
  129. void HandleError( NTSTATUS status );
  130. BOOL IsLowOnDisk() const
  131. {
  132. return FALSE;
  133. }
  134. //
  135. // Support for CiFramework.
  136. //
  137. void StartupCiFrameWork( ICiManager * pCiManager );
  138. unsigned FixupPath( WCHAR const * pwcOriginal,
  139. WCHAR * pwcResult,
  140. unsigned cwcResult,
  141. unsigned cSkip )
  142. {
  143. if ( 0 == cSkip )
  144. return _scopeFixup.Fixup( pwcOriginal, pwcResult, cwcResult, cSkip );
  145. else
  146. return 0;
  147. }
  148. void InverseFixupPath( CLowerFunnyPath & lcaseFunnyPath )
  149. {
  150. _scopeFixup.InverseFixup( lcaseFunnyPath );
  151. }
  152. CImpersonationTokenCache * GetImpersonationTokenCache()
  153. { return & _impersonationTokenCache; }
  154. void RefreshRegistryParams();
  155. ICiManager *CiManager()
  156. {
  157. Win4Assert( _xCiManager.GetPointer() );
  158. return _xCiManager.GetPointer();
  159. }
  160. CCiRegParams * GetRegParams() { return & _regParams; }
  161. // Always return a 1. A wid will be obtained later
  162. // from the bigtable
  163. WORKID PathToWorkId ( const CLowerFunnyPath &, const BOOL)
  164. {
  165. return 1;
  166. }
  167. PROPID PropertyToPropId ( CFullPropSpec const & ps, BOOL fCreate = FALSE )
  168. {
  169. return _propMapper.PropertyToPropId( ps, fCreate);
  170. }
  171. CRWStore * ComputeRelevantWords(ULONG cRows,ULONG cRW,
  172. WORKID *pwid,
  173. PARTITIONID partid)
  174. {
  175. Win4Assert( !"Not supported in Framework" );
  176. return 0;
  177. }
  178. CRWStore * RetrieveRelevantWords(BOOL fAcquire,
  179. PARTITIONID partid)
  180. {
  181. Win4Assert( !"Not supported in Framework" );
  182. return 0;
  183. }
  184. //+---------------------------------------------------------------------------
  185. //
  186. // Member: CiNullCat::PidMapToPidRemap, public
  187. //
  188. // Synopsis: Converts a pidMapperArray into a pidRemapper
  189. //
  190. // Arguments: [pidMap] -- a pid mapper to convert into a pid remapper
  191. // [pidRemap] -- the converted pid remapper;
  192. //
  193. // History: 01-Mar-95 DwightKr Created
  194. //
  195. //----------------------------------------------------------------------------
  196. void PidMapToPidRemap( const CPidMapper & pidMap,
  197. CPidRemapper & pidRemap )
  198. {
  199. //
  200. // Rebuild the pidRemapper
  201. //
  202. pidRemap.ReBuild( pidMap );
  203. };
  204. CPidLookupTable & GetPidLookupTable() { return *(CPidLookupTable *)0; }
  205. void CiNullCat::SetAdviseStatus();
  206. private:
  207. BOOL IsInit() { return eStarting != _state; }
  208. WCHAR const * GetScope( const WCHAR * wcsScope );
  209. void LogCiFailure( NTSTATUS status );
  210. BOOL IsStarted() const { return eStarted == _state; }
  211. BOOL IsShutdown() const { return eShutdown == _state; }
  212. void SetupScopeFixups();
  213. enum EState
  214. {
  215. eStarting,
  216. eStarted,
  217. eShutdown
  218. };
  219. ULONG _ulSignature; // Signature of start of privates
  220. EState _state;
  221. CImpersonationTokenCache _impersonationTokenCache;
  222. CScopeFixup _scopeFixup; // path fixup for remote clients
  223. CClientDocStore & _docStore; // Document store interface
  224. BOOL _fInitialized; // Set to true when fully initilaized.
  225. // Optimization - test before doing a wait.
  226. CMutexSem _mutex;
  227. CMutexSem _mtxAdmin; // Lock for admin operations.
  228. XArray<WCHAR> _xScopesKey; // handy registry key
  229. CCiRegParams _regParams;
  230. //
  231. // This array will hold the mapping of GUID\DISPID and GUID\Name to pid.
  232. // "Real" pids are allocated sequentially, and are good only for the life
  233. // of the catalog object.
  234. //
  235. CStandardPropMapper _propMapper;
  236. //
  237. // CI Framework support.
  238. //
  239. XInterface<ICiManager> _xCiManager; // ContentIndex manager
  240. XInterface<ICiCAdviseStatus> _xAdviseStatus;
  241. };