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.

778 lines
26 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1999.
  5. //
  6. // File: dslookup.cxx
  7. //
  8. // Contents: DocStoreLookUp code
  9. //
  10. // Classes: CClientDocStoreLocator
  11. //
  12. // History: 1-16-97 srikants Created
  13. //
  14. //----------------------------------------------------------------------------
  15. #include <pch.cxx>
  16. #pragma hdrstop
  17. // for definition of CRequestQueue
  18. #include <query.hxx>
  19. #include <srequest.hxx>
  20. #include <dslookup.hxx>
  21. #include <dbprputl.hxx>
  22. #include <catarray.hxx>
  23. #include <docstore.hxx>
  24. #include <imprsnat.hxx>
  25. #include <lang.hxx>
  26. #include <ciole.hxx>
  27. #include <fsci.hxx>
  28. #include <acinotfy.hxx>
  29. #include <cicat.hxx>
  30. #include <regacc.hxx>
  31. #include <ciregkey.hxx>
  32. #include <drvnotif.hxx>
  33. #include <driveinf.hxx>
  34. #include <regscp.hxx>
  35. #include <catreg.hxx>
  36. #include <removcat.hxx>
  37. extern CCatArray Catalogs;
  38. extern void OpenCatalogsInRegistry( BOOL fOpenForReadyOnly = FALSE );
  39. //+---------------------------------------------------------------------------
  40. //
  41. // Member: CClientDocStore::QueryInterface
  42. //
  43. // Synopsis: Supports IID_IUnknown
  44. // IID_ICiCDocStoreLocator
  45. //
  46. // History: 12-03-96 srikants Created
  47. //
  48. //----------------------------------------------------------------------------
  49. STDMETHODIMP CClientDocStoreLocator::QueryInterface(
  50. REFIID riid,
  51. void **ppvObject)
  52. {
  53. Win4Assert( 0 != ppvObject );
  54. if ( IID_ICiCDocStoreLocator == riid )
  55. *ppvObject = (void *)((ICiCDocStoreLocator *)this);
  56. else if ( IID_IUnknown == riid )
  57. *ppvObject = (void *)((IUnknown *) (ICiCDocStore *)this);
  58. else
  59. {
  60. *ppvObject = 0;
  61. return E_NOINTERFACE;
  62. }
  63. AddRef();
  64. return S_OK;
  65. } //QueryInterface
  66. //+---------------------------------------------------------------------------
  67. //
  68. // Member: CClientDocStoreLocator::AddRef
  69. //
  70. // History: 12-03-96 srikants Created
  71. //
  72. //----------------------------------------------------------------------------
  73. STDMETHODIMP_(ULONG) CClientDocStoreLocator::AddRef()
  74. {
  75. return InterlockedIncrement(&_refCount);
  76. } //AddRef
  77. //+---------------------------------------------------------------------------
  78. //
  79. // Member: CClientDocStoreLocator::Release
  80. //
  81. // History: 12-03-96 srikants Created
  82. //
  83. //----------------------------------------------------------------------------
  84. STDMETHODIMP_(ULONG) CClientDocStoreLocator::Release()
  85. {
  86. Win4Assert( _refCount > 0 );
  87. ciDebugOut(( DEB_ITRACE, "DocStoreLocator::Release.. _refCount == %d\n", _refCount ));
  88. LONG refCount = InterlockedDecrement(&_refCount);
  89. if ( refCount <= 0 )
  90. delete this;
  91. return refCount;
  92. } //Release
  93. //+---------------------------------------------------------------------------
  94. //
  95. // Member: CClientDocStoreLocator::LookUpDocStore
  96. //
  97. // Synopsis: Locates the docStore that is specified in the db properties
  98. // and returns its pointer (if located).
  99. //
  100. // Arguments: [pIDBProperties] -
  101. // [ppICiCDocStore] -
  102. // [fMustAlreadyExist] -- If TRUE, the docstore must already
  103. // be opened, or the call fails.
  104. //
  105. // Returns: S_OK if found;
  106. // CI_E_DOCSTORE_NOT_FOUND if not located.
  107. //
  108. // History: 1-16-97 srikants Created
  109. //
  110. //----------------------------------------------------------------------------
  111. STDMETHODIMP CClientDocStoreLocator::LookUpDocStore(
  112. IDBProperties * pIDBProperties,
  113. ICiCDocStore ** ppICiCDocStore,
  114. BOOL fMustAlreadyExist )
  115. {
  116. SCODE sc = S_OK;
  117. TRY
  118. {
  119. CGetDbProps connectProps;
  120. connectProps.GetProperties( pIDBProperties,
  121. CGetDbProps::eCatalog|
  122. CGetDbProps::eScopesAndDepths );
  123. // if a catalog was passed (as a guess or actual), try to open it
  124. WCHAR const * pwcCatalog = connectProps.GetCatalog();
  125. //
  126. // Prevent a hacker from passing a bogus path name -- we trash
  127. // stack and/or AV in this circumstance!
  128. //
  129. if ( 0 == pwcCatalog )
  130. THROW( CException( CI_E_NOT_FOUND ) );
  131. unsigned cwc = wcslen( pwcCatalog );
  132. if ( ( 0 == cwc ) || ( cwc >= ( MAX_PATH - 1 ) ) )
  133. THROW( CException( CI_E_NOT_FOUND ) );
  134. CClientDocStore * pDocStore = 0;
  135. if ( 0 != pwcCatalog )
  136. pDocStore = Catalogs.GetDocStore( pwcCatalog, fMustAlreadyExist );
  137. if ( 0 != pDocStore )
  138. {
  139. sc = pDocStore->QueryInterface( IID_ICiCDocStore,
  140. (void **) ppICiCDocStore );
  141. }
  142. else
  143. {
  144. // special case: adminstration connection without a docstore associated
  145. if ( !wcscmp(CIADMIN, pwcCatalog) )
  146. {
  147. ciDebugOut(( DEB_ITRACE,
  148. "CClientDocStoreLocator::LookUpDocStore.. ADMINSTRATION connection is requested\n" ));
  149. sc = CI_S_NO_DOCSTORE;
  150. }
  151. else
  152. sc = CI_E_NOT_FOUND;
  153. }
  154. }
  155. CATCH( CException,e )
  156. {
  157. sc = e.GetErrorCode();
  158. }
  159. END_CATCH
  160. return sc;
  161. } //LookUpDocStore
  162. //+---------------------------------------------------------------------------
  163. //
  164. // Member: CClientDocStoreLocator::Shutdown
  165. //
  166. // Synopsis: Shuts down the content index by closing all open catalogs.
  167. //
  168. // History: 1-29-97 srikants Created
  169. //
  170. //----------------------------------------------------------------------------
  171. STDMETHODIMP CClientDocStoreLocator::Shutdown()
  172. {
  173. ciDebugOut(( DEB_ITRACE, "DocStoreLocator::Shutdown is called\n" ));
  174. return FsCiShutdown();
  175. }
  176. //+---------------------------------------------------------------------------
  177. //
  178. // Function: FsCiShutdown
  179. //
  180. // Synopsis: Does shutdown processing for the FsCi component.
  181. //
  182. // History: 2-27-97 srikants Created
  183. //
  184. //----------------------------------------------------------------------------
  185. SCODE FsCiShutdown()
  186. {
  187. SCODE sc = S_OK;
  188. TRY
  189. {
  190. Catalogs.Flush();
  191. CCiOle::Shutdown();
  192. g_LogonList.Empty();
  193. TheFrameworkClientWorkQueue.Shutdown();
  194. }
  195. CATCH( CException,e )
  196. {
  197. sc = e.GetErrorCode();
  198. // If this assert hits, we took an exception while releasing
  199. // resources, which isn't allowed to happen. It's a bug elsewhere.
  200. Win4Assert( !"FsCiShutdown failed, and it isn't allowed to" );
  201. }
  202. END_CATCH
  203. return sc;
  204. } //FsCiShutdown
  205. //+-------------------------------------------------------------------------
  206. //
  207. // Member: CClientDocStoreLocator::OpenAllDocStores
  208. //
  209. // Synopsis: Opens all the catalogs in the registry
  210. //
  211. // History: 06-May-98 kitmanh Created.
  212. //
  213. //--------------------------------------------------------------------------
  214. STDMETHODIMP CClientDocStoreLocator::OpenAllDocStores()
  215. {
  216. SCODE sc = S_OK;
  217. TRY
  218. {
  219. OpenCatalogsInRegistry();
  220. }
  221. CATCH( CException,e )
  222. {
  223. sc = e.GetErrorCode();
  224. }
  225. END_CATCH
  226. return sc;
  227. } //OpenAllDocStores
  228. //+-------------------------------------------------------------------------
  229. //
  230. // Member: CClientDocStoreLocator::GetDocStoreState
  231. //
  232. // Synopsis: Gets the state of a docstore
  233. // (used when restarting a stopped catalog) or the directory is
  234. // unwritable
  235. //
  236. // Arguments: [pwcDocStore] -- Name of the catalog
  237. // [ppICiDocStore] -- Returns the docstore
  238. // [pdwState] -- Returns the state
  239. //
  240. // History: 06-May-98 kitmanh Created.
  241. //
  242. //--------------------------------------------------------------------------
  243. STDMETHODIMP CClientDocStoreLocator::GetDocStoreState(
  244. WCHAR const * pwcDocStore,
  245. ICiCDocStore ** ppICiCDocStore,
  246. DWORD * pdwState )
  247. {
  248. SCODE sc = S_OK;
  249. TRY
  250. {
  251. if ( Catalogs.IsCatStopped( pwcDocStore ) )
  252. {
  253. *pdwState = CICAT_STOPPED;
  254. sc = CI_S_CAT_STOPPED;
  255. return sc;
  256. }
  257. CClientDocStore * pDocStore = 0;
  258. if ( 0 != pwcDocStore )
  259. pDocStore = Catalogs.GetDocStore( pwcDocStore );
  260. if ( 0 != pDocStore )
  261. {
  262. Win4Assert( pDocStore );
  263. // get the interface
  264. sc = pDocStore->QueryInterface( IID_ICiCDocStore,
  265. (void **) ppICiCDocStore );
  266. // get the oldstate and flag
  267. CiCat * pCiCat = pDocStore->GetCiCat();
  268. // Is this the null catalog?
  269. if ( 0 == pCiCat )
  270. THROW( CException( CI_E_NOT_FOUND ) );
  271. if ( pCiCat->IsReadOnly() )
  272. {
  273. ciDebugOut(( DEB_ITRACE, "CClientDocStoreLocator::GetDocStoreState.. CiCatReadOnly == %d\n",
  274. pCiCat->IsReadOnly() ));
  275. *pdwState = CICAT_READONLY;
  276. }
  277. else
  278. *pdwState = CICAT_WRITABLE;
  279. BOOL fNoQuery;
  280. pDocStore->IsNoQuery( &fNoQuery );
  281. if ( fNoQuery )
  282. *pdwState |= CICAT_NO_QUERY;
  283. }
  284. else
  285. sc = CI_E_NOT_FOUND; //or some other error?
  286. }
  287. CATCH( CException, e )
  288. {
  289. sc = e.GetErrorCode();
  290. }
  291. END_CATCH
  292. return sc;
  293. } //GetDocStoreState
  294. BOOL IsDirectoryWritable( WCHAR const * pwcPath );
  295. //+-------------------------------------------------------------------------
  296. //
  297. // Member: CClientDocStoreLocator::IsMarkedReadOnly
  298. //
  299. // Synopsis: Check if the catalog is marked for readonly in the registry
  300. // (used when restarting a stopped catalog) or the directory is
  301. // unwritable
  302. //
  303. // Arguments: [wcsCat] -- Name of the catalog
  304. // [pfReadOnly] -- output
  305. //
  306. // History: 06-May-98 kitmanh Created.
  307. //
  308. //--------------------------------------------------------------------------
  309. STDMETHODIMP CClientDocStoreLocator::IsMarkedReadOnly( WCHAR const * wcsCat, BOOL * pfReadOnly )
  310. {
  311. SCODE sc = S_OK;
  312. TRY
  313. {
  314. unsigned cwcNeeded = wcslen( wcsRegJustCatalogsSubKey );
  315. cwcNeeded += 2; // "\\" + null termination
  316. cwcNeeded += wcslen( wcsCat );
  317. XArray<WCHAR> xKey( cwcNeeded );
  318. wcscpy( xKey.Get(), wcsRegJustCatalogsSubKey );
  319. wcscat( xKey.Get(), L"\\" );
  320. wcscat( xKey.Get(), wcsCat );
  321. CRegAccess reg( RTL_REGISTRY_CONTROL, xKey.Get() );
  322. BOOL fReadOnly = FALSE;
  323. *pfReadOnly = reg.Read(wcsIsReadOnly, fReadOnly );
  324. ciDebugOut(( DEB_ITRACE, "IsMarkedReadOnly is %d\n", *pfReadOnly ));
  325. }
  326. CATCH( CException,e )
  327. {
  328. sc = e.GetErrorCode();
  329. }
  330. END_CATCH
  331. return sc;
  332. } //IsMarkedReadOnly
  333. //+-------------------------------------------------------------------------
  334. //
  335. // Member: IsVolumeOrDirRO
  336. //
  337. // Synopsis: Check if the volume and the directory are unwritable
  338. //
  339. // Arguments: [wcsCat] -- Name of the catalog
  340. // [pfReadOnly] -- output
  341. //
  342. // History: 07-May-98 kitmanh Created.
  343. //
  344. //--------------------------------------------------------------------------
  345. STDMETHODIMP CClientDocStoreLocator::IsVolumeOrDirRO( WCHAR const * wcsCat,
  346. BOOL * pfReadOnly )
  347. {
  348. SCODE sc = S_OK;
  349. *pfReadOnly = FALSE;
  350. TRY
  351. {
  352. WCHAR wcsKey[MAX_PATH];
  353. wcscpy( wcsKey, wcsRegCatalogsSubKey );
  354. wcscat( wcsKey, L"\\" );
  355. unsigned cwc = wcslen( wcsKey ) + wcslen( wcsCat );
  356. if ( cwc >= MAX_PATH )
  357. THROW( CException( E_INVALIDARG ) );
  358. wcscat( wcsKey, wcsCat );
  359. HKEY hKey;
  360. if ( ERROR_SUCCESS == RegOpenKeyEx( HKEY_LOCAL_MACHINE,
  361. wcsKey,
  362. 0,
  363. KEY_QUERY_VALUE,
  364. &hKey ) )
  365. {
  366. SRegKey xKey( hKey );
  367. WCHAR awcPath[MAX_PATH];
  368. DWORD cbPath = sizeof awcPath;
  369. if ( ERROR_SUCCESS == RegQueryValueEx( hKey,
  370. wcsCatalogLocation,
  371. 0,
  372. 0,
  373. (BYTE *)awcPath,
  374. &cbPath ) )
  375. {
  376. CDriveInfo driveInfo ( awcPath, 0 );
  377. wcscat( awcPath, L"Catalog.wci" ); //is there a constant for this?
  378. ciDebugOut(( DEB_ITRACE, "IsVolumeOrDirRO.. awcPath == %ws\n", awcPath ));
  379. ciDebugOut(( DEB_ITRACE, "Volume Writeprotected is %d\n", driveInfo.IsWriteProtected() ));
  380. ciDebugOut(( DEB_ITRACE, "Diretory Writable is %d\n", IsDirectoryWritable( awcPath ) ));
  381. *pfReadOnly = ( driveInfo.IsWriteProtected() || !( IsDirectoryWritable( awcPath ) ) );
  382. }
  383. }
  384. }
  385. CATCH( CException,e )
  386. {
  387. sc = e.GetErrorCode();
  388. }
  389. END_CATCH
  390. return sc;
  391. } //IsVolumeOrDirRO
  392. //+---------------------------------------------------------------------------
  393. //
  394. // Member: StopCatalogsOnVol
  395. //
  396. // Synopsis: Stops all catalogs on the volume specified.
  397. //
  398. // Arguments: [wcVol] -- Volume letter
  399. // [pRequestQ] -- Pointer to the RequestQueue
  400. //
  401. // History: 07-05-98 kitmanh Created
  402. // 07-20-98 kitmanh Stop the catalogs with scopes on
  403. // volume being locked too
  404. //
  405. //----------------------------------------------------------------------------
  406. STDMETHODIMP CClientDocStoreLocator::StopCatalogsOnVol( WCHAR wcVol,
  407. void * pRequestQ )
  408. {
  409. ciDebugOut(( DEB_ITRACE, "StopCatalogsOnVol %wc\n", wcVol ));
  410. //enumerate reg to find out who needs to stop
  411. //add a workitem for all of them
  412. ciDebugOut(( DEB_ITRACE, "StopCatalogsOnVol is called\n" ));
  413. Win4Assert( 0 != pRequestQ );
  414. CRequestQueue * pRequestQueue = (CRequestQueue *)pRequestQ;
  415. SCWorkItem newItem;
  416. HKEY hKey;
  417. SCODE sc = S_OK;
  418. BOOL fFiledWorkItem = FALSE;
  419. TRY
  420. {
  421. if ( ERROR_SUCCESS == RegOpenKeyEx( HKEY_LOCAL_MACHINE,
  422. wcsRegCatalogsSubKey,
  423. 0,
  424. KEY_QUERY_VALUE |
  425. KEY_ENUMERATE_SUB_KEYS,
  426. &hKey ) )
  427. {
  428. SRegKey xKey( hKey );
  429. DWORD iSubKey = 0;
  430. do
  431. {
  432. FILETIME ft;
  433. WCHAR awcName[MAX_PATH];
  434. DWORD cwcName = sizeof awcName / sizeof WCHAR;
  435. LONG err = RegEnumKeyEx( hKey,
  436. iSubKey,
  437. awcName,
  438. &cwcName,
  439. 0, 0, 0, &ft );
  440. // either error or end of enumeration
  441. if ( ERROR_SUCCESS != err )
  442. break;
  443. iSubKey++;
  444. HKEY hCatName;
  445. if ( ERROR_SUCCESS == RegOpenKeyEx( hKey,
  446. awcName,
  447. 0,
  448. KEY_QUERY_VALUE,
  449. &hCatName ) )
  450. {
  451. // enumerate the location registries
  452. SRegKey xCatNameKey( hCatName );
  453. // Check if the catalog is inactive and can be ignored
  454. WCHAR awcKey[MAX_PATH];
  455. wcscpy( awcKey, wcsRegJustCatalogsSubKey );
  456. wcscat( awcKey, L"\\" );
  457. unsigned cwc = wcslen( awcKey ) + wcslen( awcName );
  458. if ( cwc >= MAX_PATH )
  459. THROW( CException( E_INVALIDARG ) );
  460. wcscat( awcKey, awcName );
  461. CRegAccess reg( RTL_REGISTRY_CONTROL, awcKey );
  462. BOOL fInactive = reg.Read( wcsCatalogInactive,
  463. CI_CATALOG_INACTIVE_DEFAULT );
  464. BOOL fIsAutoMount = reg.Read( wcsIsRemovableCatalog, (ULONG) FALSE );
  465. if ( !fInactive )
  466. {
  467. WCHAR awcPath[MAX_PATH];
  468. DWORD cbPath = sizeof awcPath;
  469. if ( ERROR_SUCCESS == RegQueryValueEx( hCatName,
  470. wcsCatalogLocation,
  471. 0,
  472. 0,
  473. (BYTE *)awcPath,
  474. &cbPath ) )
  475. {
  476. if ( toupper(awcPath[0]) == toupper(wcVol) )
  477. {
  478. //check old state of docstore
  479. DWORD dwOldState;
  480. XInterface<ICiCDocStore> xDocStore;
  481. sc = GetDocStoreState( awcName,
  482. xDocStore.GetPPointer(),
  483. &dwOldState );
  484. if ( SUCCEEDED(sc) )
  485. {
  486. ciDebugOut(( DEB_ITRACE, "StopCatalogsOnVol: dwOldState is %d for catalog %ws\n",
  487. dwOldState, awcName ));
  488. if ( 0 == (CICAT_STOPPED & dwOldState) )
  489. {
  490. ciDebugOut(( DEB_ITRACE, "CATALOG %ws WAS NOT STOPPED BEFORE\n", awcName ));
  491. ciDebugOut(( DEB_ITRACE, "Add old state %d\n", dwOldState ));
  492. if ( !fIsAutoMount )
  493. Catalogs.AddStoppedCat( dwOldState, awcName, wcVol );
  494. newItem.type = eStopCat;
  495. newItem.pDocStore = xDocStore.GetPointer();
  496. pRequestQueue->AddSCItem( &newItem , 0 );
  497. fFiledWorkItem = TRUE;
  498. }
  499. else
  500. {
  501. ciDebugOut(( DEB_ITRACE, "CATALOG %ws WAS STOPPED BEFORE\n", awcName ));
  502. BOOL fSucceeded = Catalogs.IncStopCount( awcName, wcVol );
  503. Win4Assert( fSucceeded );
  504. }
  505. }
  506. }
  507. else // enumerate the scopes to see if this catalog needs to stop
  508. {
  509. unsigned cwcNeeded = wcslen( wcsRegJustCatalogsSubKey );
  510. cwcNeeded += 3; // "\\" x 2 + null termination
  511. cwcNeeded += wcslen( awcName );
  512. cwcNeeded += wcslen( wcsCatalogScopes );
  513. XArray<WCHAR> xKey( cwcNeeded );
  514. wcscpy( xKey.Get(), wcsRegJustCatalogsSubKey );
  515. wcscat( xKey.Get(), L"\\" );
  516. wcscat( xKey.Get(), awcName );
  517. wcscat( xKey.Get(), L"\\" );
  518. wcscat( xKey.Get(), wcsCatalogScopes );
  519. CRegAccess regScopes( RTL_REGISTRY_CONTROL, xKey.Get() );
  520. CRegistryScopesCallBackToDismount callback( wcVol );
  521. regScopes.EnumerateValues( 0, callback );
  522. if ( callback.WasFound() )
  523. {
  524. //check old state of docstore
  525. DWORD dwOldState;
  526. XInterface<ICiCDocStore> xDocStore;
  527. sc = GetDocStoreState( awcName,
  528. xDocStore.GetPPointer(),
  529. &dwOldState );
  530. if ( SUCCEEDED(sc) )
  531. {
  532. if ( 0 == (CICAT_STOPPED & dwOldState) )
  533. {
  534. ciDebugOut(( DEB_ITRACE, "CATALOG %ws WAS NOT STOPPED BEFORE\n", awcName ));
  535. ciDebugOut(( DEB_ITRACE, "Creating an SCItem\n" ));
  536. if ( !fIsAutoMount )
  537. Catalogs.AddStoppedCat( dwOldState, awcName, wcVol );
  538. newItem.type = eStopCat;
  539. newItem.pDocStore = xDocStore.GetPointer();
  540. pRequestQueue->AddSCItem( &newItem , 0 );
  541. fFiledWorkItem = TRUE;
  542. }
  543. else
  544. {
  545. ciDebugOut(( DEB_ITRACE, "CATALOG %ws WAS STOPPED BEFORE\n", awcName ));
  546. BOOL fSucceeded = Catalogs.IncStopCount( awcName, wcVol );
  547. Win4Assert( fSucceeded );
  548. }
  549. }
  550. }
  551. }
  552. }
  553. }
  554. }
  555. } while ( TRUE );
  556. }
  557. //
  558. // If we filed a workitem to close a temporary catalog, delete
  559. // its registry entries.
  560. //
  561. if ( fFiledWorkItem )
  562. {
  563. //
  564. // If this is an auto-mount catalog, delete the temporary
  565. // registry entries.
  566. //
  567. if ( IsRemovableDrive( wcVol ) )
  568. {
  569. CRemovableCatalog cat( wcVol );
  570. cat.Destroy();
  571. }
  572. }
  573. else
  574. {
  575. ciDebugOut(( DEB_ITRACE, "no catalogs to stop on %wc\n", wcVol ));
  576. //
  577. // File a fake work item so we don't force closeed connections on
  578. // all docstores. Otherwise queries will be aborted for no
  579. // reason.
  580. //
  581. newItem.type = eNoCatWork;
  582. newItem.pDocStore = (ICiCDocStore*)(~0);
  583. pRequestQueue->AddSCItem( &newItem , 0 );
  584. }
  585. }
  586. CATCH( CException,e )
  587. {
  588. sc = e.GetErrorCode();
  589. }
  590. END_CATCH
  591. return sc;
  592. } //StopCatalogsOnVol
  593. //+---------------------------------------------------------------------------
  594. //
  595. // Member: CClientDocStoreLocator::StartCatalogsOnVol
  596. //
  597. // Synopsis: Restore all catalogs on the volume specified to its previous
  598. // state before the volume was locked.
  599. //
  600. // Arguments: [wcVol] -- Volume letter
  601. // [pRequestQ] -- Pointer to the RequestQueue
  602. //
  603. // History: 07-07-98 kitmanh Created
  604. // 07-23-98 kitmanh Restores catalogs from StoppedArray,
  605. // instead of enumerating registry
  606. // 09-03-98 kitmanh Delegated the work to CatArray
  607. //
  608. //----------------------------------------------------------------------------
  609. STDMETHODIMP CClientDocStoreLocator::StartCatalogsOnVol( WCHAR wcVol,
  610. void * pRequestQ )
  611. {
  612. Win4Assert( 0 != pRequestQ );
  613. CRequestQueue * pRequestQueue = (CRequestQueue *)pRequestQ;
  614. SCODE sc = S_OK;
  615. TRY
  616. {
  617. Catalogs.StartCatalogsOnVol( wcVol, pRequestQueue );
  618. }
  619. CATCH( CException,e )
  620. {
  621. sc = e.GetErrorCode();
  622. }
  623. END_CATCH
  624. return sc;
  625. } //StartCatalogsOnVol
  626. //+-------------------------------------------------------------------------
  627. //
  628. // Member: CClientDocStoreLocator::AddStoppedCat, public
  629. //
  630. // Synopsis: Add an item of COldCatState into the _aStopCatalogs array
  631. //
  632. // Arguments: [dwOldState] -- Old state of a docstore
  633. // [wcsCatName] -- Catalog name of the docstore
  634. //
  635. // History: 16-July-98 KitmanH Created
  636. //
  637. //--------------------------------------------------------------------------
  638. STDMETHODIMP CClientDocStoreLocator::AddStoppedCat( DWORD dwOldState,
  639. WCHAR const * wcsCatName )
  640. {
  641. SCODE sc = S_OK;
  642. TRY
  643. {
  644. Catalogs.AddStoppedCat( dwOldState, wcsCatName, 0 );
  645. }
  646. CATCH( CException,e )
  647. {
  648. sc = e.GetErrorCode();
  649. }
  650. END_CATCH
  651. return sc;
  652. } //AddStoppedCat