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.

800 lines
22 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. provider.cpp
  7. Main Mode Policy node handler
  8. FILE HISTORY:
  9. */
  10. #include "stdafx.h"
  11. #include "server.h"
  12. #include "QmPol.h"
  13. #include "QmPolpp.h"
  14. #include "SpdUtil.h"
  15. /*---------------------------------------------------------------------------
  16. Class CQmPolicyHandler implementation
  17. ---------------------------------------------------------------------------*/
  18. /*---------------------------------------------------------------------------
  19. Constructor and destructor
  20. Description
  21. Author: NSun
  22. ---------------------------------------------------------------------------*/
  23. CQmPolicyHandler::CQmPolicyHandler
  24. (
  25. ITFSComponentData * pComponentData
  26. ) : CIpsmHandler(pComponentData)
  27. {
  28. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  29. }
  30. CQmPolicyHandler::~CQmPolicyHandler()
  31. {
  32. }
  33. /*!--------------------------------------------------------------------------
  34. CQmPolicyHandler::InitializeNode
  35. Initializes node specific data
  36. Author: NSun
  37. ---------------------------------------------------------------------------*/
  38. HRESULT
  39. CQmPolicyHandler::InitializeNode
  40. (
  41. ITFSNode * pNode
  42. )
  43. {
  44. AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
  45. CString strTemp;
  46. strTemp.LoadString(IDS_QM_POL_NODE);
  47. SetDisplayName(strTemp);
  48. // Make the node immediately visible
  49. pNode->SetVisibilityState(TFS_VIS_SHOW);
  50. pNode->SetData(TFS_DATA_COOKIE, (LPARAM) pNode);
  51. pNode->SetData(TFS_DATA_IMAGEINDEX, ICON_IDX_FOLDER_CLOSED);
  52. pNode->SetData(TFS_DATA_OPENIMAGEINDEX, ICON_IDX_FOLDER_OPEN);
  53. pNode->SetData(TFS_DATA_USER, (LPARAM) this);
  54. pNode->SetData(TFS_DATA_TYPE, IPSECMON_QM_POLICY);
  55. pNode->SetData(TFS_DATA_SCOPE_LEAF_NODE, TRUE);
  56. SetColumnStringIDs(&aColumns[IPSECMON_QM_POLICY][0]);
  57. SetColumnWidths(&aColumnWidths[IPSECMON_QM_POLICY][0]);
  58. return hrOK;
  59. }
  60. /*---------------------------------------------------------------------------
  61. CQmPolicyHandler::GetImageIndex
  62. -
  63. Author: NSun
  64. ---------------------------------------------------------------------------*/
  65. int
  66. CQmPolicyHandler::GetImageIndex(BOOL bOpenImage)
  67. {
  68. int nIndex = -1;
  69. return nIndex;
  70. }
  71. /*---------------------------------------------------------------------------
  72. Overridden base handler functions
  73. ---------------------------------------------------------------------------*/
  74. /*---------------------------------------------------------------------------
  75. CQmPolicyHandler::OnAddMenuItems
  76. Adds context menu items for the SA scope pane node
  77. Author: NSun
  78. ---------------------------------------------------------------------------*/
  79. STDMETHODIMP
  80. CQmPolicyHandler::OnAddMenuItems
  81. (
  82. ITFSNode * pNode,
  83. LPCONTEXTMENUCALLBACK pContextMenuCallback,
  84. LPDATAOBJECT lpDataObject,
  85. DATA_OBJECT_TYPES type,
  86. DWORD dwType,
  87. long * pInsertionAllowed
  88. )
  89. {
  90. AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
  91. LONG fFlags = 0, fLoadingFlags = 0;
  92. HRESULT hr = S_OK;
  93. CString strMenuItem;
  94. if (type == CCT_SCOPE)
  95. {
  96. if (*pInsertionAllowed & CCM_INSERTIONALLOWED_TOP)
  97. {
  98. }
  99. }
  100. return hr;
  101. }
  102. /*!--------------------------------------------------------------------------
  103. CQmPolicyHandler::AddMenuItems
  104. Adds context menu items for virtual list box (result pane) items
  105. Author: NSun
  106. ---------------------------------------------------------------------------*/
  107. STDMETHODIMP
  108. CQmPolicyHandler::AddMenuItems
  109. (
  110. ITFSComponent * pComponent,
  111. MMC_COOKIE cookie,
  112. LPDATAOBJECT pDataObject,
  113. LPCONTEXTMENUCALLBACK pContextMenuCallback,
  114. long * pInsertionAllowed
  115. )
  116. {
  117. AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
  118. HRESULT hr = hrOK;
  119. CString strMenuItem;
  120. SPINTERNAL spInternal;
  121. LONG fFlags = 0;
  122. spInternal = ExtractInternalFormat(pDataObject);
  123. // virtual listbox notifications come to the handler of the node that is selected.
  124. // check to see if this notification is for a virtual listbox item or this SA
  125. // node itself.
  126. if (*pInsertionAllowed & CCM_INSERTIONALLOWED_VIEW)
  127. {
  128. //load and view menu items here
  129. }
  130. return hr;
  131. }
  132. /*!--------------------------------------------------------------------------
  133. CQmPolicyHandler::OnRefresh
  134. Default implementation for the refresh functionality
  135. Author: NSun
  136. ---------------------------------------------------------------------------*/
  137. HRESULT
  138. CQmPolicyHandler::OnRefresh
  139. (
  140. ITFSNode * pNode,
  141. LPDATAOBJECT pDataObject,
  142. DWORD dwType,
  143. LPARAM arg,
  144. LPARAM param
  145. )
  146. {
  147. HRESULT hr = S_OK;
  148. int i = 0;
  149. SPIConsole spConsole;
  150. CORg(CHandler::OnRefresh(pNode, pDataObject, dwType, arg, param));
  151. CORg(m_spSpdInfo->EnumQmPolicies());
  152. i = m_spSpdInfo->GetQmPolicyCount();
  153. // now notify the virtual listbox
  154. CORg ( m_spNodeMgr->GetConsole(&spConsole) );
  155. CORg ( spConsole->UpdateAllViews(pDataObject, i, RESULT_PANE_SET_VIRTUAL_LB_SIZE));
  156. Error:
  157. return hr;
  158. }
  159. /*---------------------------------------------------------------------------
  160. CQmPolicyHandler::OnCommand
  161. Handles context menu commands for QM Policy scope pane node
  162. Author: NSun
  163. ---------------------------------------------------------------------------*/
  164. STDMETHODIMP
  165. CQmPolicyHandler::OnCommand
  166. (
  167. ITFSNode * pNode,
  168. long nCommandId,
  169. DATA_OBJECT_TYPES type,
  170. LPDATAOBJECT pDataObject,
  171. DWORD dwType
  172. )
  173. {
  174. AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
  175. //handle the scope context menu commands here
  176. return S_OK;
  177. }
  178. /*!--------------------------------------------------------------------------
  179. CQmPolicyHandler::Command
  180. Handles context menu commands for virtual listbox items
  181. Author: NSun
  182. ---------------------------------------------------------------------------*/
  183. STDMETHODIMP
  184. CQmPolicyHandler::Command
  185. (
  186. ITFSComponent * pComponent,
  187. MMC_COOKIE cookie,
  188. int nCommandID,
  189. LPDATAOBJECT pDataObject
  190. )
  191. {
  192. AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
  193. HRESULT hr = S_OK;
  194. SPITFSNode spNode;
  195. m_spResultNodeMgr->FindNode(cookie, &spNode);
  196. // handle result context menu and view menus here
  197. return hr;
  198. }
  199. /*!--------------------------------------------------------------------------
  200. CQmPolicyHandler::HasPropertyPages
  201. Implementation of ITFSNodeHandler::HasPropertyPages
  202. NOTE: the root node handler has to over-ride this function to
  203. handle the snapin manager property page (wizard) case!!!
  204. Author: KennT
  205. ---------------------------------------------------------------------------*/
  206. STDMETHODIMP
  207. CQmPolicyHandler::HasPropertyPages
  208. (
  209. ITFSNode * pNode,
  210. LPDATAOBJECT pDataObject,
  211. DATA_OBJECT_TYPES type,
  212. DWORD dwType
  213. )
  214. {
  215. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  216. return hrFalse;
  217. }
  218. /*---------------------------------------------------------------------------
  219. CQmPolicyHandler::CreatePropertyPages
  220. Description
  221. Author: NSun
  222. ---------------------------------------------------------------------------*/
  223. STDMETHODIMP
  224. CQmPolicyHandler::CreatePropertyPages
  225. (
  226. ITFSNode * pNode,
  227. LPPROPERTYSHEETCALLBACK lpSA,
  228. LPDATAOBJECT pDataObject,
  229. LONG_PTR handle,
  230. DWORD dwType
  231. )
  232. {
  233. return hrFalse;
  234. }
  235. /*---------------------------------------------------------------------------
  236. CQmPolicyHandler::OnPropertyChange
  237. Description
  238. Author: NSun
  239. ---------------------------------------------------------------------------*/
  240. HRESULT
  241. CQmPolicyHandler::OnPropertyChange
  242. (
  243. ITFSNode * pNode,
  244. LPDATAOBJECT pDataobject,
  245. DWORD dwType,
  246. LPARAM arg,
  247. LPARAM lParam
  248. )
  249. {
  250. AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
  251. //CServerProperties * pServerProp = reinterpret_cast<CServerProperties *>(lParam);
  252. LONG_PTR changeMask = 0;
  253. // tell the property page to do whatever now that we are back on the
  254. // main thread
  255. //pServerProp->OnPropertyChange(TRUE, &changeMask);
  256. //pServerProp->AcknowledgeNotify();
  257. if (changeMask)
  258. pNode->ChangeNode(changeMask);
  259. return hrOK;
  260. }
  261. /*---------------------------------------------------------------------------
  262. CQmPolicyHandler::OnExpand
  263. Handles enumeration of a scope item
  264. Author: NSun
  265. ---------------------------------------------------------------------------*/
  266. HRESULT
  267. CQmPolicyHandler::OnExpand
  268. (
  269. ITFSNode * pNode,
  270. LPDATAOBJECT pDataObject,
  271. DWORD dwType,
  272. LPARAM arg,
  273. LPARAM param
  274. )
  275. {
  276. HRESULT hr = hrOK;
  277. if (m_bExpanded)
  278. return hr;
  279. // do the default handling
  280. CORg (CIpsmHandler::OnExpand(pNode, pDataObject, dwType, arg, param));
  281. Error:
  282. return hr;
  283. }
  284. /*!--------------------------------------------------------------------------
  285. CQmPolicyHandler::OnResultSelect
  286. Handles the MMCN_SELECT notifcation
  287. Author: NSun
  288. ---------------------------------------------------------------------------*/
  289. HRESULT
  290. CQmPolicyHandler::OnResultSelect
  291. (
  292. ITFSComponent * pComponent,
  293. LPDATAOBJECT pDataObject,
  294. MMC_COOKIE cookie,
  295. LPARAM arg,
  296. LPARAM lParam
  297. )
  298. {
  299. AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
  300. HRESULT hr = hrOK;
  301. SPINTERNAL spInternal;
  302. SPIConsole spConsole;
  303. SPIConsoleVerb spConsoleVerb;
  304. SPITFSNode spNode;
  305. BOOL bStates[ARRAYLEN(g_ConsoleVerbs)];
  306. int i;
  307. LONG_PTR dwNodeType;
  308. BOOL fSelect = HIWORD(arg);
  309. // virtual listbox notifications come to the handler of the node that is selected.
  310. // check to see if this notification is for a virtual listbox item or the active
  311. // registrations node itself.
  312. CORg (pComponent->GetConsoleVerb(&spConsoleVerb));
  313. m_verbDefault = MMC_VERB_OPEN;
  314. if (!fSelect)
  315. {
  316. return hr;
  317. }
  318. if (m_spSpdInfo)
  319. {
  320. DWORD dwInitInfo;
  321. dwInitInfo=m_spSpdInfo->GetInitInfo();
  322. if (!(dwInitInfo & MON_QM_POLICY)) {
  323. CORg(m_spSpdInfo->EnumQmPolicies());
  324. m_spSpdInfo->SetInitInfo(dwInitInfo | MON_QM_POLICY);
  325. }
  326. m_spSpdInfo->SetActiveInfo(MON_QM_POLICY);
  327. // Get the current count
  328. i = m_spSpdInfo->GetQmPolicyCount();
  329. // now notify the virtual listbox
  330. CORg ( m_spNodeMgr->GetConsole(&spConsole) );
  331. CORg ( spConsole->UpdateAllViews(pDataObject, i, RESULT_PANE_SET_VIRTUAL_LB_SIZE) );
  332. }
  333. // now update the verbs...
  334. spInternal = ExtractInternalFormat(pDataObject);
  335. Assert(spInternal);
  336. if (spInternal->HasVirtualIndex())
  337. {
  338. //TODO add to here if we want to have some result console verbs
  339. // we gotta do special stuff for the virtual index items
  340. dwNodeType = IPSECMON_QM_POLICY_ITEM;
  341. for (i = 0; i < ARRAYLEN(g_ConsoleVerbs); bStates[i++] = FALSE);
  342. //enable the "properties" menu
  343. bStates[MMC_VERB_PROPERTIES & 0x000F] = TRUE;
  344. m_verbDefault = MMC_VERB_PROPERTIES;
  345. }
  346. else
  347. {
  348. // enable/disable delete depending if the node supports it
  349. CORg (m_spNodeMgr->FindNode(cookie, &spNode));
  350. dwNodeType = spNode->GetData(TFS_DATA_TYPE);
  351. for (i = 0; i < ARRAYLEN(g_ConsoleVerbs); bStates[i++] = TRUE);
  352. //hide "delete" context menu
  353. bStates[MMC_VERB_DELETE & 0x000F] = FALSE;
  354. }
  355. EnableVerbs(spConsoleVerb, g_ConsoleVerbStates[dwNodeType], bStates);
  356. COM_PROTECT_ERROR_LABEL;
  357. return hr;
  358. }
  359. /*!--------------------------------------------------------------------------
  360. CQmPolicyHandler::OnDelete
  361. The base handler calls this when MMC sends a MMCN_DELETE for a
  362. scope pane item. We just call our delete command handler.
  363. Author: NSun
  364. ---------------------------------------------------------------------------*/
  365. HRESULT
  366. CQmPolicyHandler::OnDelete
  367. (
  368. ITFSNode * pNode,
  369. LPARAM arg,
  370. LPARAM lParam
  371. )
  372. {
  373. return S_FALSE;
  374. }
  375. /*!--------------------------------------------------------------------------
  376. CQmPolicyHandler::HasPropertyPages
  377. Handle the result notification
  378. Author: NSun
  379. ---------------------------------------------------------------------------*/
  380. STDMETHODIMP
  381. CQmPolicyHandler::HasPropertyPages(
  382. ITFSComponent *pComponent,
  383. MMC_COOKIE cookie,
  384. LPDATAOBJECT pDataObject)
  385. {
  386. return hrOK;
  387. }
  388. /*!--------------------------------------------------------------------------
  389. CQmPolicyHandler::HasPropertyPages
  390. Handle the result notification. Create the filter property sheet
  391. Author: NSun
  392. ---------------------------------------------------------------------------*/
  393. STDMETHODIMP CQmPolicyHandler::CreatePropertyPages
  394. (
  395. ITFSComponent * pComponent,
  396. MMC_COOKIE cookie,
  397. LPPROPERTYSHEETCALLBACK lpProvider,
  398. LPDATAOBJECT pDataObject,
  399. LONG_PTR handle
  400. )
  401. {
  402. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  403. HRESULT hr = hrOK;
  404. SPINTERNAL spInternal;
  405. SPITFSNode spNode;
  406. int nIndex;
  407. SPIComponentData spComponentData;
  408. CQmPolicyInfo PolInfo;
  409. CQmPolicyProperties * pQmPolProp;
  410. Assert(m_spNodeMgr);
  411. CORg( m_spNodeMgr->FindNode(cookie, &spNode) );
  412. CORg( m_spNodeMgr->GetComponentData(&spComponentData) );
  413. spInternal = ExtractInternalFormat(pDataObject);
  414. // virtual listbox notifications come to the handler of the node that is selected.
  415. // assert that this notification is for a virtual listbox item
  416. Assert(spInternal);
  417. if (!spInternal->HasVirtualIndex())
  418. return hr;
  419. nIndex = spInternal->GetVirtualIndex();
  420. CORg(m_spSpdInfo->GetQmPolicyInfo(nIndex, &PolInfo));
  421. pQmPolProp = new CQmPolicyProperties(
  422. spNode,
  423. spComponentData,
  424. m_spTFSCompData,
  425. &PolInfo,
  426. m_spSpdInfo,
  427. NULL);
  428. hr = pQmPolProp->CreateModelessSheet(lpProvider, handle);
  429. COM_PROTECT_ERROR_LABEL;
  430. return hr;
  431. }
  432. /*---------------------------------------------------------------------------
  433. CQmPolicyHandler::OnGetResultViewType
  434. Return the result view that this node is going to support
  435. Author: NSun
  436. ---------------------------------------------------------------------------*/
  437. HRESULT
  438. CQmPolicyHandler::OnGetResultViewType
  439. (
  440. ITFSComponent * pComponent,
  441. MMC_COOKIE cookie,
  442. LPOLESTR * ppViewType,
  443. long * pViewOptions
  444. )
  445. {
  446. if (cookie != NULL)
  447. {
  448. *pViewOptions = MMC_VIEW_OPTIONS_OWNERDATALIST;
  449. }
  450. return S_FALSE;
  451. }
  452. /*---------------------------------------------------------------------------
  453. CQmPolicyHandler::GetVirtualImage
  454. Returns the image index for virtual listbox items
  455. Author: NSun
  456. ---------------------------------------------------------------------------*/
  457. int
  458. CQmPolicyHandler::GetVirtualImage
  459. (
  460. int nIndex
  461. )
  462. {
  463. return ICON_IDX_POLICY;
  464. }
  465. /*---------------------------------------------------------------------------
  466. CQmPolicyHandler::GetVirtualString
  467. returns a pointer to the string for virtual listbox items
  468. Author: NSun
  469. ---------------------------------------------------------------------------*/
  470. LPCWSTR
  471. CQmPolicyHandler::GetVirtualString
  472. (
  473. int nIndex,
  474. int nCol
  475. )
  476. {
  477. HRESULT hr = S_OK;
  478. static CString strTemp;
  479. strTemp.Empty();
  480. if (nCol >= DimensionOf(aColumns[IPSECMON_QM_POLICY]))
  481. return NULL;
  482. CQmPolicyInfo QmPol;
  483. CORg(m_spSpdInfo->GetQmPolicyInfo(nIndex, &QmPol));
  484. switch (aColumns[IPSECMON_QM_POLICY][nCol])
  485. {
  486. case IDS_COL_QM_POL_NAME:
  487. strTemp = QmPol.m_stName;
  488. return strTemp;
  489. break;
  490. case IDS_COL_QM_POL_OFFER:
  491. strTemp.Format(_T("%d"), QmPol.m_arrOffers.GetSize());
  492. return strTemp;
  493. break;
  494. default:
  495. Panic0("CQmPolicyHandler::GetVirtualString - Unknown column!\n");
  496. break;
  497. }
  498. COM_PROTECT_ERROR_LABEL;
  499. return NULL;
  500. }
  501. /*---------------------------------------------------------------------------
  502. CQmPolicyHandler::CacheHint
  503. MMC tells us which items it will need before it requests things
  504. Author: NSun
  505. ---------------------------------------------------------------------------*/
  506. STDMETHODIMP
  507. CQmPolicyHandler::CacheHint
  508. (
  509. int nStartIndex,
  510. int nEndIndex
  511. )
  512. {
  513. HRESULT hr = hrOK;;
  514. Trace2("CacheHint - Start %d, End %d\n", nStartIndex, nEndIndex);
  515. return hr;
  516. }
  517. /*---------------------------------------------------------------------------
  518. CQmPolicyHandler::SortItems
  519. We are responsible for sorting of virtual listbox items
  520. Author: NSun
  521. ---------------------------------------------------------------------------*/
  522. STDMETHODIMP
  523. CQmPolicyHandler::SortItems
  524. (
  525. int nColumn,
  526. DWORD dwSortOptions,
  527. LPARAM lUserParam
  528. )
  529. {
  530. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  531. HRESULT hr = S_OK;
  532. if (nColumn >= DimensionOf(aColumns[IPSECMON_QM_POLICY]))
  533. return E_INVALIDARG;
  534. BEGIN_WAIT_CURSOR
  535. DWORD dwIndexType = aColumns[IPSECMON_QM_POLICY][nColumn];
  536. hr = m_spSpdInfo->SortQmPolicies(dwIndexType, dwSortOptions);
  537. END_WAIT_CURSOR
  538. return hrOK;
  539. }
  540. /*!--------------------------------------------------------------------------
  541. CQmPolicyHandler::OnResultUpdateView
  542. Implementation of ITFSResultHandler::OnResultUpdateView
  543. Author: NSun
  544. ---------------------------------------------------------------------------*/
  545. HRESULT CQmPolicyHandler::OnResultUpdateView
  546. (
  547. ITFSComponent *pComponent,
  548. LPDATAOBJECT pDataObject,
  549. LPARAM data,
  550. LONG_PTR hint
  551. )
  552. {
  553. HRESULT hr = hrOK;
  554. SPITFSNode spSelectedNode;
  555. pComponent->GetSelectedNode(&spSelectedNode);
  556. if (spSelectedNode == NULL)
  557. return S_OK; // no selection for our IComponentData
  558. if ( hint == IPSECMON_UPDATE_STATUS )
  559. {
  560. SPINTERNAL spInternal = ExtractInternalFormat(pDataObject);
  561. ITFSNode * pNode = reinterpret_cast<ITFSNode *>(spInternal->m_cookie);
  562. SPITFSNode spSelectedNode;
  563. pComponent->GetSelectedNode(&spSelectedNode);
  564. if (pNode == spSelectedNode)
  565. {
  566. // if we are the selected node, then we need to update
  567. SPIResultData spResultData;
  568. CORg (pComponent->GetResultData(&spResultData));
  569. CORg (spResultData->SetItemCount((int) data, MMCLV_UPDATE_NOSCROLL));
  570. }
  571. }
  572. else
  573. {
  574. // we don't handle this message, let the base class do it.
  575. return CIpsmHandler::OnResultUpdateView(pComponent, pDataObject, data, hint);
  576. }
  577. COM_PROTECT_ERROR_LABEL;
  578. return hr;
  579. }
  580. /*!--------------------------------------------------------------------------
  581. CQmPolicyHandler::LoadColumns
  582. Set the correct column header and then call the base class
  583. Author: NSun
  584. ---------------------------------------------------------------------------*/
  585. HRESULT
  586. CQmPolicyHandler::LoadColumns
  587. (
  588. ITFSComponent * pComponent,
  589. MMC_COOKIE cookie,
  590. LPARAM arg,
  591. LPARAM lParam
  592. )
  593. {
  594. //set column info
  595. return CIpsmHandler::LoadColumns(pComponent, cookie, arg, lParam);
  596. }
  597. /*---------------------------------------------------------------------------
  598. Command handlers
  599. ---------------------------------------------------------------------------*/
  600. /*---------------------------------------------------------------------------
  601. CQmPolicyHandler::OnDelete
  602. Removes a service SA
  603. Author: NSun
  604. ---------------------------------------------------------------------------*/
  605. HRESULT
  606. CQmPolicyHandler::OnDelete
  607. (
  608. ITFSNode * pNode
  609. )
  610. {
  611. HRESULT hr = S_FALSE;
  612. return hr;
  613. }
  614. /*---------------------------------------------------------------------------
  615. CQmPolicyHandler::UpdateStatus
  616. -
  617. Author: NSun
  618. ---------------------------------------------------------------------------*/
  619. HRESULT
  620. CQmPolicyHandler::UpdateStatus
  621. (
  622. ITFSNode * pNode
  623. )
  624. {
  625. HRESULT hr = hrOK;
  626. SPIComponentData spComponentData;
  627. SPIConsole spConsole;
  628. IDataObject * pDataObject;
  629. SPIDataObject spDataObject;
  630. int i = 0;
  631. Trace0("CQmPolicyHandler::UpdateStatus - Updating status for Filter");
  632. // force the listbox to update. We do this by setting the count and
  633. // telling it to invalidate the data
  634. CORg(m_spNodeMgr->GetComponentData(&spComponentData));
  635. CORg(m_spNodeMgr->GetConsole(&spConsole));
  636. // grab a data object to use
  637. CORg(spComponentData->QueryDataObject((MMC_COOKIE) pNode, CCT_RESULT, &pDataObject) );
  638. spDataObject = pDataObject;
  639. i = m_spSpdInfo->GetQmPolicyCount();
  640. CORg(spConsole->UpdateAllViews(pDataObject, i, IPSECMON_UPDATE_STATUS));
  641. COM_PROTECT_ERROR_LABEL;
  642. return hr;
  643. }
  644. /*---------------------------------------------------------------------------
  645. Misc functions
  646. ---------------------------------------------------------------------------*/
  647. /*---------------------------------------------------------------------------
  648. CQmPolicyHandler::InitData
  649. Initializes data for this node
  650. Author: NSun
  651. ---------------------------------------------------------------------------*/
  652. HRESULT
  653. CQmPolicyHandler::InitData
  654. (
  655. ISpdInfo * pSpdInfo
  656. )
  657. {
  658. m_spSpdInfo.Set(pSpdInfo);
  659. return hrOK;
  660. }