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.

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