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.

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