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.

735 lines
20 KiB

  1. /******************************************************************************
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. Manager.cpp
  5. Abstract:
  6. Implementation of SearchEngine::Manager
  7. Revision History:
  8. Ghim-Sim Chua (gschua) 06/01/2000
  9. created
  10. ******************************************************************************/
  11. #include "stdafx.h"
  12. ////////////////////////////////////////////////////////////////////////////////
  13. static const WCHAR c_rgSEARCHENGINE_KEYWORD [] = L"BUILTIN_KEYWORD";
  14. static const WCHAR c_rgSEARCHENGINE_FULLTEXTSEARCH[] = L"BUILTIN_FULLTEXTSEARCH";
  15. ////////////////////////////////////////////////////////////////////////////////
  16. void SearchEngine::Manager::CloneListOfWrappers( /*[out]*/ WrapperItemList& lst )
  17. {
  18. WrapperItemIter it;
  19. for(it = m_lstWrapperItem.begin(); it != m_lstWrapperItem.end(); it++)
  20. {
  21. IPCHSEWrapperItem* obj = *it;
  22. lst.push_back( obj ); obj->AddRef();
  23. }
  24. }
  25. SearchEngine::Manager::Manager()
  26. {
  27. // Taxonomy::HelpSet m_ths;
  28. //
  29. // WrapperItemList m_lstWrapperItem;
  30. m_fInitialized = false; // bool m_fInitialized;
  31. // MPC::FileLog m_fl;
  32. // MPC::Impersonation m_imp;
  33. //
  34. // CComBSTR m_bstrQueryString;
  35. m_lNumResult = 50; // long m_lNumResult;
  36. m_lEnabledSE = 0; // long m_lEnabledSE;
  37. m_lCountComplete = 0; // long m_lCountComplete;
  38. m_hrLastError = S_OK; // HRESULT m_hrLastError;
  39. //
  40. // CComPtr<IPCHSEManagerInternal> m_Notifier;
  41. // CComPtr<IDispatch> m_Progress;
  42. // CComPtr<IDispatch> m_Complete;
  43. // CComPtr<IDispatch> m_WrapperComplete;
  44. }
  45. void SearchEngine::Manager::Passivate()
  46. {
  47. Thread_Wait();
  48. MPC::ReleaseAll( m_lstWrapperItem );
  49. m_Notifier.Release();
  50. m_fInitialized = false;
  51. }
  52. HRESULT SearchEngine::Manager::IsNetworkAlive( /*[out]*/ VARIANT_BOOL *pvbVar )
  53. {
  54. __HCP_FUNC_ENTRY( "SearchEngine::Manager::IsNetworkAlive" );
  55. HRESULT hr;
  56. CPCHUserProcess::UserEntry ue;
  57. CComPtr<IPCHSlaveProcess> sp;
  58. __MPC_EXIT_IF_METHOD_FAILS(hr, ue.InitializeForImpersonation( (HANDLE)m_imp ));
  59. __MPC_EXIT_IF_METHOD_FAILS(hr, CPCHUserProcess::s_GLOBAL->Connect( ue, &sp ));
  60. __MPC_EXIT_IF_METHOD_FAILS(hr, sp->IsNetworkAlive( pvbVar ));
  61. hr = S_OK;
  62. __HCP_FUNC_CLEANUP;
  63. __HCP_FUNC_EXIT(hr);
  64. }
  65. HRESULT SearchEngine::Manager::IsDestinationReachable( /*[in ]*/ BSTR bstrDestination, /*[out]*/ VARIANT_BOOL *pvbVar )
  66. {
  67. __HCP_FUNC_ENTRY( "SearchEngine::Manager::IsDestinationReachable" );
  68. HRESULT hr;
  69. CPCHUserProcess::UserEntry ue;
  70. CComPtr<IPCHSlaveProcess> sp;
  71. __MPC_EXIT_IF_METHOD_FAILS(hr, ue.InitializeForImpersonation( (HANDLE)m_imp ));
  72. __MPC_EXIT_IF_METHOD_FAILS(hr, CPCHUserProcess::s_GLOBAL->Connect( ue, &sp ));
  73. __MPC_EXIT_IF_METHOD_FAILS(hr, sp->IsDestinationReachable( bstrDestination, pvbVar ));
  74. hr = S_OK;
  75. __HCP_FUNC_CLEANUP;
  76. __HCP_FUNC_EXIT(hr);
  77. }
  78. ////////////////////////////////////////////////////////////////////////////////
  79. HRESULT SearchEngine::Manager::InitializeFromDatabase( /*[in]*/ const Taxonomy::HelpSet& ths )
  80. {
  81. __HCP_FUNC_ENTRY( "SearchEngine::Manager::InitializeFromDatabase" );
  82. HRESULT hr;
  83. m_ths = ths;
  84. hr = S_OK;
  85. __HCP_FUNC_EXIT(hr);
  86. }
  87. ////////////////////////////////////////////////////////////////////////////////
  88. HRESULT SearchEngine::Manager::CreateAndAddWrapperToList( /*[in]*/ MPC::SmartLock<_ThreadModel>& lock ,
  89. /*[in]*/ BSTR bstrCLSID ,
  90. /*[in]*/ BSTR bstrID ,
  91. /*[in]*/ BSTR bstrData )
  92. {
  93. __HCP_FUNC_ENTRY( "SearchEngine::Manager::CreateAndAddWrapperToList" );
  94. HRESULT hr;
  95. GUID guidCLSID;
  96. CComPtr<IPCHSEWrapperInternal> pWrapperInternal;
  97. CComPtr<IPCHSEWrapperItem> pWrapperItem;
  98. __MPC_PARAMCHECK_BEGIN(hr)
  99. __MPC_PARAMCHECK_STRING_NOT_EMPTY(bstrCLSID);
  100. __MPC_PARAMCHECK_END();
  101. //
  102. // Translate it into actual CLSID and IID
  103. //
  104. if(!MPC::StrICmp( bstrCLSID, c_rgSEARCHENGINE_KEYWORD ))
  105. {
  106. guidCLSID = CLSID_KeywordSearchWrapper;
  107. }
  108. else if(!MPC::StrICmp( bstrCLSID, c_rgSEARCHENGINE_FULLTEXTSEARCH ))
  109. {
  110. guidCLSID = CLSID_FullTextSearchWrapper;
  111. }
  112. else
  113. {
  114. __MPC_EXIT_IF_METHOD_FAILS(hr, ::CLSIDFromString( bstrCLSID, &guidCLSID ));
  115. }
  116. if(IsEqualGUID( CLSID_KeywordSearchWrapper, guidCLSID ))
  117. {
  118. __MPC_EXIT_IF_METHOD_FAILS(hr, WrapperItem__Create_Keyword( pWrapperInternal ));
  119. }
  120. else if(IsEqualGUID( CLSID_FullTextSearchWrapper, guidCLSID ))
  121. {
  122. __MPC_EXIT_IF_METHOD_FAILS(hr, WrapperItem__Create_FullTextSearch( pWrapperInternal ));
  123. }
  124. else
  125. {
  126. CPCHUserProcess::UserEntry ue;
  127. CComPtr<IPCHSlaveProcess> sp;
  128. CComPtr<IUnknown> unk;
  129. //
  130. // Get the help host to create the object for us
  131. //
  132. __MPC_EXIT_IF_METHOD_FAILS(hr, ue.InitializeForImpersonation( (HANDLE)m_imp ));
  133. __MPC_EXIT_IF_METHOD_FAILS(hr, CPCHUserProcess::s_GLOBAL->Connect( ue, &sp ));
  134. __MPC_EXIT_IF_METHOD_FAILS(hr, sp->CreateInstance( guidCLSID, NULL, &unk ));
  135. __MPC_EXIT_IF_METHOD_FAILS(hr, unk.QueryInterface( &pWrapperInternal ));
  136. }
  137. __MPC_EXIT_IF_METHOD_FAILS(hr, pWrapperInternal.QueryInterface( &pWrapperItem ));
  138. //
  139. // Initialize the engine via the internal interface.
  140. //
  141. // Before calling into the wrapper, let's release the lock, to avoid deadlocks if the wrapper calls back ...
  142. //
  143. {
  144. CComBSTR ts_SKU = m_ths.GetSKU ();
  145. long ts_Language = m_ths.GetLanguage();
  146. lock = NULL;
  147. hr = pWrapperInternal->Initialize( bstrID, ts_SKU, ts_Language, bstrData );
  148. lock = this;
  149. __MPC_EXIT_IF_METHOD_FAILS(hr, hr);
  150. }
  151. //
  152. // Add it to the wrapper list
  153. //
  154. m_lstWrapperItem.insert( m_lstWrapperItem.end(), pWrapperItem.Detach() );
  155. hr = S_OK;
  156. __MPC_FUNC_CLEANUP;
  157. __MPC_FUNC_EXIT(hr);
  158. }
  159. HRESULT SearchEngine::Manager::Initialize( /*[in]*/ MPC::SmartLock<_ThreadModel>& lock )
  160. {
  161. __HCP_FUNC_ENTRY( "SearchEngine::Manager::Initialize" );
  162. HRESULT hr;
  163. CComObject<SearchEngine::ManagerInternal>* pNotifier = NULL;
  164. if(!m_fInitialized)
  165. {
  166. CComPtr<IPCHSEWrapperInternal> pObj;
  167. __MPC_EXIT_IF_METHOD_FAILS(hr, m_imp.Initialize( MAXIMUM_ALLOWED ));
  168. // Attempt to open the log for writing
  169. {
  170. MPC::wstring szFile( HC_SEMGR_LOGNAME ); MPC::SubstituteEnvVariables( szFile );
  171. __MPC_EXIT_IF_METHOD_FAILS(hr, m_fl.SetLocation( szFile.c_str() ));
  172. }
  173. ////////////////////////////////////////
  174. //
  175. // Create the notifier object (required to avoid loop in the reference counting.
  176. //
  177. __MPC_EXIT_IF_METHOD_FAILS(hr, CreateChild( this, &pNotifier )); m_Notifier = pNotifier;
  178. //
  179. // Create the BUILT-IN wrappers.
  180. //
  181. {
  182. (void)CreateAndAddWrapperToList( lock, CComBSTR( c_rgSEARCHENGINE_KEYWORD ), NULL, NULL );
  183. (void)CreateAndAddWrapperToList( lock, CComBSTR( c_rgSEARCHENGINE_FULLTEXTSEARCH ), NULL, NULL );
  184. }
  185. //
  186. // Load the configuration
  187. //
  188. {
  189. Config seConfig;
  190. Config::WrapperIter itBegin;
  191. Config::WrapperIter itEnd;
  192. __MPC_EXIT_IF_METHOD_FAILS(hr, seConfig.GetWrappers( itBegin, itEnd ));
  193. //
  194. // Loop thru all and initialize each search engine.
  195. //
  196. for(; itBegin != itEnd; itBegin++)
  197. {
  198. if(itBegin->m_ths == m_ths)
  199. {
  200. //
  201. // Initialize the wrapper.
  202. // Check to see if one of the search wrappers failed to initialize.
  203. // If failed ignore this wrapper and proceed.
  204. //
  205. if(FAILED(hr = CreateAndAddWrapperToList( lock, itBegin->m_bstrCLSID, itBegin->m_bstrID, itBegin->m_bstrData )))
  206. {
  207. // Log the error
  208. m_fl.LogRecord( L"Could not create wrapper. ID: %s, CLSID: %s, Error: 0x%x", SAFEBSTR(itBegin->m_bstrID), SAFEBSTR(itBegin->m_bstrCLSID), hr );
  209. }
  210. }
  211. }
  212. }
  213. m_fInitialized = true;
  214. }
  215. hr = S_OK;
  216. __MPC_FUNC_CLEANUP;
  217. // If something failed, delete everything
  218. if(FAILED(hr))
  219. {
  220. MPC::ReleaseAll( m_lstWrapperItem );
  221. }
  222. MPC::Release( pNotifier );
  223. __MPC_FUNC_EXIT(hr);
  224. }
  225. HRESULT SearchEngine::Manager::LogRecord( /*[in]*/ BSTR bstrRecord )
  226. {
  227. __HCP_FUNC_ENTRY( "SearchEngine::Manager::LogRecord" );
  228. HRESULT hr = S_OK;
  229. m_fl.LogRecord( L"%s", SAFEBSTR(bstrRecord) );
  230. __MPC_FUNC_EXIT(hr);
  231. }
  232. HRESULT SearchEngine::Manager::NotifyWrapperComplete( /*[in]*/ long lSucceeded, /*[in]*/ IPCHSEWrapperItem* pIPCHSEWICompleted )
  233. {
  234. __HCP_FUNC_ENTRY( "SearchEngine::Manager::NotifyWrapperComplete" );
  235. HRESULT hr;
  236. MPC::SmartLock<_ThreadModel> lock( this );
  237. //
  238. // Register last error number
  239. //
  240. if(FAILED(lSucceeded))
  241. {
  242. m_hrLastError = lSucceeded;
  243. }
  244. //
  245. // Add completed search engine
  246. //
  247. m_lCountComplete++;
  248. //
  249. // Notify that one wrapper has completed
  250. //
  251. lock = NULL;
  252. __MPC_EXIT_IF_METHOD_FAILS(hr, Fire_OnWrapperComplete( pIPCHSEWICompleted ));
  253. lock = this;
  254. //
  255. // Check if all search engines have completed
  256. //
  257. if(m_lCountComplete == m_lEnabledSE)
  258. {
  259. HRESULT hr2 = m_hrLastError;
  260. //
  261. // Notify the client that all search engines have completed
  262. //
  263. lock = NULL;
  264. __MPC_EXIT_IF_METHOD_FAILS(hr, Fire_OnComplete( hr2 ));
  265. lock = this;
  266. //
  267. // reset everything
  268. //
  269. m_lCountComplete = 0;
  270. m_lEnabledSE = 0;
  271. m_hrLastError = S_OK;
  272. }
  273. hr = S_OK;
  274. __MPC_FUNC_CLEANUP;
  275. if(FAILED(hr))
  276. {
  277. CComBSTR bstrName;
  278. CComBSTR bstrID;
  279. lock = NULL;
  280. pIPCHSEWICompleted->get_Name( &bstrName );
  281. pIPCHSEWICompleted->get_ID ( &bstrID );
  282. m_fl.LogRecord( L"WrapperComplete error. Wrapper name: %s. ID: %s, Error: 0x%x", SAFEBSTR(bstrName), SAFEBSTR(bstrID), hr);
  283. }
  284. __MPC_FUNC_EXIT(hr);
  285. }
  286. ////////////////////////////////////////////////////////////////////////////////
  287. HRESULT SearchEngine::Manager::Fire_OnWrapperComplete( /*[in]*/ IPCHSEWrapperItem* pIPCHSEWICompleted )
  288. {
  289. CComVariant pvars[1];
  290. pvars[0] = pIPCHSEWICompleted;
  291. return FireAsync_Generic( DISPID_SE_EVENTS__ONWRAPPERCOMPLETE, pvars, ARRAYSIZE( pvars ), m_WrapperComplete );
  292. }
  293. HRESULT SearchEngine::Manager::Fire_OnComplete( /*[in]*/ long lSucceeded )
  294. {
  295. CComVariant pvars[1];
  296. pvars[0] = lSucceeded;
  297. return FireAsync_Generic( DISPID_SE_EVENTS__ONCOMPLETE, pvars, ARRAYSIZE( pvars ), m_Complete );
  298. }
  299. HRESULT SearchEngine::Manager::Fire_OnProgress( /*[in]*/ long lDone, /*[in]*/ long lTotal, /*[in]*/ BSTR bstrSEWrapperName )
  300. {
  301. CComVariant pvars[3];
  302. pvars[2] = lDone;
  303. pvars[1] = lTotal;
  304. pvars[0] = bstrSEWrapperName;
  305. return FireAsync_Generic( DISPID_SE_EVENTS__ONPROGRESS, pvars, ARRAYSIZE( pvars ), m_Progress );
  306. }
  307. ////////////////////////////////////////////////////////////////////////////////
  308. STDMETHODIMP SearchEngine::Manager::get_QueryString( BSTR *pVal )
  309. {
  310. MPC::SmartLock<_ThreadModel> lock( this );
  311. return MPC::GetBSTR( m_bstrQueryString, pVal );
  312. }
  313. STDMETHODIMP SearchEngine::Manager::put_QueryString( BSTR newVal )
  314. {
  315. MPC::SmartLock<_ThreadModel> lock( this );
  316. return MPC::PutBSTR( m_bstrQueryString, newVal, false );
  317. }
  318. STDMETHODIMP SearchEngine::Manager::get_NumResult(long *pVal)
  319. {
  320. __HCP_BEGIN_PROPERTY_GET2("SearchEngine::Manager::get_NumResult",hr,pVal,m_lNumResult);
  321. __HCP_END_PROPERTY(hr);
  322. }
  323. STDMETHODIMP SearchEngine::Manager::put_NumResult(long newVal)
  324. {
  325. __HCP_BEGIN_PROPERTY_PUT("SearchEngine::Manager::put_NumResult",hr);
  326. m_lNumResult = newVal;
  327. __HCP_END_PROPERTY(hr);
  328. }
  329. STDMETHODIMP SearchEngine::Manager::put_onComplete(IDispatch* function)
  330. {
  331. MPC::SmartLock<_ThreadModel> lock( this );
  332. m_Complete = function;
  333. return S_OK;
  334. }
  335. STDMETHODIMP SearchEngine::Manager::put_onWrapperComplete(IDispatch* function)
  336. {
  337. MPC::SmartLock<_ThreadModel> lock( this );
  338. m_WrapperComplete = function;
  339. return S_OK;
  340. }
  341. STDMETHODIMP SearchEngine::Manager::put_onProgress(IDispatch* function)
  342. {
  343. MPC::SmartLock<_ThreadModel> lock( this );
  344. m_Progress = function;
  345. return S_OK;
  346. }
  347. STDMETHODIMP SearchEngine::Manager::get_SKU( BSTR *pVal )
  348. {
  349. __HCP_BEGIN_PROPERTY_GET("SearchEngine::Manager::get_SKU",hr,pVal);
  350. __MPC_EXIT_IF_METHOD_FAILS(hr, MPC::GetBSTR( m_ths.GetSKU(), pVal ));
  351. __HCP_END_PROPERTY(hr);
  352. }
  353. STDMETHODIMP SearchEngine::Manager::get_LCID( long *pVal )
  354. {
  355. __HCP_BEGIN_PROPERTY_GET2("SearchEngine::Manager::get_LCID",hr,pVal,m_ths.GetLanguage());
  356. __HCP_END_PROPERTY(hr);
  357. }
  358. ////////////////////////////////////////
  359. STDMETHODIMP SearchEngine::Manager::EnumEngine( /*[out,retval]*/ IPCHCollection* *ppC )
  360. {
  361. __HCP_FUNC_ENTRY( "SearchEngine::Manager::EnumEngine" );
  362. HRESULT hr;
  363. CComPtr<CPCHCollection> pColl;
  364. WrapperItemIter it;
  365. MPC::SmartLock<_ThreadModel> lock( this );
  366. __MPC_PARAMCHECK_BEGIN(hr)
  367. __MPC_PARAMCHECK_POINTER_AND_SET(ppC,NULL);
  368. __MPC_PARAMCHECK_END();
  369. __MPC_EXIT_IF_METHOD_FAILS(hr, Initialize( lock ));
  370. //
  371. // Create the Enumerator
  372. //
  373. __MPC_EXIT_IF_METHOD_FAILS(hr, MPC::CreateInstance( &pColl ));
  374. //
  375. // Loop through the list
  376. //
  377. for(it = m_lstWrapperItem.begin(); it != m_lstWrapperItem.end(); it++)
  378. {
  379. //
  380. // Add the item to the collection
  381. //
  382. __MPC_EXIT_IF_METHOD_FAILS(hr, pColl->AddItem( *it ));
  383. }
  384. __MPC_EXIT_IF_METHOD_FAILS(hr, pColl.QueryInterface( ppC ));
  385. hr = S_OK;
  386. __MPC_FUNC_CLEANUP;
  387. __MPC_FUNC_EXIT(hr);
  388. }
  389. STDMETHODIMP SearchEngine::Manager::ExecuteAsynchQuery()
  390. {
  391. __HCP_FUNC_ENTRY( "SearchEngine::Wrap::ExecAsyncQuery" );
  392. HRESULT hr;
  393. //
  394. // Create a thread to execute the query
  395. //
  396. __MPC_EXIT_IF_METHOD_FAILS(hr, Thread_Start( this, ExecQuery, NULL ));
  397. hr = S_OK;
  398. __MPC_FUNC_CLEANUP;
  399. __MPC_FUNC_EXIT(hr);
  400. }
  401. HRESULT SearchEngine::Manager::ExecQuery()
  402. {
  403. __HCP_FUNC_ENTRY( "SearchEngine::Manager::ExecQuery" );
  404. HRESULT hr;
  405. WrapperItemList lst;
  406. WrapperItemIter it;
  407. CComPtr<IPCHSEManagerInternal> pNotifier;
  408. CComBSTR bstrQueryString;
  409. long lNumResult;
  410. long lEnabledSE = 0;
  411. //
  412. // Make a copy of what we need, only locking the manager during this time.
  413. //
  414. {
  415. MPC::SmartLock<_ThreadModel> lock( this );
  416. //
  417. // Check if there is already a query being executed
  418. //
  419. if(m_lEnabledSE > 0)
  420. {
  421. __MPC_SET_WIN32_ERROR_AND_EXIT(hr, ERROR_NOT_READY);
  422. }
  423. __MPC_EXIT_IF_METHOD_FAILS(hr, Initialize( lock ));
  424. CloneListOfWrappers( lst );
  425. pNotifier = m_Notifier;
  426. bstrQueryString = m_bstrQueryString;
  427. lNumResult = m_lNumResult;
  428. }
  429. for(it = lst.begin(); it != lst.end(); it++)
  430. {
  431. IPCHSEWrapperItem* obj = *it;
  432. VARIANT_BOOL bEnabled;
  433. //
  434. // Check if the search engine is enabled
  435. //
  436. if(SUCCEEDED(obj->get_Enabled( &bEnabled )) && bEnabled == VARIANT_TRUE)
  437. {
  438. CComPtr<IPCHSEWrapperInternal> pSEInternal;
  439. if(SUCCEEDED(obj ->QueryInterface ( IID_IPCHSEWrapperInternal, (void **)&pSEInternal )) && // Get the Internal Wrapper Interface
  440. SUCCEEDED(pSEInternal->put_QueryString ( bstrQueryString )) && // Insert the query string
  441. SUCCEEDED(pSEInternal->put_NumResult ( lNumResult )) && // Insert the Number of results expected
  442. SUCCEEDED(pSEInternal->SECallbackInterface( pNotifier )) && // Insert the Internal manager interface
  443. SUCCEEDED(pSEInternal->ExecAsyncQuery ( )) ) // Execute the query and increment the count
  444. {
  445. lEnabledSE++;
  446. }
  447. }
  448. }
  449. {
  450. MPC::SmartLock<_ThreadModel> lock( this );
  451. m_lEnabledSE = lEnabledSE;
  452. }
  453. hr = S_OK;
  454. __MPC_FUNC_CLEANUP;
  455. MPC::ReleaseAll( lst );
  456. Thread_Abort();
  457. __MPC_FUNC_EXIT(hr);
  458. }
  459. STDMETHODIMP SearchEngine::Manager::AbortQuery()
  460. {
  461. __HCP_FUNC_ENTRY( "SearchEngine::Manager::AbortQuery" );
  462. HRESULT hr;
  463. WrapperItemList lst;
  464. WrapperItemIter it;
  465. //
  466. // Copy list under lock.
  467. //
  468. {
  469. MPC::SmartLock<_ThreadModel> lock( this );
  470. CloneListOfWrappers( lst );
  471. }
  472. //
  473. // Loop through the list
  474. //
  475. for(it = lst.begin(); it != lst.end(); it++)
  476. {
  477. CComPtr<IPCHSEWrapperInternal> pSEInternal;
  478. //
  479. // Get the Internal Wrapper Interface
  480. //
  481. __MPC_EXIT_IF_METHOD_FAILS(hr, (*it)->QueryInterface( IID_IPCHSEWrapperInternal, (void **)&pSEInternal ));
  482. //
  483. // Abort the query
  484. //
  485. __MPC_EXIT_IF_METHOD_FAILS(hr, pSEInternal->AbortQuery());
  486. }
  487. hr = S_OK;
  488. __MPC_FUNC_CLEANUP;
  489. MPC::ReleaseAll( lst );
  490. //
  491. // reset everything
  492. //
  493. {
  494. MPC::SmartLock<_ThreadModel> lock( this );
  495. m_lCountComplete = 0;
  496. m_lEnabledSE = 0;
  497. m_hrLastError = S_OK;
  498. }
  499. __MPC_FUNC_EXIT(hr);
  500. }
  501. ////////////////////////////////////////////////////////////////////////////////
  502. STDMETHODIMP SearchEngine::ManagerInternal::WrapperComplete( /*[in]*/ long lSucceeded, /*[in]*/ IPCHSEWrapperItem* pIPCHSEWICompleted )
  503. {
  504. CComPtr<SearchEngine::Manager> pMgr;
  505. Child_GetParent( &pMgr );
  506. return pMgr ? pMgr->NotifyWrapperComplete( lSucceeded, pIPCHSEWICompleted ) : E_POINTER;
  507. }
  508. STDMETHODIMP SearchEngine::ManagerInternal::IsNetworkAlive( /*[out]*/ VARIANT_BOOL *pvbVar )
  509. {
  510. CComPtr<SearchEngine::Manager> pMgr;
  511. Child_GetParent( &pMgr );
  512. return pMgr ? pMgr->IsNetworkAlive( pvbVar ) : E_POINTER;
  513. }
  514. STDMETHODIMP SearchEngine::ManagerInternal::IsDestinationReachable( /*[in ]*/ BSTR bstrDestination, /*[out]*/ VARIANT_BOOL *pvbVar )
  515. {
  516. CComPtr<SearchEngine::Manager> pMgr;
  517. Child_GetParent( &pMgr );
  518. return pMgr ? pMgr->IsDestinationReachable( bstrDestination, pvbVar ) : E_POINTER;
  519. }
  520. STDMETHODIMP SearchEngine::ManagerInternal::LogRecord( /*[in]*/ BSTR bstrRecord )
  521. {
  522. CComPtr<SearchEngine::Manager> pMgr;
  523. Child_GetParent( &pMgr );
  524. return pMgr ? pMgr->LogRecord( bstrRecord ) : E_POINTER;
  525. }