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.

286 lines
6.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1998.
  5. //
  6. // File: acinotfy.hxx
  7. //
  8. // Contents: An "work item" to process change notifications in CI.
  9. //
  10. // Classes: CCiAsyncProcessNotify
  11. //
  12. // History: 2-26-96 srikants Created
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include <workman.hxx>
  17. #include <cqueue.hxx>
  18. #include <ffenum.hxx>
  19. #include <ciintf.h>
  20. class CiCat;
  21. class CCiScanMgr;
  22. class CClientDocStore;
  23. extern CWorkQueue TheFrameworkClientWorkQueue;
  24. //
  25. // This is a Win32 function not available until NT5. Dynamically load it.
  26. //
  27. typedef WINBASEAPI DWORD(WINAPI * FNGETLONGPATHNAME)( LPCWSTR lpszShortPath,
  28. LPWSTR lpszLongPath,
  29. DWORD cchBuffer );
  30. //+---------------------------------------------------------------------------
  31. //
  32. // Class: CCiChangeQueue
  33. //
  34. // Purpose: Class for enumerating through the CI change notifications.
  35. //
  36. // History: 1-18-96 srikants Created
  37. //
  38. // Notes: The reason CChangeQueue could not be used is that it needs
  39. // an extra memory allocation of the change buffer. It is more
  40. // suited for query processing of notifications because of the
  41. // asynchronous processing of change notifications there.
  42. //
  43. //----------------------------------------------------------------------------
  44. class CCiChangeQueue
  45. {
  46. public:
  47. CCiChangeQueue( BYTE const * pNotify ) :
  48. _pNotify(pNotify),
  49. _pCurrent(0)
  50. {
  51. }
  52. CDirNotifyEntry const * First()
  53. {
  54. if ( _pNotify )
  55. _pCurrent = (CDirNotifyEntry *)_pNotify;
  56. return _pCurrent;
  57. }
  58. CDirNotifyEntry const * Next()
  59. {
  60. if ( _pCurrent )
  61. _pCurrent = _pCurrent->Next();
  62. return _pCurrent;
  63. }
  64. CDirNotifyEntry const * NextLink()
  65. {
  66. if ( _pCurrent )
  67. return _pCurrent->Next();
  68. else
  69. return _pCurrent;
  70. }
  71. private:
  72. BYTE const * _pNotify;
  73. CDirNotifyEntry const * _pCurrent;
  74. };
  75. //+---------------------------------------------------------------------------
  76. //
  77. // Member: CCiSyncProcessNotify - Process synchronously in the
  78. // callers thread.
  79. //
  80. // Modifies:
  81. //
  82. // History: 3-07-96 srikants Created
  83. //
  84. // Notes:
  85. //
  86. //----------------------------------------------------------------------------
  87. class CCiSyncProcessNotify
  88. {
  89. public:
  90. CCiSyncProcessNotify( CiCat & cicat,
  91. CCiScanMgr & scanMgr,
  92. BYTE const * pbChanges,
  93. WCHAR const * wcsRoot,
  94. BOOL & fAbort );
  95. void DoIt();
  96. private:
  97. BOOL IsShortName();
  98. BOOL ConvertToLongName();
  99. void RescanCurrentPath();
  100. void Report8Dot3Delete();
  101. static FNGETLONGPATHNAME _fnGetLongPathNameW;
  102. CiCat & _cicat;
  103. CCiScanMgr & _scanMgr;
  104. CCiChangeQueue _changeQueue;
  105. // _rootLen does not count "\\?\"
  106. ULONG _rootLen; // Add these together for full
  107. ULONG _relativePathLen; // path length.
  108. BOOL & _fAbort;
  109. ULONG _nUpdates;
  110. CLowerFunnyPath _lowerFunnyPath;
  111. };
  112. const LONGLONG eSigCCiAsyncProcessNotify = 0x4649544F4E494343i64; // "CCINOTFY"
  113. //+---------------------------------------------------------------------------
  114. //
  115. // Class: CCiAsyncProcessNotify
  116. //
  117. // Purpose: A "work item" to process change notifications in CI.
  118. //
  119. // History: 2-28-96 srikants Created
  120. //
  121. // Notes:
  122. //
  123. //----------------------------------------------------------------------------
  124. class CCiAsyncProcessNotify : public CFwAsyncWorkItem
  125. {
  126. public:
  127. CCiAsyncProcessNotify( CWorkManager & workMan,
  128. CiCat & cicat,
  129. CCiScanMgr & scanMgr,
  130. XArray<BYTE> & xChanges,
  131. WCHAR const * wcsRoot );
  132. virtual ~CCiAsyncProcessNotify()
  133. {
  134. delete [] _pbChanges;
  135. }
  136. //
  137. // virtual methods from PWorkItem
  138. //
  139. void DoIt( CWorkThread * pThread );
  140. private:
  141. BYTE * _pbChanges;
  142. CCiSyncProcessNotify _changes;
  143. };
  144. //+---------------------------------------------------------------------------
  145. //
  146. // Class: CIISVRootAsyncNotify
  147. //
  148. // Purpose: A class to process gibraltar registry notification changes
  149. // in a worker thread.
  150. //
  151. // History: 4-11-96 srikants Created
  152. //
  153. // Notes:
  154. //
  155. //----------------------------------------------------------------------------
  156. class CIISVRootAsyncNotify : public CFwAsyncWorkItem
  157. {
  158. public:
  159. CIISVRootAsyncNotify( CiCat & cicat, CWorkManager & workMan )
  160. : CFwAsyncWorkItem( workMan, TheFrameworkClientWorkQueue ),
  161. _cicat(cicat)
  162. {
  163. }
  164. //
  165. // virtual methods from PWorkItem
  166. //
  167. void DoIt( CWorkThread * pThread );
  168. private:
  169. CiCat & _cicat;
  170. };
  171. //+---------------------------------------------------------------------------
  172. //
  173. // Class: CRegistryScopesAsyncNotify
  174. //
  175. // Purpose: A class to process registry scopes notification changes
  176. // in a worker thread.
  177. //
  178. // History: 10-16-96 dlee Created
  179. //
  180. //----------------------------------------------------------------------------
  181. class CRegistryScopesAsyncNotify : public CFwAsyncWorkItem
  182. {
  183. public:
  184. CRegistryScopesAsyncNotify( CiCat & cicat, CWorkManager & workMan )
  185. : CFwAsyncWorkItem(workMan,TheFrameworkClientWorkQueue),
  186. _cicat(cicat)
  187. {
  188. }
  189. //
  190. // virtual methods from PWorkItem
  191. //
  192. void DoIt( CWorkThread * pThread );
  193. private:
  194. CiCat & _cicat;
  195. };
  196. //+---------------------------------------------------------------------------
  197. //
  198. // Class: CStartFilterDaemon
  199. //
  200. // Purpose: A work item to startup filter daemon.
  201. //
  202. // History: 12-23-96 srikants Created
  203. //
  204. //----------------------------------------------------------------------------
  205. class CStartFilterDaemon : public CFwAsyncWorkItem
  206. {
  207. public:
  208. CStartFilterDaemon( CClientDocStore & docStore,
  209. CWorkManager & workMan )
  210. : CFwAsyncWorkItem(workMan,TheFrameworkClientWorkQueue),
  211. _docStore(docStore)
  212. {
  213. }
  214. //
  215. // virtual methods from PWorkItem
  216. //
  217. void DoIt( CWorkThread * pThread );
  218. private:
  219. CClientDocStore & _docStore;
  220. };