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.

791 lines
26 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 2000.
  5. //
  6. // File: ciframe.cxx
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 11-22-96 srikants Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #include <pch.cxx>
  18. #pragma hdrstop
  19. #include <frmutils.hxx>
  20. #include <lang.hxx>
  21. #include <worker.hxx>
  22. #include "ciframe.hxx"
  23. //+---------------------------------------------------------------------------
  24. //
  25. // Member: CCiAdminParams::QueryInterface
  26. //
  27. // Arguments: [riid] -- Interface ID
  28. // [ppvObject] -- Object returned here
  29. //
  30. // Returns: S_OK if [riid] found.
  31. //
  32. // History: 11-27-96 srikants Created
  33. //
  34. //----------------------------------------------------------------------------
  35. STDMETHODIMP CCiAdminParams::QueryInterface(
  36. REFIID riid,
  37. void **ppvObject)
  38. {
  39. Win4Assert( 0 != ppvObject );
  40. *ppvObject = 0;
  41. if ( IID_ICiAdminParams == riid )
  42. *ppvObject = (void *)((ICiAdminParams *)this);
  43. else if ( IID_ICiAdmin == riid )
  44. *ppvObject = (void *)((ICiAdmin *)this);
  45. else if ( IID_IUnknown == riid )
  46. *ppvObject = (void *)((IUnknown *)(ICiAdminParams *)this);
  47. else
  48. return E_NOINTERFACE;
  49. AddRef();
  50. return S_OK;
  51. } //QueryInterface
  52. //+---------------------------------------------------------------------------
  53. //
  54. // Member: CCiCDocName::AddRef
  55. //
  56. // History: 11-22-96 srikants Created
  57. //
  58. //----------------------------------------------------------------------------
  59. STDMETHODIMP_(ULONG) CCiAdminParams::AddRef()
  60. {
  61. return InterlockedIncrement(&_refCount);
  62. } //AddRef
  63. //+---------------------------------------------------------------------------
  64. //
  65. // Member: CCiCDocName::Release
  66. //
  67. // History: 11-22-96 srikants Created
  68. //
  69. //----------------------------------------------------------------------------
  70. STDMETHODIMP_(ULONG) CCiAdminParams::Release()
  71. {
  72. Win4Assert( _refCount > 0 );
  73. LONG refCount = InterlockedDecrement(&_refCount);
  74. if ( refCount <= 0 )
  75. delete this;
  76. return (ULONG) refCount;
  77. } //Release
  78. //+---------------------------------------------------------------------------
  79. //
  80. // Member: CCiAdminParams::GetValue
  81. //
  82. // Synopsis: Gets the parameter value, if it is a DWORD type.
  83. //
  84. // Arguments: [param] - [in] Parameter to retrive
  85. // [pdwValue] - [out] The value of the parameter.
  86. //
  87. // Returns: S_OK if successful
  88. // E_INVALIDARG if wrong parameters.
  89. //
  90. // History: 11-27-96 srikants Created
  91. //
  92. //----------------------------------------------------------------------------
  93. STDMETHODIMP CCiAdminParams::GetValue(
  94. CI_ADMIN_PARAMS param,
  95. DWORD * pdwValue )
  96. {
  97. Win4Assert( 0 != pdwValue );
  98. if ( param < CI_AP_MAX_DWORD_VAL )
  99. {
  100. *pdwValue = (DWORD) _adwParams[ param ];
  101. return S_OK;
  102. }
  103. else
  104. {
  105. return E_INVALIDARG;
  106. }
  107. }
  108. //+---------------------------------------------------------------------------
  109. //
  110. // Member: CCiAdminParams::GetValue
  111. //
  112. // Synopsis: Gets the parameter value, if it is a DWORD type.
  113. //
  114. // Arguments: [param] - [in] Parameter to retrive
  115. // [pdwValue] - [out] The value of the parameter.
  116. //
  117. // Returns: S_OK if successful
  118. // E_INVALIDARG if wrong parameters.
  119. //
  120. // History: 10-Jun-97 KyleP Added header, MaxFileSize in KB.
  121. //
  122. //----------------------------------------------------------------------------
  123. STDMETHODIMP CCiAdminParams::GetInt64Value( CI_ADMIN_PARAMS param, __int64 * pValue )
  124. {
  125. Win4Assert( 0 != pValue );
  126. if ( !IsValidParam(param) )
  127. return E_INVALIDARG;
  128. if ( param < CI_AP_MAX_DWORD_VAL )
  129. {
  130. *pValue = _adwParams[param];
  131. }
  132. else
  133. {
  134. //
  135. // Currently, there are no non-dword values.
  136. //
  137. Win4Assert( param < CI_AP_MAX_DWORD_VAL );
  138. }
  139. return S_OK;
  140. }
  141. //+---------------------------------------------------------------------------
  142. //
  143. // Member: CCiAdminParams::SetValues
  144. //
  145. // Synopsis: calls CCiAdminParams::SetValue() for each of the property
  146. // variant values.
  147. //
  148. // Arguments: [ULONG nParams] - [in] number of elements in the array.
  149. // [PROPVARIANT *] - [in] array of property variants of
  150. // size CI_AP_MAX_VAL containing
  151. // new CI settings.
  152. // [CI_ADMIN_PARAMS *] - [in] array of CI_ADMIN_PARAMS values
  153. // used as indices in teh prop variant array.
  154. //
  155. // Returns: S_OK if successful
  156. // E_INVALIDARG if wrong parameters (returned from SetParamValue()).
  157. //
  158. // History: 1-24-97 mohamedn Created
  159. //
  160. //----------------------------------------------------------------------------
  161. STDMETHODIMP CCiAdminParams::SetValues(ULONG nParams,
  162. const PROPVARIANT * aParamVals,
  163. const CI_ADMIN_PARAMS * aParamNames)
  164. {
  165. SCODE sc = S_OK;
  166. for ( ULONG i = 0; i < nParams; i++)
  167. {
  168. switch ( aParamNames[i] )
  169. {
  170. case CI_AP_MAX_DWORD_VAL:
  171. case CI_AP_MAX_VAL:
  172. continue; // values are place holders.
  173. default:
  174. Win4Assert( aParamNames[i] < CI_AP_MAX_VAL );
  175. sc = SetParamValue( aParamNames[i], aParamVals+i );
  176. if (sc != S_OK)
  177. return sc;
  178. }
  179. }
  180. return sc;
  181. }
  182. //+---------------------------------------------------------------------------
  183. //
  184. // Member: CCiAdminParams::SetValue
  185. //
  186. // Synopsis: Sets the value of the given parameter, if it is a DWORD type.
  187. //
  188. // Arguments: [param] - [in] Parameter
  189. // [dwValue] - [in] Value to set
  190. //
  191. // Returns: S_OK if successful
  192. // E_INVALIDARG if wrong parameters.
  193. //
  194. // History: 11-27-96 srikants Created
  195. //
  196. //----------------------------------------------------------------------------
  197. STDMETHODIMP CCiAdminParams::SetValue(
  198. CI_ADMIN_PARAMS param,
  199. DWORD dwValue )
  200. {
  201. SCODE sc = S_OK;
  202. // =================================================================
  203. CLock lock(_mutex);
  204. if ( param < CI_AP_MAX_DWORD_VAL )
  205. _adwParams[param] = _GetValueInRange( param, dwValue );
  206. else
  207. sc = E_INVALIDARG;
  208. // =================================================================
  209. return sc;
  210. }
  211. //+---------------------------------------------------------------------------
  212. //
  213. // Member: CCiAdminParams::SetParamValue
  214. //
  215. // Synopsis: Sets the value of a parameter, given a DWORD
  216. //
  217. // Arguments: [param] - [in] Parameter
  218. // [pvarValue] - [in] Value
  219. //
  220. // Returns: S_OK if successful
  221. // E_INVALIDARG if bad parameter.
  222. //
  223. // History: 11-27-96 srikants Created
  224. //
  225. //-----------------------------------------------------------------------
  226. STDMETHODIMP CCiAdminParams::SetParamValue(
  227. CI_ADMIN_PARAMS param,
  228. PROPVARIANT const * pvarValue )
  229. {
  230. Win4Assert( 0 != pvarValue );
  231. SCODE sc = S_OK;
  232. // =================================================================
  233. CLock lock( _mutex );
  234. CStorageVariant const * pVar = ConvertToStgVariant( pvarValue );
  235. if ( param < CI_AP_MAX_DWORD_VAL )
  236. {
  237. Win4Assert( VT_I4 == pvarValue->vt ||
  238. VT_UI4 == pvarValue->vt );
  239. long lVal = *pVar;
  240. _adwParams[param] = (DWORD) *pVar;
  241. }
  242. else
  243. {
  244. //
  245. // Currently no non-dword values.
  246. //
  247. Win4Assert( param < CI_AP_MAX_DWORD_VAL );
  248. sc = E_INVALIDARG;
  249. }
  250. // =================================================================
  251. return sc;
  252. }
  253. //+---------------------------------------------------------------------------
  254. //
  255. // Member: CCiAdminParams::GetParamValue
  256. //
  257. // Synopsis: Retrieves the value of a parameter as a variant.
  258. //
  259. // Arguments: [param] - [in] Parameter
  260. // [ppvarValue] - [out] Value on return
  261. //
  262. // Returns: S_OK if successful;
  263. // E_INVALIDARG if bad parameters.
  264. // E_OUTOFMEMORY if no memory.
  265. //
  266. // History: 11-27-96 srikants Created
  267. //
  268. //----------------------------------------------------------------------------
  269. STDMETHODIMP CCiAdminParams::GetParamValue(
  270. CI_ADMIN_PARAMS param,
  271. PROPVARIANT ** ppvarValue )
  272. {
  273. Win4Assert( 0 != ppvarValue );
  274. if ( !IsValidParam(param) )
  275. return E_INVALIDARG;
  276. if ( param < CI_AP_MAX_DWORD_VAL )
  277. {
  278. CStorageVariant * pVar = new CStorageVariant( (long) _adwParams[param] );
  279. *ppvarValue = ConvertToPropVariant( pVar );
  280. }
  281. else
  282. {
  283. //
  284. // Currently no non-dword parameters.
  285. //
  286. Win4Assert( param < CI_AP_MAX_DWORD_VAL );
  287. }
  288. if ( *ppvarValue )
  289. return S_OK;
  290. else
  291. return E_OUTOFMEMORY;
  292. }
  293. //+---------------------------------------------------------------------------
  294. //
  295. // Member: CCiAdminParams::IsSame
  296. //
  297. // Synopsis: Tests if the value for the parameter specified is same as
  298. // the one given.
  299. //
  300. // Arguments: [param] - [in] Parameter
  301. // [pvarValue] - [in] Value given by the caller
  302. // [pfSame] - [out] TRUE if the value contained is same as
  303. // the one passed; FALSE o/w
  304. //
  305. // Returns: S_OK if successful
  306. // E_INVALIDARG if bad parameter.
  307. //
  308. // History: 11-27-96 srikants Created
  309. //
  310. //----------------------------------------------------------------------------
  311. STDMETHODIMP CCiAdminParams::IsSame(
  312. CI_ADMIN_PARAMS param,
  313. const PROPVARIANT * pvarValue,
  314. BOOL * pfSame )
  315. {
  316. Win4Assert( pvarValue );
  317. Win4Assert( pfSame );
  318. CStorageVariant const * pVar = ConvertToStgVariant( pvarValue );
  319. if ( param < CI_AP_MAX_DWORD_VAL )
  320. {
  321. DWORD dwVal = *pVar;
  322. *pfSame = ( dwVal == _adwParams[param] );
  323. }
  324. else
  325. {
  326. //
  327. // Currently no non-dword parameters.
  328. //
  329. Win4Assert( param < CI_AP_MAX_DWORD_VAL );
  330. return E_INVALIDARG;
  331. }
  332. return S_OK;
  333. }
  334. STDMETHODIMP CCiAdminParams::InvalidateLangResources()
  335. {
  336. if ( 0 != _pLangList )
  337. _pLangList->InvalidateLangResources();
  338. return S_OK;
  339. }
  340. //+---------------------------------------------------------------------------
  341. //
  342. // Member: CCiAdminParams::CCiAdminParams
  343. //
  344. // Synopsis: Constructor of the CI admin parameters. Sets the values to
  345. // default values.
  346. //
  347. // History: 12-02-96 srikants Created
  348. //
  349. //----------------------------------------------------------------------------
  350. CCiAdminParams::CCiAdminParams( CLangList * pLangList )
  351. : _refCount( 1 ),
  352. _pLangList( pLangList )
  353. {
  354. RtlZeroMemory( &_adwParams, sizeof(_adwParams) );
  355. //
  356. // Initialize the default values of all parameters.
  357. //
  358. for ( unsigned i = 0; i < CI_AP_MAX_DWORD_VAL; i++ )
  359. {
  360. _adwParams[i] = _adwRangeParams[i]._dwDefault;
  361. }
  362. //
  363. // Add assertions to verify that the default values are correct.
  364. //
  365. #if 0
  366. Win4Assert( _adwRangeParams[CI_AP_XXXX]._dwDefault ==
  367. CI_XXXX_DEFAULT );
  368. { CI_XXXX_DEFAULT, CI_XXXX_DEFAULT,
  369. CI_XXXX_DEFAULT },
  370. #endif // 0
  371. Win4Assert( _adwRangeParams[CI_AP_MERGE_INTERVAL]._dwDefault ==
  372. CI_MAX_MERGE_INTERVAL_DEFAULT );
  373. Win4Assert( _adwRangeParams[CI_AP_MAX_UPDATES]._dwDefault ==
  374. CI_MAX_UPDATES_DEFAULT );
  375. Win4Assert( _adwRangeParams[CI_AP_MAX_WORDLISTS]._dwDefault ==
  376. CI_MAX_WORDLISTS_DEFAULT );
  377. Win4Assert( _adwRangeParams[CI_AP_MIN_SIZE_MERGE_WORDLISTS]._dwDefault ==
  378. CI_MIN_SIZE_MERGE_WORDLISTS_DEFAULT );
  379. Win4Assert( _adwRangeParams[CI_AP_MAX_WORDLIST_SIZE]._dwDefault ==
  380. CI_MAX_WORDLIST_SIZE_DEFAULT );
  381. Win4Assert( _adwRangeParams[CI_AP_MIN_WORDLIST_MEMORY]._dwDefault ==
  382. CI_MIN_WORDLIST_MEMORY_DEFAULT );
  383. Win4Assert( _adwRangeParams[CI_AP_LOW_RESOURCE_SLEEP]._dwDefault ==
  384. CI_LOW_RESOURCE_SLEEP_DEFAULT );
  385. Win4Assert( _adwRangeParams[CI_AP_MAX_WORDLIST_MEMORY_LOAD]._dwDefault ==
  386. CI_MAX_WORDLIST_MEMORY_LOAD_DEFAULT );
  387. Win4Assert( _adwRangeParams[CI_AP_MAX_FRESH_COUNT]._dwDefault ==
  388. CI_MAX_FRESHCOUNT_DEFAULT );
  389. Win4Assert( _adwRangeParams[CI_AP_MAX_SHADOW_INDEX_SIZE]._dwDefault ==
  390. CI_MAX_SHADOW_INDEX_SIZE_DEFAULT );
  391. Win4Assert( _adwRangeParams[CI_AP_MIN_DISK_FREE_FORCE_MERGE]._dwDefault ==
  392. CI_MIN_DISKFREE_FORCE_MERGE_DEFAULT );
  393. Win4Assert( _adwRangeParams[CI_AP_MAX_SHADOW_FREE_FORCE_MERGE]._dwDefault ==
  394. CI_MAX_SHADOW_FREE_FORCE_MERGE_DEFAULT );
  395. Win4Assert( _adwRangeParams[CI_AP_MAX_INDEXES]._dwDefault ==
  396. CI_MAX_INDEXES_DEFAULT );
  397. Win4Assert( _adwRangeParams[CI_AP_MAX_IDEAL_INDEXES]._dwDefault ==
  398. CI_MAX_IDEAL_INDEXES_DEFAULT );
  399. Win4Assert( _adwRangeParams[CI_AP_MIN_MERGE_IDLE_TIME]._dwDefault ==
  400. CI_MIN_MERGE_IDLE_TIME_DEFAULT );
  401. Win4Assert( _adwRangeParams[CI_AP_MAX_PENDING_DOCUMENTS]._dwDefault ==
  402. CI_MAX_PENDING_DOCUMENTS_DEFAULT );
  403. Win4Assert( _adwRangeParams[CI_AP_MASTER_MERGE_TIME]._dwDefault ==
  404. CI_MASTER_MERGE_TIME_DEFAULT );
  405. Win4Assert( _adwRangeParams[CI_AP_MAX_QUEUE_CHUNKS]._dwDefault ==
  406. CI_MAX_QUEUE_CHUNKS_DEFAULT );
  407. Win4Assert( _adwRangeParams[CI_AP_MASTER_MERGE_CHECKPOINT_INTERVAL]._dwDefault ==
  408. CI_MASTER_MERGE_CHECKPOINT_INTERVAL_DEFAULT );
  409. Win4Assert( _adwRangeParams[CI_AP_FILTER_BUFFER_SIZE]._dwDefault ==
  410. CI_FILTER_BUFFER_SIZE_DEFAULT );
  411. Win4Assert( _adwRangeParams[CI_AP_FILTER_RETRIES]._dwDefault ==
  412. CI_FILTER_RETRIES_DEFAULT );
  413. Win4Assert( _adwRangeParams[CI_AP_FILTER_RETRY_INTERVAL]._dwDefault ==
  414. CI_FILTER_RETRY_INTERVAL_DEFAULT );
  415. Win4Assert( _adwRangeParams[CI_AP_MIN_IDLE_QUERY_THREADS]._dwDefault ==
  416. CI_MIN_IDLE_QUERY_THREADS_DEFAULT );
  417. Win4Assert( _adwRangeParams[CI_AP_MAX_ACTIVE_QUERY_THREADS]._dwDefault ==
  418. CI_MAX_ACTIVE_QUERY_THREADS_DEFAULT );
  419. Win4Assert( _adwRangeParams[CI_AP_MAX_QUERY_TIMESLICE]._dwDefault ==
  420. CI_MAX_QUERY_TIMESLICE_DEFAULT );
  421. Win4Assert( _adwRangeParams[CI_AP_MAX_QUERY_EXECUTION_TIME]._dwDefault ==
  422. CI_MAX_QUERY_EXECUTION_TIME_DEFAULT );
  423. Win4Assert( _adwRangeParams[CI_AP_MAX_RESTRICTION_NODES]._dwDefault ==
  424. CI_MAX_RESTRICTION_NODES_DEFAULT );
  425. Win4Assert( _adwRangeParams[CI_AP_CLUSTERINGTIME]._dwDefault ==
  426. CI_CLUSTERINGTIME_DEFAULT );
  427. Win4Assert( _adwRangeParams[CI_AP_MAX_FILESIZE_MULTIPLIER]._dwDefault ==
  428. CI_MAX_FILESIZE_MULTIPLIER_DEFAULT );
  429. Win4Assert( _adwRangeParams[CI_AP_DAEMON_RESPONSE_TIMEOUT]._dwDefault ==
  430. CI_DAEMON_RESPONSE_TIMEOUT_DEFAULT );
  431. Win4Assert( _adwRangeParams[CI_AP_FILTER_DELAY_INTERVAL]._dwDefault ==
  432. CI_FILTER_DELAY_INTERVAL_DEFAULT );
  433. Win4Assert( _adwRangeParams[CI_AP_FILTER_REMAINING_THRESHOLD]._dwDefault ==
  434. CI_FILTER_REMAINING_THRESHOLD_DEFAULT );
  435. Win4Assert( _adwRangeParams[CI_AP_MAX_CHARACTERIZATION]._dwDefault ==
  436. CI_MAX_CHARACTERIZATION_DEFAULT );
  437. Win4Assert( _adwRangeParams[CI_AP_MAX_FILESIZE_FILTERED]._dwDefault ==
  438. CI_MAX_FILESIZE_FILTERED_DEFAULT );
  439. Win4Assert( _adwRangeParams[CI_AP_MAX_WORDLIST_IO]._dwDefault ==
  440. CI_MAX_WORDLIST_IO_DEFAULT );
  441. Win4Assert( _adwRangeParams[CI_AP_WORDLIST_RESOURCE_CHECK_INTERVAL]._dwDefault ==
  442. CI_WORDLIST_RESOURCE_CHECK_INTERVAL_DEFAULT );
  443. Win4Assert( _adwRangeParams[CI_AP_STARTUP_DELAY]._dwDefault ==
  444. CI_STARTUP_DELAY_DEFAULT );
  445. Win4Assert( _adwRangeParams[CI_AP_GENERATE_CHARACTERIZATION]._dwDefault ==
  446. CI_GENERATE_CHARACTERIZATION_DEFAULT );
  447. Win4Assert( _adwRangeParams[CI_AP_SECQ_FILTER_RETRIES]._dwDefault ==
  448. CI_SECQ_FILTER_RETRIES_DEFAULT );
  449. Win4Assert( _adwRangeParams[CI_AP_MIN_WORDLIST_BATTERY]._dwDefault ==
  450. CI_MIN_WORDLIST_BATTERY_DEFAULT );
  451. Win4Assert( _adwRangeParams[CI_AP_THREAD_PRIORITY_MERGE]._dwDefault ==
  452. CI_THREAD_PRIORITY_MERGE_DEFAULT );
  453. Win4Assert( _adwRangeParams[CI_AP_THREAD_PRIORITY_FILTER]._dwDefault ==
  454. CI_THREAD_PRIORITY_FILTER_DEFAULT );
  455. Win4Assert( _adwRangeParams[CI_AP_THREAD_CLASS_FILTER]._dwDefault ==
  456. CI_THREAD_CLASS_FILTER_DEFAULT );
  457. Win4Assert( _adwRangeParams[CI_AP_EVTLOG_FLAGS]._dwDefault ==
  458. CI_EVTLOG_FLAGS_DEFAULT );
  459. Win4Assert( _adwRangeParams[CI_AP_MISC_FLAGS]._dwDefault ==
  460. CI_MISC_FLAGS_DEFAULT );
  461. Win4Assert( _adwRangeParams[CI_AP_GENERATE_RELEVANT_WORDS]._dwDefault ==
  462. CI_GENERATE_RELEVANT_WORDS_DEFAULT );
  463. Win4Assert( _adwRangeParams[CI_AP_FFILTER_FILES_WITH_UNKNOWN_EXTENSIONS]._dwDefault ==
  464. CI_FFILTER_FILES_WITH_UNKNOWN_EXTENSIONS_DEFAULT );
  465. Win4Assert( _adwRangeParams[CI_AP_FILTER_DIRECTORIES]._dwDefault ==
  466. CI_FILTER_DIRECTORIES_DEFAULT );
  467. Win4Assert( _adwRangeParams[CI_AP_FILTER_CONTENTS]._dwDefault ==
  468. CI_FILTER_CONTENTS_DEFAULT );
  469. Win4Assert( _adwRangeParams[CI_AP_MAX_DAEMON_VM_USE]._dwDefault ==
  470. CI_MAX_DAEMON_VM_USE_DEFAULT );
  471. Win4Assert( _adwRangeParams[CI_AP_WORDLIST_USER_IDLE]._dwDefault ==
  472. CI_WORDLIST_USER_IDLE_DEFAULT );
  473. Win4Assert( _adwRangeParams[CI_AP_IS_ENUM_ALLOWED]._dwDefault ==
  474. CI_IS_ENUM_ALLOWED_DEFAULT );
  475. Win4Assert( _adwRangeParams[CI_AP_MIN_DISK_SPACE_TO_LEAVE]._dwDefault ==
  476. CI_MIN_DISK_SPACE_TO_LEAVE_DEFAULT );
  477. }
  478. // ---------------------------------------------------------------------------
  479. // Array of the min, max, default values for the DWORD parameters.
  480. // Organize the array as sets of 4 for readability.
  481. // ---------------------------------------------------------------------------
  482. const CI_ADMIN_PARAMS_RANGE CCiAdminParams::_adwRangeParams[CI_AP_MAX_DWORD_VAL] =
  483. {
  484. { CI_MAX_MERGE_INTERVAL_MIN, CI_MAX_MERGE_INTERVAL_MAX,
  485. CI_MAX_MERGE_INTERVAL_DEFAULT },
  486. { CI_MAX_UPDATES_MIN, CI_MAX_UPDATES_MAX,
  487. CI_MAX_UPDATES_DEFAULT },
  488. { CI_MAX_WORDLISTS_MIN, CI_MAX_WORDLISTS_MAX,
  489. CI_MAX_WORDLISTS_DEFAULT },
  490. { CI_MIN_SIZE_MERGE_WORDLISTS_MIN, CI_MIN_SIZE_MERGE_WORDLISTS_MAX,
  491. CI_MIN_SIZE_MERGE_WORDLISTS_DEFAULT },
  492. { CI_MAX_WORDLIST_SIZE_MIN, CI_MAX_WORDLIST_SIZE_MAX,
  493. CI_MAX_WORDLIST_SIZE_DEFAULT },
  494. { CI_MIN_WORDLIST_MEMORY_MIN, CI_MIN_WORDLIST_MEMORY_MAX,
  495. CI_MIN_WORDLIST_MEMORY_DEFAULT },
  496. { CI_LOW_RESOURCE_SLEEP_MIN, CI_LOW_RESOURCE_SLEEP_MAX,
  497. CI_LOW_RESOURCE_SLEEP_DEFAULT },
  498. { CI_MAX_WORDLIST_MEMORY_LOAD_MIN, CI_MAX_WORDLIST_MEMORY_LOAD_MAX,
  499. CI_MAX_WORDLIST_MEMORY_LOAD_DEFAULT },
  500. { CI_MAX_FRESHCOUNT_MIN, CI_MAX_FRESHCOUNT_MAX,
  501. CI_MAX_FRESHCOUNT_DEFAULT },
  502. { CI_MAX_SHADOW_INDEX_SIZE_MIN, CI_MAX_SHADOW_INDEX_SIZE_MAX,
  503. CI_MAX_SHADOW_INDEX_SIZE_DEFAULT },
  504. { CI_MIN_DISKFREE_FORCE_MERGE_MIN, CI_MIN_DISKFREE_FORCE_MERGE_MAX,
  505. CI_MIN_DISKFREE_FORCE_MERGE_DEFAULT },
  506. { CI_MAX_SHADOW_FREE_FORCE_MERGE_MIN, CI_MAX_SHADOW_FREE_FORCE_MERGE_MAX,
  507. CI_MAX_SHADOW_FREE_FORCE_MERGE_DEFAULT },
  508. { CI_MAX_INDEXES_MIN, CI_MAX_INDEXES_MAX,
  509. CI_MAX_INDEXES_DEFAULT },
  510. { CI_MAX_IDEAL_INDEXES_MIN, CI_MAX_IDEAL_INDEXES_MAX,
  511. CI_MAX_IDEAL_INDEXES_DEFAULT },
  512. { CI_MIN_MERGE_IDLE_TIME_MIN, CI_MIN_MERGE_IDLE_TIME_MAX,
  513. CI_MIN_MERGE_IDLE_TIME_DEFAULT },
  514. { CI_MAX_PENDING_DOCUMENTS_MIN, CI_MAX_PENDING_DOCUMENTS_MAX,
  515. CI_MAX_PENDING_DOCUMENTS_DEFAULT },
  516. { CI_MASTER_MERGE_TIME_MIN, CI_MASTER_MERGE_TIME_MAX,
  517. CI_MASTER_MERGE_TIME_DEFAULT },
  518. { CI_MAX_QUEUE_CHUNKS_MIN, CI_MAX_QUEUE_CHUNKS_MAX,
  519. CI_MAX_QUEUE_CHUNKS_DEFAULT },
  520. { CI_MASTER_MERGE_CHECKPOINT_INTERVAL_MIN,
  521. CI_MASTER_MERGE_CHECKPOINT_INTERVAL_MAX,
  522. CI_MASTER_MERGE_CHECKPOINT_INTERVAL_DEFAULT },
  523. { CI_FILTER_BUFFER_SIZE_MIN, CI_FILTER_BUFFER_SIZE_MAX,
  524. CI_FILTER_BUFFER_SIZE_DEFAULT },
  525. { CI_FILTER_RETRIES_MIN, CI_FILTER_RETRIES_MAX,
  526. CI_FILTER_RETRIES_DEFAULT },
  527. { CI_FILTER_RETRY_INTERVAL_MIN, CI_FILTER_RETRY_INTERVAL_MAX,
  528. CI_FILTER_RETRY_INTERVAL_DEFAULT },
  529. { CI_MIN_IDLE_QUERY_THREADS_MIN, CI_MIN_IDLE_QUERY_THREADS_MAX,
  530. CI_MIN_IDLE_QUERY_THREADS_DEFAULT },
  531. { CI_MAX_ACTIVE_QUERY_THREADS_MIN, CI_MAX_ACTIVE_QUERY_THREADS_MAX,
  532. CI_MAX_ACTIVE_QUERY_THREADS_DEFAULT },
  533. { CI_MAX_QUERY_TIMESLICE_MIN, CI_MAX_QUERY_TIMESLICE_MAX,
  534. CI_MAX_QUERY_TIMESLICE_DEFAULT },
  535. { CI_MAX_QUERY_EXECUTION_TIME_MIN, CI_MAX_QUERY_EXECUTION_TIME_MAX,
  536. CI_MAX_QUERY_EXECUTION_TIME_DEFAULT },
  537. { CI_MAX_RESTRICTION_NODES_MIN, CI_MAX_RESTRICTION_NODES_MAX,
  538. CI_MAX_RESTRICTION_NODES_DEFAULT },
  539. { CI_CLUSTERINGTIME_MIN, CI_CLUSTERINGTIME_MAX,
  540. CI_CLUSTERINGTIME_DEFAULT },
  541. { CI_MAX_FILESIZE_MULTIPLIER_MIN, CI_MAX_FILESIZE_MULTIPLIER_MAX,
  542. CI_MAX_FILESIZE_MULTIPLIER_DEFAULT },
  543. { CI_DAEMON_RESPONSE_TIMEOUT_MIN, CI_DAEMON_RESPONSE_TIMEOUT_MAX,
  544. CI_DAEMON_RESPONSE_TIMEOUT_DEFAULT },
  545. { CI_FILTER_DELAY_INTERVAL_MIN, CI_FILTER_DELAY_INTERVAL_MAX,
  546. CI_FILTER_DELAY_INTERVAL_DEFAULT },
  547. { CI_FILTER_REMAINING_THRESHOLD_MIN, CI_FILTER_REMAINING_THRESHOLD_MAX,
  548. CI_FILTER_REMAINING_THRESHOLD_DEFAULT },
  549. { CI_MAX_CHARACTERIZATION_MIN, CI_MAX_CHARACTERIZATION_MAX,
  550. CI_MAX_CHARACTERIZATION_DEFAULT },
  551. { CI_MAX_FRESH_DELETES_MIN, CI_MAX_FRESH_DELETES_MAX,
  552. CI_MAX_FRESH_DELETES_DEFAULT },
  553. { CI_MAX_WORDLIST_IO_MIN, CI_MAX_WORDLIST_IO_MAX,
  554. CI_MAX_WORDLIST_IO_DEFAULT },
  555. { CI_WORDLIST_RESOURCE_CHECK_INTERVAL_MIN, CI_WORDLIST_RESOURCE_CHECK_INTERVAL_MAX,
  556. CI_WORDLIST_RESOURCE_CHECK_INTERVAL_DEFAULT },
  557. { CI_STARTUP_DELAY_MIN, CI_STARTUP_DELAY_MAX,
  558. CI_STARTUP_DELAY_DEFAULT },
  559. { CI_GENERATE_CHARACTERIZATION_MIN, CI_GENERATE_CHARACTERIZATION_MAX,
  560. CI_GENERATE_CHARACTERIZATION_DEFAULT },
  561. { CI_MIN_WORDLIST_BATTERY_MIN, CI_MIN_WORDLIST_BATTERY_MAX,
  562. CI_MIN_WORDLIST_BATTERY_DEFAULT },
  563. { 0,0xFFFFFFFF,
  564. (DWORD) CI_THREAD_PRIORITY_MERGE_DEFAULT },
  565. { 0, 0,
  566. (DWORD) CI_THREAD_PRIORITY_FILTER_DEFAULT },
  567. { 0,0xFFFFFFFF,
  568. CI_THREAD_CLASS_FILTER_DEFAULT },
  569. { 0,0xFFFFFFFF,
  570. CI_EVTLOG_FLAGS_DEFAULT },
  571. { 0,0xFFFFFFFF,
  572. CI_MISC_FLAGS_DEFAULT },
  573. { 0,0xFFFFFFFF,
  574. CI_GENERATE_RELEVANT_WORDS_DEFAULT },
  575. { 0,0xFFFFFFFF,
  576. CI_FFILTER_FILES_WITH_UNKNOWN_EXTENSIONS_DEFAULT },
  577. { 0,0xFFFFFFFF,
  578. CI_FILTER_DIRECTORIES_DEFAULT },
  579. { 0,0xFFFFFFFF,
  580. CI_FILTER_CONTENTS_DEFAULT },
  581. { 0, 0xFFFFFFFF,
  582. CI_MAX_FILESIZE_FILTERED_DEFAULT },
  583. { 0, 0xFFFFFFFF,
  584. CI_MIN_CLIENT_IDLE_TIME },
  585. { CI_MAX_DAEMON_VM_USE_MIN, CI_MAX_DAEMON_VM_USE_MAX,
  586. CI_MAX_DAEMON_VM_USE_DEFAULT },
  587. { CI_SECQ_FILTER_RETRIES_MIN, CI_SECQ_FILTER_RETRIES_MAX,
  588. CI_SECQ_FILTER_RETRIES_DEFAULT },
  589. { CI_WORDLIST_USER_IDLE_MIN, CI_WORDLIST_USER_IDLE_MAX,
  590. CI_WORDLIST_USER_IDLE_DEFAULT },
  591. { 0, 0xFFFFFFFF,
  592. CI_IS_ENUM_ALLOWED_DEFAULT },
  593. { CI_MIN_DISK_SPACE_TO_LEAVE_MIN, CI_MIN_DISK_SPACE_TO_LEAVE_MAX,
  594. CI_MIN_DISK_SPACE_TO_LEAVE_DEFAULT },
  595. // End of DWORD values
  596. };
  597. // global c++ objects are evil, sick, and wrong.
  598. CWorkQueue TheWorkQueue( 2, CWorkQueue::workQueueQuery );
  599. CLocateDocStore g_DocStoreLocator;
  600. CLocateDocStore g_svcDocStoreLocator;
  601. void InitializeDocStore(void)
  602. {
  603. TheWorkQueue.Init();
  604. g_DocStoreLocator.Init();
  605. g_svcDocStoreLocator.Init();
  606. }
  607. //+---------------------------------------------------------------------------
  608. //
  609. // Member: CLocateDocStore::Get
  610. //
  611. // Synopsis: Gets the docstore locator with the given clsid.
  612. //
  613. // History: 1-17-97 srikants Created
  614. //
  615. //----------------------------------------------------------------------------
  616. ICiCDocStoreLocator * CLocateDocStore::Get( GUID const & guidDocStoreLocator )
  617. {
  618. if ( !_fShutdown )
  619. {
  620. CLock lock( _mutex );
  621. if ( 0 == _pDocStoreLocator )
  622. {
  623. SCODE sc = CoCreateInstance( guidDocStoreLocator,
  624. NULL,
  625. CLSCTX_INPROC_SERVER,
  626. IID_ICiCDocStoreLocator,
  627. (void **) &_pDocStoreLocator );
  628. if ( FAILED(sc) )
  629. {
  630. ciDebugOut(( DEB_ERROR,
  631. "Failed to create ICiCDocStoreLocator (0x%X) \n",
  632. sc ));
  633. THROW( CException( sc ) );
  634. }
  635. }
  636. _pDocStoreLocator->AddRef();
  637. }
  638. return _pDocStoreLocator;
  639. }
  640. //+---------------------------------------------------------------------------
  641. //
  642. // Member: CLocateDocStore::Shutdown
  643. //
  644. // Synopsis: Shutsdown the Content Index Framework side of the things.
  645. // This shuts down the whole Content Index. If there are
  646. // multiple instances of CI in the same process, this affects
  647. // all the instances.
  648. //
  649. // History: 3-20-97 srikants Created
  650. //
  651. //----------------------------------------------------------------------------
  652. void CLocateDocStore::Shutdown()
  653. {
  654. CLock lock( _mutex );
  655. if ( _pDocStoreLocator )
  656. {
  657. //
  658. // Shutdown on the docstore locator must be called only once.
  659. //
  660. if ( !_fShutdown )
  661. _pDocStoreLocator->Shutdown();
  662. _pDocStoreLocator->Release();
  663. _pDocStoreLocator = 0;
  664. }
  665. _fShutdown = TRUE;
  666. }