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.

842 lines
24 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 2002 **/
  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. IConsole2 *pConsole2 = NULL;
  324. //get pConsole2 for writing to the status bar, if fails not to worry
  325. pComponent->GetConsole(&pConsole2);
  326. // virtual listbox notifications come to the handler of the node that is selected.
  327. // check to see if this notification is for a virtual listbox item or the active
  328. // registrations node itself.
  329. CORg (pComponent->GetConsoleVerb(&spConsoleVerb));
  330. m_verbDefault = MMC_VERB_OPEN;
  331. if (!fSelect)
  332. {
  333. if(pConsole2) {
  334. pConsole2->SetStatusText(_T(""));
  335. pConsole2->Release();
  336. }
  337. return hr;
  338. }
  339. if (m_spSpdInfo)
  340. {
  341. DWORD dwInitInfo;
  342. dwInitInfo=m_spSpdInfo->GetInitInfo();
  343. if (!(dwInitInfo & MON_MM_POLICY)) {
  344. CORg(m_spSpdInfo->EnumMmPolicies());
  345. m_spSpdInfo->SetInitInfo(dwInitInfo | MON_MM_POLICY);
  346. }
  347. m_spSpdInfo->SetActiveInfo(MON_MM_POLICY);
  348. // Get the current count
  349. i = m_spSpdInfo->GetMmPolicyCount();
  350. // now notify the virtual listbox
  351. CORg ( m_spNodeMgr->GetConsole(&spConsole) );
  352. CORg ( spConsole->UpdateAllViews(pDataObject, i, RESULT_PANE_SET_VIRTUAL_LB_SIZE) );
  353. if(pConsole2)
  354. {
  355. CString strTemp;
  356. WCHAR szTemp[20];
  357. wsprintf(szTemp, L"%d", i);
  358. AfxFormatString1(strTemp, IDS_STATUS_NUM_ITEMS, szTemp);
  359. LPCTSTR szNumItems = (LPCTSTR) strTemp;
  360. pConsole2->SetStatusText((LPOLESTR)szNumItems);
  361. pConsole2->Release();
  362. }
  363. }
  364. // now update the verbs...
  365. spInternal = ExtractInternalFormat(pDataObject);
  366. Assert(spInternal);
  367. if (spInternal->HasVirtualIndex())
  368. {
  369. //TODO add to here if we want to have some result console verbs
  370. // we gotta do special stuff for the virtual index items
  371. dwNodeType = IPSECMON_MM_POLICY_ITEM;
  372. for (i = 0; i < ARRAYLEN(g_ConsoleVerbs); bStates[i++] = FALSE);
  373. //enable the "properties" menu
  374. bStates[MMC_VERB_PROPERTIES & 0x000F] = TRUE;
  375. m_verbDefault = MMC_VERB_PROPERTIES;
  376. }
  377. else
  378. {
  379. // enable/disable delete depending if the node supports it
  380. CORg (m_spNodeMgr->FindNode(cookie, &spNode));
  381. dwNodeType = spNode->GetData(TFS_DATA_TYPE);
  382. for (i = 0; i < ARRAYLEN(g_ConsoleVerbs); bStates[i++] = TRUE);
  383. //hide "delete" context menu
  384. bStates[MMC_VERB_DELETE & 0x000F] = FALSE;
  385. }
  386. EnableVerbs(spConsoleVerb, g_ConsoleVerbStates[dwNodeType], bStates);
  387. COM_PROTECT_ERROR_LABEL;
  388. return hr;
  389. }
  390. /*!--------------------------------------------------------------------------
  391. CMmPolicyHandler::OnDelete
  392. The base handler calls this when MMC sends a MMCN_DELETE for a
  393. scope pane item. We just call our delete command handler.
  394. Author: NSun
  395. ---------------------------------------------------------------------------*/
  396. HRESULT
  397. CMmPolicyHandler::OnDelete
  398. (
  399. ITFSNode * pNode,
  400. LPARAM arg,
  401. LPARAM lParam
  402. )
  403. {
  404. return S_FALSE;
  405. }
  406. /*!--------------------------------------------------------------------------
  407. CMmPolicyHandler::HasPropertyPages
  408. Handle the result notification
  409. Author: NSun
  410. ---------------------------------------------------------------------------*/
  411. STDMETHODIMP
  412. CMmPolicyHandler::HasPropertyPages(
  413. ITFSComponent *pComponent,
  414. MMC_COOKIE cookie,
  415. LPDATAOBJECT pDataObject)
  416. {
  417. return hrOK;
  418. }
  419. /*!--------------------------------------------------------------------------
  420. CMmPolicyHandler::HasPropertyPages
  421. Handle the result notification. Create the filter property sheet
  422. Author: NSun
  423. ---------------------------------------------------------------------------*/
  424. STDMETHODIMP CMmPolicyHandler::CreatePropertyPages
  425. (
  426. ITFSComponent * pComponent,
  427. MMC_COOKIE cookie,
  428. LPPROPERTYSHEETCALLBACK lpProvider,
  429. LPDATAOBJECT pDataObject,
  430. LONG_PTR handle
  431. )
  432. {
  433. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  434. HRESULT hr = hrOK;
  435. SPINTERNAL spInternal;
  436. SPITFSNode spNode;
  437. int nIndex;
  438. SPIComponentData spComponentData;
  439. CMmPolicyInfo PolInfo;
  440. CMmPolicyProperties * pMmPolProp;
  441. Assert(m_spNodeMgr);
  442. CORg( m_spNodeMgr->FindNode(cookie, &spNode) );
  443. CORg( m_spNodeMgr->GetComponentData(&spComponentData) );
  444. spInternal = ExtractInternalFormat(pDataObject);
  445. // virtual listbox notifications come to the handler of the node that is selected.
  446. // assert that this notification is for a virtual listbox item
  447. Assert(spInternal);
  448. if (!spInternal->HasVirtualIndex())
  449. return hr;
  450. nIndex = spInternal->GetVirtualIndex();
  451. CORg(m_spSpdInfo->GetMmPolicyInfo(nIndex, &PolInfo));
  452. pMmPolProp = new CMmPolicyProperties(
  453. spNode,
  454. spComponentData,
  455. m_spTFSCompData,
  456. &PolInfo,
  457. m_spSpdInfo,
  458. NULL);
  459. hr = pMmPolProp->CreateModelessSheet(lpProvider, handle);
  460. COM_PROTECT_ERROR_LABEL;
  461. return hr;
  462. }
  463. /*---------------------------------------------------------------------------
  464. CMmPolicyHandler::OnGetResultViewType
  465. Return the result view that this node is going to support
  466. Author: NSun
  467. ---------------------------------------------------------------------------*/
  468. HRESULT
  469. CMmPolicyHandler::OnGetResultViewType
  470. (
  471. ITFSComponent * pComponent,
  472. MMC_COOKIE cookie,
  473. LPOLESTR * ppViewType,
  474. long * pViewOptions
  475. )
  476. {
  477. if (cookie != NULL)
  478. {
  479. *pViewOptions = MMC_VIEW_OPTIONS_OWNERDATALIST;
  480. }
  481. return S_FALSE;
  482. }
  483. /*---------------------------------------------------------------------------
  484. CMmPolicyHandler::GetVirtualImage
  485. Returns the image index for virtual listbox items
  486. Author: NSun
  487. ---------------------------------------------------------------------------*/
  488. int
  489. CMmPolicyHandler::GetVirtualImage
  490. (
  491. int nIndex
  492. )
  493. {
  494. return ICON_IDX_POLICY;
  495. }
  496. /*---------------------------------------------------------------------------
  497. CMmPolicyHandler::GetVirtualString
  498. returns a pointer to the string for virtual listbox items
  499. Author: NSun
  500. ---------------------------------------------------------------------------*/
  501. LPCWSTR
  502. CMmPolicyHandler::GetVirtualString
  503. (
  504. int nIndex,
  505. int nCol
  506. )
  507. {
  508. HRESULT hr = S_OK;
  509. static CString strTemp;
  510. strTemp.Empty();
  511. if (nCol >= DimensionOf(aColumns[IPSECMON_MM_POLICY]))
  512. return NULL;
  513. CMmPolicyInfo MmPol;
  514. CORg(m_spSpdInfo->GetMmPolicyInfo(nIndex, &MmPol));
  515. switch (aColumns[IPSECMON_MM_POLICY][nCol])
  516. {
  517. case IDS_COL_MM_POL_NAME:
  518. if( MmPol.m_dwFlags & IPSEC_MM_POLICY_DEFAULT_POLICY) {
  519. AfxFormatString1(strTemp, IDS_POL_DEFAULT, (LPCTSTR) MmPol.m_stName);
  520. } else {
  521. strTemp = MmPol.m_stName;
  522. }
  523. return strTemp;
  524. break;
  525. case IDS_COL_MM_POL_OFFER:
  526. strTemp.Format(_T("%d"), MmPol.m_dwOfferCount);
  527. return strTemp;
  528. break;
  529. default:
  530. Panic0("CMmPolicyHandler::GetVirtualString - Unknown column!\n");
  531. break;
  532. }
  533. COM_PROTECT_ERROR_LABEL;
  534. return NULL;
  535. }
  536. /*---------------------------------------------------------------------------
  537. CMmPolicyHandler::CacheHint
  538. MMC tells us which items it will need before it requests things
  539. Author: NSun
  540. ---------------------------------------------------------------------------*/
  541. STDMETHODIMP
  542. CMmPolicyHandler::CacheHint
  543. (
  544. int nStartIndex,
  545. int nEndIndex
  546. )
  547. {
  548. HRESULT hr = hrOK;;
  549. Trace2("CacheHint - Start %d, End %d\n", nStartIndex, nEndIndex);
  550. return hr;
  551. }
  552. /*---------------------------------------------------------------------------
  553. CMmPolicyHandler::SortItems
  554. We are responsible for sorting of virtual listbox items
  555. Author: NSun
  556. ---------------------------------------------------------------------------*/
  557. STDMETHODIMP
  558. CMmPolicyHandler::SortItems
  559. (
  560. int nColumn,
  561. DWORD dwSortOptions,
  562. LPARAM lUserParam
  563. )
  564. {
  565. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  566. HRESULT hr = S_OK;
  567. if (nColumn >= DimensionOf(aColumns[IPSECMON_MM_POLICY]))
  568. return E_INVALIDARG;
  569. BEGIN_WAIT_CURSOR
  570. DWORD dwIndexType = aColumns[IPSECMON_MM_POLICY][nColumn];
  571. hr = m_spSpdInfo->SortMmPolicies(dwIndexType, dwSortOptions);
  572. END_WAIT_CURSOR
  573. return hr;
  574. }
  575. /*!--------------------------------------------------------------------------
  576. CMmPolicyHandler::OnResultUpdateView
  577. Implementation of ITFSResultHandler::OnResultUpdateView
  578. Author: NSun
  579. ---------------------------------------------------------------------------*/
  580. HRESULT CMmPolicyHandler::OnResultUpdateView
  581. (
  582. ITFSComponent *pComponent,
  583. LPDATAOBJECT pDataObject,
  584. LPARAM data,
  585. LONG_PTR hint
  586. )
  587. {
  588. HRESULT hr = hrOK;
  589. SPITFSNode spSelectedNode;
  590. pComponent->GetSelectedNode(&spSelectedNode);
  591. if (spSelectedNode == NULL)
  592. return S_OK; // no selection for our IComponentData
  593. if ( hint == IPSECMON_UPDATE_STATUS )
  594. {
  595. SPINTERNAL spInternal = ExtractInternalFormat(pDataObject);
  596. ITFSNode * pNode = reinterpret_cast<ITFSNode *>(spInternal->m_cookie);
  597. SPITFSNode spSelectedNode;
  598. pComponent->GetSelectedNode(&spSelectedNode);
  599. if (pNode == spSelectedNode)
  600. {
  601. // if we are the selected node, then we need to update
  602. SPIResultData spResultData;
  603. CORg (pComponent->GetResultData(&spResultData));
  604. CORg (spResultData->SetItemCount((int) data, MMCLV_UPDATE_NOSCROLL));
  605. }
  606. }
  607. else
  608. {
  609. // we don't handle this message, let the base class do it.
  610. return CIpsmHandler::OnResultUpdateView(pComponent, pDataObject, data, hint);
  611. }
  612. COM_PROTECT_ERROR_LABEL;
  613. return hr;
  614. }
  615. /*!--------------------------------------------------------------------------
  616. CMmPolicyHandler::LoadColumns
  617. Set the correct column header and then call the base class
  618. Author: NSun
  619. ---------------------------------------------------------------------------*/
  620. HRESULT
  621. CMmPolicyHandler::LoadColumns
  622. (
  623. ITFSComponent * pComponent,
  624. MMC_COOKIE cookie,
  625. LPARAM arg,
  626. LPARAM lParam
  627. )
  628. {
  629. //set column info
  630. return CIpsmHandler::LoadColumns(pComponent, cookie, arg, lParam);
  631. }
  632. /*---------------------------------------------------------------------------
  633. Command handlers
  634. ---------------------------------------------------------------------------*/
  635. /*---------------------------------------------------------------------------
  636. CMmPolicyHandler::OnDelete
  637. Removes a service SA
  638. Author: NSun
  639. ---------------------------------------------------------------------------*/
  640. HRESULT
  641. CMmPolicyHandler::OnDelete
  642. (
  643. ITFSNode * pNode
  644. )
  645. {
  646. HRESULT hr = S_FALSE;
  647. return hr;
  648. }
  649. /*---------------------------------------------------------------------------
  650. CMmPolicyHandler::UpdateStatus
  651. -
  652. Author: NSun
  653. ---------------------------------------------------------------------------*/
  654. HRESULT
  655. CMmPolicyHandler::UpdateStatus
  656. (
  657. ITFSNode * pNode
  658. )
  659. {
  660. HRESULT hr = hrOK;
  661. SPIComponentData spComponentData;
  662. SPIConsole spConsole;
  663. IDataObject * pDataObject;
  664. SPIDataObject spDataObject;
  665. int i = 0;
  666. Trace0("CMmPolicyHandler::UpdateStatus - Updating status for Filter");
  667. // force the listbox to update. We do this by setting the count and
  668. // telling it to invalidate the data
  669. CORg(m_spNodeMgr->GetComponentData(&spComponentData));
  670. CORg(m_spNodeMgr->GetConsole(&spConsole));
  671. // grab a data object to use
  672. CORg(spComponentData->QueryDataObject((MMC_COOKIE) pNode, CCT_RESULT, &pDataObject) );
  673. spDataObject = pDataObject;
  674. i = m_spSpdInfo->GetMmPolicyCount();
  675. CORg(spConsole->UpdateAllViews(pDataObject, i, IPSECMON_UPDATE_STATUS));
  676. COM_PROTECT_ERROR_LABEL;
  677. return hr;
  678. }
  679. /*---------------------------------------------------------------------------
  680. Misc functions
  681. ---------------------------------------------------------------------------*/
  682. /*---------------------------------------------------------------------------
  683. CMmPolicyHandler::InitData
  684. Initializes data for this node
  685. Author: NSun
  686. ---------------------------------------------------------------------------*/
  687. HRESULT
  688. CMmPolicyHandler::InitData
  689. (
  690. ISpdInfo * pSpdInfo
  691. )
  692. {
  693. m_spSpdInfo.Set(pSpdInfo);
  694. return hrOK;
  695. }