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.

854 lines
26 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 2000.
  5. //
  6. // File: FDAEMON.CXX
  7. //
  8. // Contents: Filter driver
  9. //
  10. // History: 23-Mar-93 AmyA Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #include <pch.cxx>
  14. #pragma hdrstop
  15. #include <fdaemon.hxx>
  16. #include <widtab.hxx>
  17. #include <lang.hxx>
  18. #include <drep.hxx>
  19. #include <cci.hxx>
  20. #include <pfilter.hxx>
  21. #include <pageman.hxx>
  22. #include <propspec.hxx>
  23. #include <pidmap.hxx>
  24. #include <imprsnat.hxx>
  25. #include <frmutils.hxx>
  26. #include <ntopen.hxx>
  27. #include <ciguid.hxx>
  28. #include "fdriver.hxx"
  29. #include "ebufhdlr.hxx"
  30. #include "ikrep.hxx"
  31. #if DEVL==1
  32. void DebugPrintStatus( STATUS stat );
  33. #endif // DEVL
  34. const GUID guidHtmlMeta = HTMLMetaGuid;
  35. //+---------------------------------------------------------------------------
  36. //
  37. // Class: CDocBufferIter
  38. //
  39. // Purpose: To iterate through a docBuffer passed back from the
  40. // FilterDataReady call
  41. //
  42. //----------------------------------------------------------------------------
  43. class CDocBufferIter
  44. {
  45. public:
  46. CDocBufferIter( const BYTE *pBuffer, int cbBuffer );
  47. BOOL AtEnd();
  48. const BYTE * GetCurrent(unsigned & iDoc, ULONG & cbDoc );
  49. void Next();
  50. unsigned GetCount() const { return _iDoc; }
  51. private:
  52. const BYTE * _pCurrent;
  53. const BYTE * _pEnd;
  54. USHORT _cDocs; // Document Count
  55. USHORT _iDoc; // Current document
  56. USHORT _cbCurrDoc; // Number of bytes in the current doc
  57. };
  58. //+---------------------------------------------------------------------------
  59. //----------------------------------------------------------------------------
  60. CDocBufferIter::CDocBufferIter(const BYTE *pBuffer, int cbBuffer) :
  61. _pCurrent(pBuffer+sizeof USHORT),
  62. _pEnd(pBuffer+cbBuffer),
  63. _iDoc(0),
  64. _cbCurrDoc(0)
  65. {
  66. Win4Assert( cbBuffer >= sizeof USHORT );
  67. RtlCopyMemory( &_cDocs, pBuffer, sizeof USHORT );
  68. Win4Assert( _cDocs <= CI_MAX_DOCS_IN_WORDLIST );
  69. //
  70. // Setup for the first document.
  71. //
  72. if ( _cDocs > 0 )
  73. {
  74. Win4Assert( _pCurrent + sizeof USHORT <= _pEnd );
  75. RtlCopyMemory( &_cbCurrDoc, _pCurrent, sizeof USHORT );
  76. _pCurrent += sizeof USHORT;
  77. }
  78. }
  79. //+---------------------------------------------------------------------------
  80. //----------------------------------------------------------------------------
  81. BOOL CDocBufferIter::AtEnd()
  82. {
  83. Win4Assert( _iDoc <= _cDocs );
  84. Win4Assert( _pCurrent <= _pEnd );
  85. return (_iDoc == _cDocs);
  86. }
  87. //+---------------------------------------------------------------------------
  88. //----------------------------------------------------------------------------
  89. const BYTE * CDocBufferIter::GetCurrent(unsigned & iDoc, ULONG & cbDoc )
  90. {
  91. Win4Assert( !AtEnd() );
  92. iDoc = _iDoc; // Number of current document
  93. Win4Assert( iDoc < CI_MAX_DOCS_IN_WORDLIST );
  94. cbDoc = _cbCurrDoc;
  95. return _pCurrent;
  96. }
  97. //+---------------------------------------------------------------------------
  98. //----------------------------------------------------------------------------
  99. void CDocBufferIter::Next()
  100. {
  101. //
  102. // Setup next document
  103. //
  104. if ( !AtEnd() )
  105. {
  106. _pCurrent += _cbCurrDoc;
  107. if ( _pCurrent < _pEnd )
  108. {
  109. Win4Assert( _pCurrent + sizeof USHORT <= _pEnd );
  110. RtlCopyMemory( &_cbCurrDoc, _pCurrent, sizeof USHORT );
  111. _pCurrent += sizeof USHORT;
  112. }
  113. else
  114. {
  115. Win4Assert( _pCurrent == _pEnd );
  116. _cbCurrDoc = 0;
  117. }
  118. _iDoc++;
  119. }
  120. }
  121. //+---------------------------------------------------------------------------
  122. //
  123. // Member: CFilterDaemon::CFilterDaemon, public
  124. //
  125. // History: 23-Mar-93 AmyA Created.
  126. //
  127. //----------------------------------------------------------------------------
  128. CFilterDaemon::CFilterDaemon ( CiProxy & proxy,
  129. CCiFrameworkParams & params,
  130. CLangList & LangList,
  131. BYTE * buf,
  132. ULONG cbMax,
  133. ICiCFilterClient *pICiCFilterClient )
  134. : _proxy( proxy ),
  135. _params( params ),
  136. _cFilteredDocuments( 0 ),
  137. _cFilteredBlocks( 0 ),
  138. _pbCurrentDocument( NULL ),
  139. _cbCurrentDocument( 0 ),
  140. _fStopFilter( FALSE ),
  141. _fWaitingForDocument( FALSE ),
  142. _fOwned( FALSE ),
  143. _entryBuffer( buf ),
  144. _cbMax( cbMax ),
  145. _xFilterClient( pICiCFilterClient ),
  146. _LangList( LangList ),
  147. _pidmap( &_proxy )
  148. {
  149. //
  150. // Even though we've saved pICiCFilterClient in a safe pointer, it is
  151. // NOT correctly referenced by the caller. That is our responsibility
  152. //
  153. _xFilterClient->AddRef( );
  154. //
  155. // get ICiCAdviseStatus interface pointer
  156. //
  157. SCODE sc = _xFilterClient->QueryInterface( IID_ICiCAdviseStatus, _xAdviseStatus.GetQIPointer() );
  158. if ( S_OK != sc )
  159. {
  160. THROW( CException(sc) );
  161. }
  162. //
  163. // Get optional filter status interface.
  164. //
  165. sc = _xFilterClient->QueryInterface( IID_ICiCFilterStatus, _xFilterStatus.GetQIPointer() );
  166. Win4Assert( ( SUCCEEDED(sc) && !_xFilterStatus.IsNull() ) ||
  167. ( FAILED(sc) && _xFilterStatus.IsNull() ) );
  168. //
  169. // Get config info
  170. //
  171. sc = _xFilterClient->GetConfigInfo( &_configInfo );
  172. if ( FAILED(sc) )
  173. {
  174. ciDebugOut(( DEB_ERROR, "GetConfigInfo failed. Error 0x%X\n", sc ));
  175. THROW( CException(sc) );
  176. }
  177. //
  178. //
  179. //
  180. if ( 0 == buf )
  181. {
  182. _cbMax = _params.GetFilterBufferSize() * 1024;
  183. _entryBuffer = (BYTE *)VirtualAlloc(
  184. 0, // Requested position.
  185. _cbMax, // Size (in bytes)
  186. MEM_COMMIT, // We want it now.
  187. PAGE_READWRITE ); // Full access, please.
  188. _fOwned = TRUE;
  189. }
  190. _docBuffer = (BYTE *)(CPageManager::GetPage());
  191. _cbTotal = PAGE_SIZE;
  192. }
  193. //+---------------------------------------------------------------------------
  194. //
  195. // Member: CFilterDaemon::~CFilterDaemon, public
  196. //
  197. // History: 17-May-93 AmyA Created.
  198. //
  199. //----------------------------------------------------------------------------
  200. CFilterDaemon::~CFilterDaemon()
  201. {
  202. if ( _fOwned )
  203. VirtualFree( _entryBuffer, 0, MEM_RELEASE );
  204. CPageManager::FreePage( _docBuffer );
  205. }
  206. //+---------------------------------------------------------------------------
  207. //
  208. // Member: CFilterDaemon::DoUpdates, private
  209. //
  210. // Synopsis: Filters Documents and creates word lists
  211. //
  212. // History: 18-Apr-93 AmyA Created
  213. //
  214. // Notes: This interface is exported across query.DLL, and hence can not
  215. // throw an exception. If this routine ever returns, it is
  216. // the result of an error.
  217. //
  218. //----------------------------------------------------------------------------
  219. SCODE CFilterDaemon::DoUpdates()
  220. {
  221. SCODE scode = STATUS_SUCCESS;
  222. TRY
  223. {
  224. ULONG cLoops = 0;
  225. while (STATUS_SUCCESS == scode)
  226. {
  227. cLoops++;
  228. // Trim our working set every n docs
  229. if ( 20 == cLoops )
  230. {
  231. SetProcessWorkingSetSize( GetCurrentProcess(), -1, -1 );
  232. cLoops = 0;
  233. }
  234. ULONG cbNeeded = _cbTotal;
  235. _cbHdr = sizeof(ULONG);
  236. Win4Assert( _cbTotal > _cbHdr );
  237. _cbDocBuffer = _cbTotal-_cbHdr;
  238. {
  239. CLock lock( _mutex );
  240. if ( _fStopFilter )
  241. {
  242. ciDebugOut(( DEB_ITRACE, "Quitting filtering\n" ));
  243. return STATUS_REQUEST_ABORTED;
  244. }
  245. else
  246. _fWaitingForDocument = TRUE;
  247. }
  248. scode = _proxy.FilterReady( _docBuffer, cbNeeded,
  249. CI_MAX_DOCS_IN_WORDLIST );
  250. while ( STATUS_SUCCESS == scode && cbNeeded > _cbTotal )
  251. {
  252. // need more memory
  253. CPageManager::FreePage( _docBuffer );
  254. unsigned ccPages = cbNeeded / PAGE_SIZE;
  255. if ( ccPages * PAGE_SIZE < cbNeeded )
  256. {
  257. ccPages++;
  258. }
  259. _docBuffer = (BYTE *)(CPageManager::GetPage( ccPages ));
  260. _cbTotal = cbNeeded = ccPages * PAGE_SIZE;
  261. scode = _proxy.FilterReady( _docBuffer, cbNeeded,
  262. CI_MAX_DOCS_IN_WORDLIST );
  263. }
  264. {
  265. CLock lock( _mutex );
  266. if ( _fStopFilter )
  267. {
  268. ciDebugOut(( DEB_ITRACE, "Quitting filtering\n" ));
  269. return STATUS_REQUEST_ABORTED;
  270. }
  271. else
  272. _fWaitingForDocument = FALSE;
  273. }
  274. if ( NT_SUCCESS( scode ) && (_cbTotal > _cbHdr) )
  275. {
  276. _cbDocBuffer = _cbTotal-_cbHdr;
  277. //
  278. // SLM_HACK
  279. //
  280. //
  281. // If the number of remaining documents (after this
  282. // doc buffer) is less than a threshold value,
  283. // then wait for some time before continuing
  284. //
  285. ULONG cDocsLeft;
  286. RtlCopyMemory( &cDocsLeft, _docBuffer, sizeof(ULONG) );
  287. if ( cDocsLeft < _params.GetFilterRemainingThreshold() )
  288. {
  289. ciDebugOut(( DEB_ITRACE,
  290. "CiFilterDaemon. Number of Docs Left %d < %d. Sleep %d s.\n",
  291. cDocsLeft,
  292. _params.GetFilterRemainingThreshold(),
  293. _params.GetFilterDelayInterval() ));
  294. Sleep(_params.GetFilterDelayInterval()*1000);
  295. }
  296. FilterDocs();
  297. }
  298. }
  299. }
  300. CATCH (CException, e)
  301. {
  302. scode = e.GetErrorCode();
  303. }
  304. END_CATCH
  305. return scode;
  306. }
  307. //+---------------------------------------------------------------------------
  308. //
  309. // Member: CFilterDaemon::FilterDataReady, public
  310. //
  311. // Synopsis: Sends a buffer to be added to the current word list
  312. //
  313. // Arguments:
  314. // [pEntryBuf] -- pointer to the entry buffer
  315. // [cb] -- count of bytes in the buffer
  316. //
  317. // History: 31-Mar-93 AmyA Created.
  318. //
  319. //----------------------------------------------------------------------------
  320. SCODE CFilterDaemon::FilterDataReady ( const BYTE * pEntryBuf, ULONG cb )
  321. {
  322. return _proxy.FilterDataReady ( pEntryBuf, cb );
  323. }
  324. //+---------------------------------------------------------------------------
  325. //
  326. // Member: CFilterDaemon::StopFiltering
  327. //
  328. // History: 12-Sep-93 SitaramR Created.
  329. //
  330. //----------------------------------------------------------------------------
  331. VOID CFilterDaemon::StopFiltering()
  332. {
  333. CLock lock( _mutex );
  334. _fStopFilter = TRUE;
  335. }
  336. //+---------------------------------------------------------------------------
  337. //
  338. // Member: CFilterDaemon::IsWaitingForDocument
  339. //
  340. // Returns: Whether we are waiting for documents to update
  341. //
  342. // History: 12-Sep-93 SitaramR Created.
  343. //
  344. //----------------------------------------------------------------------------
  345. BOOL CFilterDaemon::IsWaitingForDocument()
  346. {
  347. CLock lock( _mutex );
  348. return _fWaitingForDocument;
  349. }
  350. //+---------------------------------------------------------------------------
  351. //
  352. // Class: CFilterDocument
  353. //
  354. // Purpose: A class to filter a document by retrying different impersonation
  355. // contexts if necessary.
  356. //
  357. // History: 7-18-96 srikants Created
  358. //
  359. //----------------------------------------------------------------------------
  360. class CFilterDocument
  361. {
  362. public:
  363. CFilterDocument( CDataRepository & drep,
  364. CFilterDaemon & fDaemon,
  365. CCiFrameworkParams & params,
  366. CI_CLIENT_FILTER_CONFIG_INFO const & configInfo,
  367. STATUS * aStatus,
  368. ULONG iDoc,
  369. CNonStoredProps & NonStoredProps,
  370. ULONG cbBuf )
  371. : _drep(drep),
  372. _fDaemon(fDaemon),
  373. _params(params),
  374. _configInfo(configInfo),
  375. _aStatus(aStatus),
  376. _iDoc(iDoc),
  377. _NonStoredProps( NonStoredProps ),
  378. _cbBuf( cbBuf )
  379. {
  380. }
  381. ULONG DoIt();
  382. private:
  383. CDataRepository & _drep;
  384. CFilterDaemon & _fDaemon;
  385. CCiFrameworkParams & _params;
  386. CI_CLIENT_FILTER_CONFIG_INFO const & _configInfo;
  387. STATUS * _aStatus;
  388. ULONG _iDoc;
  389. CNonStoredProps & _NonStoredProps;
  390. ULONG _cbBuf;
  391. };
  392. //+---------------------------------------------------------------------------
  393. //
  394. // Member: CFilterDocument::DoIt
  395. //
  396. // Synopsis: Tries to filter the file in the current impersonation context.
  397. //
  398. // Returns: Count of bytes filtered.
  399. //
  400. // History: 7-18-96 srikants Created
  401. //
  402. //----------------------------------------------------------------------------
  403. ULONG CFilterDocument::DoIt()
  404. {
  405. CFilterDriver filterDriver ( &_drep,
  406. _fDaemon._xAdviseStatus.GetPointer( ),
  407. _fDaemon._xFilterClient.GetPointer( ),
  408. _params,
  409. _configInfo,
  410. _fDaemon._cFilteredBlocks,
  411. _NonStoredProps,
  412. _cbBuf );
  413. if ( _fDaemon._fStopFilter )
  414. {
  415. ciDebugOut(( DEB_ITRACE, "Aborting filtering\n" ));
  416. THROW( CException(STATUS_TOO_LATE) );
  417. }
  418. _aStatus[_iDoc] = filterDriver.FillEntryBuffer( _fDaemon._pbCurrentDocument,
  419. _fDaemon._cbCurrentDocument );
  420. // In case we filtered a monster file, just round down to 4 gig.
  421. if ( 0 != filterDriver.GetFileSize().HighPart )
  422. return 0xffffffff;
  423. return filterDriver.GetFileSize().LowPart;
  424. } //DoIt
  425. //+---------------------------------------------------------------------------
  426. //
  427. // Member: CFilterDaemon::FilterDocs, private
  428. //
  429. // Synopsis: Creates a Filter Driver and filters documents in _docBuffer
  430. //
  431. // History: 21-Apr-93 AmyA Created.
  432. // 05-Nov-93 DwightKr Removed PROP_ALL code - we'll determine
  433. // what to filter after opening the object
  434. //
  435. //----------------------------------------------------------------------------
  436. void CFilterDaemon::FilterDocs()
  437. {
  438. ciAssert ( _docBuffer != 0 );
  439. ciDebugOut (( DEB_ITRACE, "CFilterDaemon::FilterDocs\n" ));
  440. CEntryBufferHandler entryBufHandler ( _cbMax,
  441. _entryBuffer,
  442. *this,
  443. _proxy,
  444. _pidmap );
  445. // STACK: this is a big object.
  446. CIndexKeyRepository krep( entryBufHandler );
  447. CDataRepository drep( krep, 0, FALSE, 0, _pidmap, _LangList );
  448. STATUS aStatus [CI_MAX_DOCS_IN_WORDLIST];
  449. for( unsigned i=0; i<CI_MAX_DOCS_IN_WORDLIST; i++ ) // set array
  450. aStatus[i] = WL_IGNORE;
  451. unsigned iDoc;
  452. CDocBufferIter iter(_docBuffer+_cbHdr, _cbTotal-_cbHdr);
  453. while ( !iter.AtEnd() )
  454. {
  455. _pbCurrentDocument = iter.GetCurrent(iDoc, _cbCurrentDocument);
  456. iter.Next();
  457. Win4Assert (iDoc < CI_MAX_DOCS_IN_WORDLIST );
  458. ciDebugOut((DEB_ITRACE, "\t%2d 0x%X\n",
  459. iDocToFakeWid(iDoc), _pbCurrentDocument ));
  460. drep.PutWorkId ( iDocToFakeWid(iDoc) );
  461. _cFilteredDocuments++;
  462. _cFilteredBlocks = 0;
  463. if ( 0 == _cbCurrentDocument )
  464. {
  465. // This represents a deleted document.
  466. ciDebugOut(( DEB_IWARN, "Null document name 0x%x\n", _pbCurrentDocument ));
  467. aStatus[iDoc] = SUCCESS;
  468. continue;
  469. }
  470. BOOL fTookException = FALSE;
  471. CFwPerfTime filterTotalCounter( _xAdviseStatus.GetPointer(),
  472. CI_PERF_FILTER_TIME_TOTAL,
  473. 1024*1024, 1000*60*60 );
  474. ULONG cbLow = 0;
  475. TRY
  476. {
  477. //
  478. // Filter time in Mb / hr
  479. //
  480. filterTotalCounter.TStart();
  481. if ( !_xFilterStatus.IsNull() )
  482. {
  483. SCODE sc = _xFilterStatus->PreFilter( _pbCurrentDocument, _cbCurrentDocument );
  484. if ( FAILED(sc) )
  485. {
  486. ciDebugOut(( DEB_WARN, "Failing filtering because PreFilter returned 0x%x\n", sc ));
  487. THROW( CException( sc ) );
  488. }
  489. }
  490. //
  491. // If necessary impersonate for accessing this file
  492. //
  493. CFilterDocument filterDocument( drep,
  494. *this,
  495. _params,
  496. _configInfo,
  497. aStatus,
  498. iDoc,
  499. _NonStoredProps,
  500. _cbMax );
  501. cbLow = filterDocument.DoIt();
  502. }
  503. CATCH ( CException, e )
  504. {
  505. fTookException = TRUE;
  506. ciDebugOut(( DEB_ITRACE,
  507. "FilterDriver exception 0x%x filtering %d caught in FilterDocs.\n",
  508. e.GetErrorCode(), iDoc ));
  509. if ( !_xFilterStatus.IsNull() )
  510. _xFilterStatus->PostFilter( _pbCurrentDocument,
  511. _cbCurrentDocument,
  512. e.GetErrorCode() );
  513. if ( IsSharingViolation( e.GetErrorCode()) )
  514. {
  515. aStatus[iDoc] = CI_SHARING_VIOLATION;
  516. }
  517. else if ( IsNetDisconnect( e.GetErrorCode()) ||
  518. CI_NOT_REACHABLE == e.GetErrorCode() )
  519. {
  520. aStatus[iDoc] = CI_NOT_REACHABLE;
  521. }
  522. else
  523. {
  524. aStatus[iDoc] = FILTER_EXCEPTION;
  525. }
  526. //
  527. // Certain errors occuring while filtering are fatal. They
  528. // will cause the filter daemon to terminate.
  529. if ( (e.GetErrorCode() == FDAEMON_E_FATALERROR) ||
  530. (e.GetErrorCode() == STATUS_ACCESS_VIOLATION) ||
  531. (e.GetErrorCode() == STATUS_NO_MEMORY) ||
  532. (e.GetErrorCode() == STATUS_INSUFFICIENT_RESOURCES) ||
  533. (e.GetErrorCode() == STATUS_DATATYPE_MISALIGNMENT) ||
  534. (e.GetErrorCode() == STATUS_INSTRUCTION_MISALIGNMENT)
  535. )
  536. {
  537. RETHROW();
  538. }
  539. }
  540. END_CATCH
  541. if ( !_xFilterStatus.IsNull() && !fTookException )
  542. _xFilterStatus->PostFilter( _pbCurrentDocument,
  543. _cbCurrentDocument,
  544. S_OK );
  545. filterTotalCounter.TStop( cbLow );
  546. if ( entryBufHandler.WordListFull() ) // finish current word list
  547. {
  548. //
  549. // Does not throw
  550. //
  551. entryBufHandler.Done();
  552. #if CIDBG == 1
  553. for (unsigned j=0; j<CI_MAX_DOCS_IN_WORDLIST; j++)
  554. {
  555. DebugPrintStatus( aStatus[j] );
  556. }
  557. #endif // CIDBG == 1
  558. //
  559. // If we have filled the buffer, and there are no more documents
  560. // to filter then don't call FilterMore. Exit the loop so that
  561. // FilterDone can be called to finish this docList.
  562. //
  563. if ( iter.AtEnd() )
  564. break;
  565. SCODE scode = _proxy.FilterMore( aStatus, CI_MAX_DOCS_IN_WORDLIST );
  566. if ( FAILED(scode) )
  567. {
  568. ciDebugOut (( DEB_IERROR, "FilterMore returned with error 0x%x\n", scode ));
  569. THROW( CException( scode ) );
  570. }
  571. for( unsigned i = 0; i <= iDoc; i++ ) // reset array
  572. aStatus[i] = WL_IGNORE;
  573. entryBufHandler.Init();
  574. }
  575. } // end of for loop
  576. _pbCurrentDocument = 0;
  577. _cbCurrentDocument = 0;
  578. //
  579. // Does not throw
  580. //
  581. entryBufHandler.Done();
  582. #if CIDBG == 1
  583. for (i = 0; i < CI_MAX_DOCS_IN_WORDLIST; i++)
  584. {
  585. DebugPrintStatus(aStatus[i]);
  586. }
  587. #endif // CIDBG == 1
  588. if ( iter.GetCount() > 0 )
  589. {
  590. SCODE scode = _proxy.FilterDone( aStatus, CI_MAX_DOCS_IN_WORDLIST );
  591. if ( FAILED( scode ) )
  592. {
  593. ciDebugOut (( DEB_IERROR, "FilterDone returned with error 0x%x\n", scode ));
  594. THROW( CException( scode ) );
  595. }
  596. }
  597. }
  598. //+---------------------------------------------------------------------------
  599. //
  600. // Method: CNonStoredProps::Add
  601. //
  602. // Synopsis: Adds the property to the list of properties that shouldn't
  603. // be stored.
  604. //
  605. // Arguments: [ps] -- Property ID
  606. //
  607. // History: 9-Feb-97 dlee Created.
  608. //
  609. //----------------------------------------------------------------------------
  610. void CNonStoredProps::Add( CFullPropSpec const & ps )
  611. {
  612. if ( ( guidStorage == ps.GetPropSet() ) &&
  613. ( ps.IsPropertyPropid() ) &&
  614. ( ps.GetPropertyPropid() < CSTORAGEPROPERTY ) )
  615. {
  616. Win4Assert( ps.GetPropertyPropid() != PID_STG_SIZE );
  617. _afStgPropNonStored[ ps.GetPropertyPropid() ] = TRUE;
  618. }
  619. else if ( guidHtmlMeta == ps.GetPropSet() )
  620. {
  621. if ( _cMetaSpecs < maxCachedSpecs )
  622. _aMetaSpecs[ _cMetaSpecs++ ] = ps;
  623. }
  624. else
  625. {
  626. if ( _cSpecs < maxCachedSpecs )
  627. _aSpecs[ _cSpecs++ ] = ps;
  628. }
  629. } //Add
  630. //+---------------------------------------------------------------------------
  631. //
  632. // Method: CNonStoredProps::IsNonStored
  633. //
  634. // Synopsis: Returns TRUE if the property shouldn't be stored
  635. //
  636. // Arguments: [ps] -- Property ID
  637. //
  638. // History: 9-Feb-97 dlee Created.
  639. //
  640. //----------------------------------------------------------------------------
  641. BOOL CNonStoredProps::IsNonStored( CFullPropSpec const & ps )
  642. {
  643. if ( ( guidStorage == ps.GetPropSet() ) &&
  644. ( ps.IsPropertyPropid() ) &&
  645. ( ps.GetPropertyPropid() < CSTORAGEPROPERTY ) )
  646. {
  647. return _afStgPropNonStored[ ps.GetPropertyPropid() ];
  648. }
  649. else if ( guidHtmlMeta == ps.GetPropSet() )
  650. {
  651. for ( int x = 0; x < _cMetaSpecs; x++ )
  652. if ( ps == _aMetaSpecs[ x ] )
  653. return TRUE;
  654. }
  655. else
  656. {
  657. for ( int x = 0; x < _cSpecs; x++ )
  658. if ( ps == _aSpecs[ x ] )
  659. return TRUE;
  660. }
  661. return FALSE;
  662. } //IsNonStored
  663. #if CIDBG == 1
  664. void DebugPrintStatus( STATUS stat )
  665. {
  666. switch(stat)
  667. {
  668. case SUCCESS:
  669. // ciDebugOut((DEB_ITRACE, "Status: SUCCESS\n"));
  670. break;
  671. case PREEMPTED:
  672. ciDebugOut((DEB_ITRACE, "Status: PREEMPTED\n"));
  673. break;
  674. case BIND_FAILED:
  675. ciDebugOut((DEB_ITRACE, "Status: BIND_FAILED\n"));
  676. break;
  677. case CORRUPT_OBJECT:
  678. ciDebugOut((DEB_ITRACE, "Status: CORRUPT_OBJECT\n"));
  679. break;
  680. case MISSING_PROTOCOL:
  681. ciDebugOut((DEB_ITRACE, "Status: MISSING_PROTOCOL\n"));
  682. break;
  683. case CANNOT_OPEN_STREAM:
  684. ciDebugOut((DEB_ITRACE, "Status: CANNOT_OPEN_STREAM\n"));
  685. break;
  686. case DELETED:
  687. ciDebugOut((DEB_ITRACE, "Status: DELETED\n"));
  688. break;
  689. case ENCRYPTED:
  690. ciDebugOut((DEB_ITRACE, "Status: ENCRYPTED\n"));
  691. break;
  692. case FILTER_EXCEPTION:
  693. ciDebugOut((DEB_ITRACE, "Status: FILTER_EXCEPTION\n"));
  694. break;
  695. case OUT_OF_MEMORY:
  696. ciDebugOut((DEB_ITRACE, "Status: OUT_OF_MEMORY\n"));
  697. break;
  698. case PENDING:
  699. ciDebugOut((DEB_ITRACE, "Status: PENDING\n"));
  700. break;
  701. case WL_IGNORE:
  702. // ciDebugOut((DEB_ITRACE, "Status: WL_IGNORE\n"));
  703. break;
  704. case WL_NULL:
  705. // ciDebugOut((DEB_ITRACE, "Status: WL_NULL\n"));
  706. break;
  707. case CI_SHARING_VIOLATION:
  708. ciDebugOut(( DEB_ITRACE, "Status: CI_SHARING_VIOLATION\n" ));
  709. break;
  710. case CI_NOT_REACHABLE:
  711. ciDebugOut(( DEB_ITRACE, "Status: CI_NOT_REACHABLE\n" ));
  712. break;
  713. default:
  714. ciDebugOut((DEB_ITRACE, "This status is incorrect\n"));
  715. break;
  716. }
  717. }
  718. #endif // CIDBG == 1