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.

407 lines
13 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 2000.
  5. //
  6. // File: svccatpx.hxx
  7. //
  8. // Contents: client-side proxy to SVC catalog.
  9. //
  10. // History: 28-Feb-1994 KyleP Created
  11. // 16-Sep-1996 dlee ported from ofs to cisvc
  12. //
  13. //--------------------------------------------------------------------------
  14. #pragma once
  15. #include <catalog.hxx>
  16. #include <proxymsg.hxx>
  17. #include <sizeser.hxx>
  18. class CPidMapper;
  19. //+-------------------------------------------------------------------------
  20. //
  21. // Class: CSvcCatProxy
  22. //
  23. // Purpose: Proxy to SVC catalog
  24. //
  25. // 16-Sep-1996 dlee created
  26. // 08-Apr-1998 kitmanh added SetCatState
  27. //
  28. //--------------------------------------------------------------------------
  29. class CSvcCatProxy : public PCatalog
  30. {
  31. public:
  32. CSvcCatProxy( WCHAR const *pwcMachine,
  33. IDBProperties * pDbProperties ) :
  34. _client( pwcMachine, pDbProperties )
  35. {
  36. }
  37. ~CSvcCatProxy()
  38. {
  39. TRY
  40. {
  41. _client.Disconnect();
  42. }
  43. CATCH( CException, e )
  44. {
  45. //
  46. // Ignore failure to disconnect -- we'll close the
  47. // connection soon anyway.
  48. //
  49. }
  50. END_CATCH;
  51. }
  52. // Tell the world we are a real catalog ...
  53. BOOL IsNullCatalog()
  54. {
  55. return FALSE;
  56. }
  57. unsigned WorkIdToPath ( WORKID wid, CFunnyPath& funnyPath )
  58. { Win4Assert( !"Not implemented" ); return 0; }
  59. WORKID PathToWorkId( const CLowerFunnyPath & lcaseFunnyPath, const BOOL fCreate )
  60. { Win4Assert( !"Not implemented" ); return 0; }
  61. PROPID PropertyToPropId( CFullPropSpec const & ps,
  62. BOOL fCreate = FALSE )
  63. { Win4Assert( !"Not implemented" ); return 0; }
  64. ULONG_PTR BeginCacheTransaction()
  65. {
  66. CProxyMessage request( pmBeginCacheTransaction );
  67. CPMBeginCacheTransactionOut reply;
  68. DWORD cbReply;
  69. _client.DataWriteRead( &request,
  70. sizeof request,
  71. &reply,
  72. sizeof reply,
  73. cbReply );
  74. return reply.GetToken();
  75. }
  76. void SetupCache( CFullPropSpec const & ps,
  77. ULONG vt,
  78. ULONG cbMaxLen,
  79. ULONG_PTR ulToken,
  80. BOOL fCanBeModified,
  81. DWORD dwStoreLevel )
  82. {
  83. CSizeSerStream stmSize;
  84. ps.Marshall( stmSize );
  85. ULONG cbRequest = AlignBlock( sizeof CPMSetupCacheIn + stmSize.Size(),
  86. sizeof ULONG );
  87. XArray<BYTE> xRequest( cbRequest );
  88. CPMSetupCacheIn *pRequest = new( xRequest.Get() )
  89. CPMSetupCacheIn( stmSize.Size(), ulToken, vt, cbMaxLen,
  90. fCanBeModified, dwStoreLevel );
  91. CMemSerStream stmMem( pRequest->GetPS(), stmSize.Size() );
  92. ps.Marshall( stmMem );
  93. pRequest->SetCheckSum( xRequest.SizeOf() );
  94. CProxyMessage reply;
  95. DWORD cbReply;
  96. _client.DataWriteRead( pRequest,
  97. xRequest.SizeOf(),
  98. &reply,
  99. sizeof reply,
  100. cbReply );
  101. }
  102. void EndCacheTransaction( ULONG_PTR ulToken, BOOL fCommit )
  103. {
  104. CPMEndCacheTransactionIn request( ulToken, fCommit );
  105. CProxyMessage reply;
  106. DWORD cbReply;
  107. _client.DataWriteRead( &request,
  108. sizeof request,
  109. &reply,
  110. sizeof reply,
  111. cbReply );
  112. }
  113. BOOL StoreValue( WORKID wid,
  114. CFullPropSpec const & ps,
  115. CStorageVariant const & var )
  116. { Win4Assert( !"Not implemented" ); return 0; }
  117. BOOL FetchValue( WORKID wid,
  118. PROPID pid,
  119. PROPVARIANT * pbData,
  120. unsigned * pcb )
  121. { Win4Assert( !"Not implemented" ); return 0; }
  122. BOOL FetchValue( WORKID wid,
  123. CFullPropSpec const & ps,
  124. PROPVARIANT & var )
  125. { Win4Assert( !"Not implemented" ); return 0; }
  126. BOOL FetchValue( CCompositePropRecord * pRec,
  127. PROPID pid,
  128. PROPVARIANT * pbData,
  129. unsigned * pcb )
  130. { Win4Assert( !"Not implemented" ); return 0; }
  131. CCompositePropRecord * OpenValueRecord( WORKID wid, BYTE * pb )
  132. { Win4Assert( !"Not implemented" ); return 0; }
  133. void CloseValueRecord( CCompositePropRecord * pRec )
  134. { Win4Assert( !"Not implemented" ); }
  135. BOOL StoreSecurity( WORKID wid,
  136. PSECURITY_DESCRIPTOR pSD,
  137. ULONG cbSD )
  138. { Win4Assert( !"Not implemented" ); return 0; }
  139. SDID FetchSDID( CCompositePropRecord * pRec,
  140. WORKID wid )
  141. { Win4Assert( !"Not implemented" ); return 0; }
  142. BOOL AccessCheck( SDID sdid,
  143. HANDLE hToken,
  144. ACCESS_MASK am,
  145. BOOL & fGranted )
  146. { Win4Assert( !"Not implemented" ); return 0; }
  147. void MarkUnReachable( WORKID wid )
  148. { Win4Assert( !"Not implemented" ); }
  149. PStorage& GetStorage()
  150. { Win4Assert( !"Not implemented" ); return *(PStorage *)0; }
  151. CRWStore * ComputeRelevantWords(ULONG cRows,ULONG cRW,
  152. WORKID *pwid,
  153. PARTITIONID partid)
  154. { Win4Assert( !"Not implemented" ); return 0; }
  155. CRWStore * RetrieveRelevantWords(BOOL fAcquire,
  156. PARTITIONID partid)
  157. { Win4Assert( !"Not implemented" ); return 0; }
  158. unsigned ReserveUpdate( WORKID wid )
  159. { Win4Assert( !"Not implemented" ); return 0; }
  160. void Update( unsigned iHint,
  161. WORKID wid,
  162. PARTITIONID partid,
  163. USN usn,
  164. ULONG flags )
  165. { Win4Assert( !"Not implemented" ); }
  166. void CatalogState( ULONG & cDocuments, ULONG & cPendingScans, ULONG & fState )
  167. { Win4Assert( !"Not implemented" ); }
  168. void DisableUsnUpdate( PARTITIONID partid )
  169. { Win4Assert( !"Not implemented" ); }
  170. void EnableUsnUpdate( PARTITIONID partid )
  171. { Win4Assert( !"Not implemented" ); }
  172. void UpdateDocuments( WCHAR const* rootPath,
  173. ULONG flag=UPD_FULL )
  174. {
  175. XArray<BYTE> xRequest( CPMUpdateDocumentsIn::SizeOf( rootPath ) );
  176. CPMUpdateDocumentsIn * pRequest = new( xRequest.Get() )
  177. CPMUpdateDocumentsIn( rootPath,
  178. flag );
  179. CProxyMessage reply;
  180. DWORD cbRead;
  181. _client.DataWriteRead( pRequest,
  182. xRequest.SizeOf(),
  183. &reply,
  184. sizeof reply,
  185. cbRead );
  186. }
  187. void AddScopeToCI( WCHAR const * rootPath )
  188. {
  189. unsigned cb = CPMAddScopeIn::SizeOf( rootPath );
  190. XArray<BYTE> abRequest( cb );
  191. CPMAddScopeIn *pRequest = new( abRequest.Get() )
  192. CPMAddScopeIn( rootPath );
  193. CProxyMessage reply;
  194. DWORD cbReply;
  195. _client.DataWriteRead( pRequest,
  196. cb,
  197. &reply,
  198. sizeof reply,
  199. cbReply );
  200. }
  201. void RemoveScopeFromCI( WCHAR const * rootPath )
  202. {
  203. unsigned cb = CPMRemoveScopeIn::SizeOf( rootPath );
  204. XArray<BYTE> abRequest( cb );
  205. CPMRemoveScopeIn *pRequest = new( abRequest.Get() )
  206. CPMRemoveScopeIn( rootPath );
  207. CProxyMessage reply;
  208. DWORD cbReply;
  209. _client.DataWriteRead( pRequest,
  210. cb,
  211. &reply,
  212. sizeof reply,
  213. cbReply );
  214. }
  215. unsigned WorkIdToVirtualPath( WORKID wid,
  216. unsigned cSkip,
  217. XGrowable<WCHAR> & xBuf )
  218. {
  219. Win4Assert( !"Not implemented" );
  220. return 0;
  221. }
  222. BOOL VirtualToPhysicalRoot( WCHAR const * pwcVPath,
  223. unsigned ccVPath,
  224. XGrowable<WCHAR> & xwcsVRoot,
  225. unsigned & ccVRoot,
  226. CLowerFunnyPath & lcaseFunnyPRoot,
  227. unsigned & ccPRoot,
  228. unsigned & iBmk )
  229. { Win4Assert( !"Not implemented" ); return 0; }
  230. BOOL VirtualToAllPhysicalRoots( WCHAR const * pwcVPath,
  231. unsigned ccVPath,
  232. XGrowable<WCHAR> & xwcsVRoot,
  233. unsigned & ccVRoot,
  234. CLowerFunnyPath & lcaseFunnyPRoot,
  235. unsigned & ccPRoot,
  236. ULONG & ulType,
  237. unsigned & iBmk )
  238. { Win4Assert( !"Not implemented" ); return 0; }
  239. ULONG EnumerateVRoot( XGrowable<WCHAR> & xwcVRoot,
  240. unsigned & ccVRoot,
  241. CLowerFunnyPath & lcaseFunnyPRoot,
  242. unsigned & ccPRoot,
  243. unsigned & iBmk )
  244. { Win4Assert( !"Not implemented" ); return 0; }
  245. void SetPartition( PARTITIONID PartId )
  246. {
  247. _PartId = PartId;
  248. // send it
  249. }
  250. PARTITIONID GetPartition() const { return _PartId; }
  251. SCODE CreateContentIndex()
  252. { Win4Assert( !"Not implemented" ); return 0; }
  253. void EmptyContentIndex()
  254. { Win4Assert( !"Not implemented" ); }
  255. void Shutdown() {}
  256. NTSTATUS ForceMerge( PARTITIONID partID )
  257. {
  258. CPMForceMergeIn request( partID );
  259. CProxyMessage reply;
  260. DWORD cbRead;
  261. _client.DataWriteRead( &request,
  262. sizeof request,
  263. &reply,
  264. sizeof reply,
  265. cbRead );
  266. return STATUS_SUCCESS;
  267. }
  268. NTSTATUS AbortMerge( PARTITIONID partID )
  269. {
  270. CPMAbortMergeIn request( partID );
  271. CProxyMessage reply;
  272. DWORD cbRead;
  273. _client.DataWriteRead( &request,
  274. sizeof request,
  275. &reply,
  276. sizeof reply,
  277. cbRead );
  278. return STATUS_SUCCESS;
  279. }
  280. NTSTATUS SetCatState( PARTITIONID partID,
  281. WCHAR const * pwcsCat,
  282. DWORD dwNewState,
  283. DWORD * pdwOldState )
  284. {
  285. XArray<BYTE> xRequest( CPMSetCatStateIn::SizeOf( pwcsCat ) );
  286. CPMSetCatStateIn * pRequest = new( xRequest.Get() )
  287. CPMSetCatStateIn( partID,
  288. pwcsCat,
  289. dwNewState );
  290. CPMSetCatStateOut reply;
  291. DWORD cbRead;
  292. _client.DataWriteRead( pRequest,
  293. xRequest.SizeOf(),
  294. &reply,
  295. sizeof reply,
  296. cbRead );
  297. *pdwOldState = reply.GetOldState();
  298. return STATUS_SUCCESS;
  299. }
  300. #if CIDBG == 1
  301. void DumpWorkId( WORKID wid, ULONG iid, BYTE * pb, ULONG cb )
  302. { Win4Assert( !"Not implemented" ); }
  303. #endif // CIDBG
  304. WCHAR * GetDriveName() { Win4Assert( !"never called" ); return 0; }
  305. void PidMapToPidRemap( const CPidMapper & pidMap,
  306. CPidRemapper & pidRemap )
  307. { Win4Assert( !"Not implemented" ); }
  308. NTSTATUS CiState( CI_STATE & state )
  309. {
  310. DWORD cbOriginal = state.cbStruct;
  311. CPMCiStateInOut request( cbOriginal );
  312. CPMCiStateInOut reply;
  313. DWORD cbReply;
  314. _client.DataWriteRead( &request,
  315. sizeof request,
  316. &reply,
  317. sizeof reply,
  318. cbReply );
  319. CI_STATE & stateOut = reply.GetState();
  320. Win4Assert( stateOut.cbStruct <= sizeof CI_STATE );
  321. Win4Assert( stateOut.cbStruct <= cbOriginal );
  322. RtlZeroMemory( &state, cbOriginal );
  323. RtlCopyMemory( &state,
  324. &stateOut,
  325. stateOut.cbStruct );
  326. return STATUS_SUCCESS;
  327. }
  328. void FlushScanStatus()
  329. { Win4Assert( !"Not implemented" ); }
  330. BOOL IsEligibleForFiltering( WCHAR const* wcsDirPath )
  331. { Win4Assert( !"Not implemented" ); return 0; }
  332. CCiRegParams * GetRegParams() { Win4Assert( !"not implemented" ); return 0; }
  333. CScopeFixup * GetScopeFixup() { Win4Assert( !"not implemented" ); return 0; }
  334. private:
  335. PARTITIONID _PartId;
  336. CRequestClient _client;
  337. };