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.

821 lines
22 KiB

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