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.1 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1998.
  5. //
  6. // File: CatArray.hxx
  7. //
  8. // Contents: Catalog array, for user mode content index
  9. //
  10. // History: 22-Dec-92 KyleP Split from vquery.cxx
  11. //
  12. //--------------------------------------------------------------------------
  13. #pragma once
  14. class PCatalog;
  15. class CClientDocStore;
  16. class CRequestQueue;
  17. #include <notifary.hxx>
  18. extern BOOL DriveHasCatalog( WCHAR wc );
  19. //+---------------------------------------------------------------------------
  20. //
  21. // Class: COldCatState
  22. //
  23. // Purpose: Class to store the old state of the catalog with its name
  24. //
  25. // History: 15-Jul-98 KitmanH Created
  26. // 24-Aug-98 KitmanH Added _cStopCount
  27. //
  28. //----------------------------------------------------------------------------
  29. class COldCatState
  30. {
  31. public:
  32. COldCatState( DWORD dwOldState, WCHAR const * wcsCatName, WCHAR wcVol );
  33. WCHAR * GetCatName() const { return _xCatName.Get(); }
  34. DWORD GetOldState() const { return _dwOldState; }
  35. DWORD GetStopCount() const { return _cStopCount; }
  36. void IncStopCountAndSetVol( WCHAR wcVol )
  37. {
  38. Win4Assert( !(_aVol[toupper(wcVol) - L'A']) );
  39. Win4Assert( _cStopCount > 0 );
  40. _cStopCount++;
  41. _aVol[toupper(wcVol) - L'A'] = 1;
  42. }
  43. BOOL IsVolSet ( WCHAR wcVol ) const
  44. {
  45. return ( 0 != _aVol[toupper(wcVol) - L'A'] );
  46. }
  47. void DecStopCount() { _cStopCount--; }
  48. void UnSetVol ( WCHAR wcVol )
  49. {
  50. _aVol[toupper(wcVol) - L'A'] = 0;
  51. }
  52. private:
  53. DWORD _dwOldState;
  54. DWORD _cStopCount; // times the catalog is stopped
  55. BYTE _aVol[26]; // representing the 26 volumes
  56. XArray<WCHAR> _xCatName;
  57. };
  58. //+---------------------------------------------------------------------------
  59. //
  60. // Class: CCatArray
  61. //
  62. // Purpose: Class to handle switching drives for catalogs.
  63. //
  64. // History: 07-May-92 AmyA Lifted from vquery.cxx
  65. // 02-Jun-92 KyleP Added UNC support.
  66. // 12-Jun-92 KyleP Lifted from citest.cxx
  67. //
  68. //----------------------------------------------------------------------------
  69. class CCatArray
  70. {
  71. public:
  72. CCatArray();
  73. ~CCatArray();
  74. void Init(void);
  75. PCatalog * GetOne( WCHAR const * pwcPath );
  76. PCatalog * GetNamedOne( WCHAR const * pwcName,
  77. WCHAR const * pwcPath,
  78. BOOL fOpenForReadOnly,
  79. BOOL fNoQuery = FALSE );
  80. CClientDocStore * GetDocStore( WCHAR const * pwcPath,
  81. BOOL fMustExist = TRUE );
  82. CClientDocStore * GetNamedDocStore( WCHAR const * pwcName,
  83. WCHAR const * pwcPath,
  84. BOOL fOpenForReadOnly,
  85. BOOL fMustExist = FALSE );
  86. void Flush();
  87. void FlushOne( ICiCDocStore * pDocStore );
  88. void AddStoppedCat( DWORD dwOldState,
  89. WCHAR const * wcsCatName,
  90. WCHAR wcVol );
  91. DWORD GetOldState( WCHAR const * wcsCatName );
  92. void RmFromStopArray( WCHAR const * wcsCatName );
  93. BOOL IsCatStopped( WCHAR const * wcsCatName );
  94. void ClearStopArray();
  95. BOOL IncStopCount( WCHAR const * awcName, WCHAR wcVol );
  96. void StartCatalogsOnVol( WCHAR wcVol, CRequestQueue * pRequestQ );
  97. void SetDrvNotifArray( CDrvNotifArray * pDrvNotifArray )
  98. {
  99. _pDrvNotifArray = pDrvNotifArray;
  100. }
  101. void TryToStartCatalogOnRemovableVol( WCHAR wcVol, CRequestQueue * pRequestQ );
  102. private:
  103. DWORD FindCat( WCHAR const * pwcCat );
  104. CDrvNotifArray * _pDrvNotifArray;
  105. BOOL _fInit;
  106. CMutexSem _mutex;
  107. CCountedDynArray<CClientDocStore> _aDocStores;
  108. CDynArrayInPlace<COldCatState *> _aStoppedCatalogs;
  109. };