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.

827 lines
22 KiB

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