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.

850 lines
24 KiB

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