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.

396 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. THROW( CException( STATUS_NOT_IMPLEMENTED ) );
  204. }
  205. unsigned WorkIdToVirtualPath( WORKID wid,
  206. unsigned cSkip,
  207. XGrowable<WCHAR> & xBuf )
  208. {
  209. Win4Assert( !"Not implemented" );
  210. return 0;
  211. }
  212. BOOL VirtualToPhysicalRoot( WCHAR const * pwcVPath,
  213. unsigned ccVPath,
  214. XGrowable<WCHAR> & xwcsVRoot,
  215. unsigned & ccVRoot,
  216. CLowerFunnyPath & lcaseFunnyPRoot,
  217. unsigned & ccPRoot,
  218. unsigned & iBmk )
  219. { Win4Assert( !"Not implemented" ); return 0; }
  220. BOOL VirtualToAllPhysicalRoots( WCHAR const * pwcVPath,
  221. unsigned ccVPath,
  222. XGrowable<WCHAR> & xwcsVRoot,
  223. unsigned & ccVRoot,
  224. CLowerFunnyPath & lcaseFunnyPRoot,
  225. unsigned & ccPRoot,
  226. ULONG & ulType,
  227. unsigned & iBmk )
  228. { Win4Assert( !"Not implemented" ); return 0; }
  229. ULONG EnumerateVRoot( XGrowable<WCHAR> & xwcVRoot,
  230. unsigned & ccVRoot,
  231. CLowerFunnyPath & lcaseFunnyPRoot,
  232. unsigned & ccPRoot,
  233. unsigned & iBmk )
  234. { Win4Assert( !"Not implemented" ); return 0; }
  235. void SetPartition( PARTITIONID PartId )
  236. {
  237. _PartId = PartId;
  238. // send it
  239. }
  240. PARTITIONID GetPartition() const { return _PartId; }
  241. SCODE CreateContentIndex()
  242. { Win4Assert( !"Not implemented" ); return 0; }
  243. void EmptyContentIndex()
  244. { Win4Assert( !"Not implemented" ); }
  245. void Shutdown() {}
  246. NTSTATUS ForceMerge( PARTITIONID partID )
  247. {
  248. CPMForceMergeIn request( partID );
  249. CProxyMessage reply;
  250. DWORD cbRead;
  251. _client.DataWriteRead( &request,
  252. sizeof request,
  253. &reply,
  254. sizeof reply,
  255. cbRead );
  256. return STATUS_SUCCESS;
  257. }
  258. NTSTATUS AbortMerge( PARTITIONID partID )
  259. {
  260. CPMAbortMergeIn request( partID );
  261. CProxyMessage reply;
  262. DWORD cbRead;
  263. _client.DataWriteRead( &request,
  264. sizeof request,
  265. &reply,
  266. sizeof reply,
  267. cbRead );
  268. return STATUS_SUCCESS;
  269. }
  270. NTSTATUS SetCatState( PARTITIONID partID,
  271. WCHAR const * pwcsCat,
  272. DWORD dwNewState,
  273. DWORD * pdwOldState )
  274. {
  275. XArray<BYTE> xRequest( CPMSetCatStateIn::SizeOf( pwcsCat ) );
  276. CPMSetCatStateIn * pRequest = new( xRequest.Get() )
  277. CPMSetCatStateIn( partID,
  278. pwcsCat,
  279. dwNewState );
  280. CPMSetCatStateOut reply;
  281. DWORD cbRead;
  282. _client.DataWriteRead( pRequest,
  283. xRequest.SizeOf(),
  284. &reply,
  285. sizeof reply,
  286. cbRead );
  287. *pdwOldState = reply.GetOldState();
  288. return STATUS_SUCCESS;
  289. }
  290. #if CIDBG == 1
  291. void DumpWorkId( WORKID wid, ULONG iid, BYTE * pb, ULONG cb )
  292. { Win4Assert( !"Not implemented" ); }
  293. #endif // CIDBG
  294. WCHAR * GetDriveName() { Win4Assert( !"never called" ); return 0; }
  295. void PidMapToPidRemap( const CPidMapper & pidMap,
  296. CPidRemapper & pidRemap )
  297. { Win4Assert( !"Not implemented" ); }
  298. NTSTATUS CiState( CI_STATE & state )
  299. {
  300. DWORD cbOriginal = state.cbStruct;
  301. CPMCiStateInOut request( cbOriginal );
  302. CPMCiStateInOut reply;
  303. DWORD cbReply;
  304. _client.DataWriteRead( &request,
  305. sizeof request,
  306. &reply,
  307. sizeof reply,
  308. cbReply );
  309. CI_STATE & stateOut = reply.GetState();
  310. Win4Assert( stateOut.cbStruct <= sizeof CI_STATE );
  311. Win4Assert( stateOut.cbStruct <= cbOriginal );
  312. RtlZeroMemory( &state, cbOriginal );
  313. RtlCopyMemory( &state,
  314. &stateOut,
  315. stateOut.cbStruct );
  316. return STATUS_SUCCESS;
  317. }
  318. void FlushScanStatus()
  319. { Win4Assert( !"Not implemented" ); }
  320. BOOL IsEligibleForFiltering( WCHAR const* wcsDirPath )
  321. { Win4Assert( !"Not implemented" ); return 0; }
  322. CCiRegParams * GetRegParams() { Win4Assert( !"not implemented" ); return 0; }
  323. CScopeFixup * GetScopeFixup() { Win4Assert( !"not implemented" ); return 0; }
  324. private:
  325. PARTITIONID _PartId;
  326. CRequestClient _client;
  327. };