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.

682 lines
18 KiB

  1. /*======================================================================================//
  2. | Process Control //
  3. | //
  4. |Copyright (c) 1998 Sequent Computer Systems, Incorporated. All rights reserved. //
  5. | //
  6. |File Name: NameRuleFolder.cpp //
  7. | //
  8. |Description: Implementation of Name rule node //
  9. | //
  10. |Created: Paul Skoglund 07-1998 //
  11. | //
  12. |Work to be done: //
  13. | 8/18/1998 //
  14. | -preserve result pane selection when list is redrawn //
  15. | -on PCXXX calls get the updated list //
  16. | //
  17. |Rev History: //
  18. | //
  19. |=======================================================================================*/
  20. #include "StdAfx.h"
  21. #include "BaseNode.h"
  22. #include "NameRulePages.h"
  23. #include "ManagementPages.h" //(formating functions)
  24. #pragma warning(push)
  25. #include <algorithm>
  26. #pragma warning(pop)
  27. using std::find;
  28. using std::list<PCNameRule*>;
  29. const GUID CNameRuleFolder::m_GUID = {0xff9baf60,0x064e,0x11d2,{0x80, 0x14,0x00,0x10,0x4b,0x9a,0x31,0x06} };
  30. const TCHAR *const CNameRuleFolder::m_szGUID = _T("{ff9baf60-064e-11d2-8014-00104b9a3106}");
  31. const CONTEXTMENUITEMBYID CNameRuleFolder::ResultsTopMenuItems[] =
  32. {
  33. { IDS_NRULE_INSERT, ID_NRULE_INSERT, ID_NRULE_INSERT, CCM_INSERTIONPOINTID_PRIMARY_TOP },
  34. { IDS_NRULE_MOVEUP, ID_NRULE_MOVEUP, ID_NRULE_MOVEUP, CCM_INSERTIONPOINTID_PRIMARY_TOP },
  35. { IDS_NRULE_MOVEDOWN, ID_NRULE_MOVEDOWN, ID_NRULE_MOVEDOWN, CCM_INSERTIONPOINTID_PRIMARY_TOP },
  36. { IDS_NRULE_EDIT, ID_NRULE_EDIT, ID_NRULE_EDIT, CCM_INSERTIONPOINTID_PRIMARY_TOP },
  37. { 0, 0, 0, 0, }
  38. };
  39. CNameRuleFolder::CNameRuleFolder(CBaseNode *pParent) : CBaseNode(NAMERULE_NODE, pParent), m_ID(0)
  40. {
  41. LoadStringHelper(m_name, IDS_NAMERULE_FOLDER);
  42. }
  43. CNameRuleFolder::~CNameRuleFolder()
  44. {
  45. ClearCache();
  46. ATLTRACE(_T("~CNameRuleFolder end\n"));
  47. }
  48. LPCTSTR CNameRuleFolder::GetNodeName()
  49. {
  50. return m_name;
  51. }
  52. HRESULT CNameRuleFolder::GetDisplayInfo(RESULTDATAITEM &ResultItem)
  53. {
  54. if (ResultItem.bScopeItem)
  55. {
  56. if( ResultItem.mask & RDI_STR )
  57. {
  58. if (0 == ResultItem.nCol)
  59. ResultItem.str = const_cast<LPOLESTR>(GetNodeName());
  60. else
  61. ResultItem.str = _T("");
  62. }
  63. if (ResultItem.mask & RDI_IMAGE)
  64. ResultItem.nImage = sImage();
  65. return S_OK;
  66. }
  67. list<PCNameRule*>::iterator item;
  68. item = find(Cache.begin(), Cache.end(), reinterpret_cast<PCNameRule*>(ResultItem.lParam) );
  69. if (item == Cache.end() )
  70. return E_UNEXPECTED;
  71. if (ResultItem.mask & RDI_STR)
  72. {
  73. PCNameRule &ref = **item;
  74. LPCTSTR &pstr = ResultItem.str;
  75. switch (ResultItem.nCol)
  76. {
  77. case TYPE_COLUMN:
  78. pstr = FormatMatchType(m_ResultStr, ref.matchType);
  79. break;
  80. case DESCRIPTION_COLUMN:
  81. pstr = ref.description;
  82. break;
  83. case MATCH_COLUMN:
  84. pstr = ref.matchString;
  85. break;
  86. case PROCESS_ALIAS_COLUMN:
  87. pstr = ref.procName;
  88. break;
  89. default:
  90. ASSERT(FALSE);
  91. pstr = _T("");
  92. break;
  93. }
  94. }
  95. return S_OK;
  96. }
  97. HRESULT CNameRuleFolder::OnShow(BOOL bSelecting, HSCOPEITEM hItem, IHeaderCtrl2* ipHeaderCtrl, IConsole2* ipConsole2)
  98. {
  99. ASSERT(hItem == GetID());
  100. if (!bSelecting)
  101. return S_OK;
  102. HRESULT hr;
  103. ITEM_STR str;
  104. LoadStringHelper(str, IDS_PROCESS_ALIAS_RULE_HDR);
  105. hr = ipHeaderCtrl->InsertColumn( PROCESS_ALIAS_COLUMN, str, 0, PROCESS_ALIAS_COLUMN_WIDTH );
  106. ASSERT(hr == S_OK);
  107. LoadStringHelper(str, IDS_DESCRIPTION_HDR);
  108. hr = ipHeaderCtrl->InsertColumn( DESCRIPTION_COLUMN, str, 0, DESCRIPTION_COLUMN_WIDTH );
  109. ASSERT(hr == S_OK);
  110. LoadStringHelper(str, IDS_MATCH_HDR);
  111. hr = ipHeaderCtrl->InsertColumn( MATCH_COLUMN, str, 0, MATCH_COLUMN_WIDTH );
  112. ASSERT(hr == S_OK);
  113. LoadStringHelper(str, IDS_TYPE_HDR);
  114. hr = ipHeaderCtrl->InsertColumn( TYPE_COLUMN, str, 0, TYPE_COLUMN_WIDTH );
  115. ASSERT(hr == S_OK);
  116. return OnRefresh(ipConsole2);
  117. }
  118. HRESULT CNameRuleFolder::OnViewChange(IResultData *ipResultData, LPARAM thing, LONG_PTR hint)
  119. {
  120. ASSERT(ipResultData);
  121. if (!ipResultData)
  122. return E_UNEXPECTED;
  123. VERIFY(ipResultData->ModifyViewStyle((MMC_RESULT_VIEW_STYLE) (MMC_SINGLESEL | MMC_NOSORTHEADER), (MMC_RESULT_VIEW_STYLE) 0) == S_OK);
  124. list<PCNameRule*>::iterator item;
  125. HRESULT hr = E_UNEXPECTED;
  126. switch (hint)
  127. {
  128. case PC_VIEW_REDRAWALL:
  129. hr = ShowAllItems(ipResultData, TRUE);
  130. break;
  131. case PC_VIEW_UPDATEALL:
  132. hr = ShowAllItems(ipResultData, FALSE);
  133. break;
  134. case PC_VIEW_SETITEM:
  135. item = find(Cache.begin(), Cache.end(), reinterpret_cast<PCNameRule*>(thing) );
  136. if (item == Cache.end())
  137. hr = E_UNEXPECTED;
  138. else
  139. {
  140. HRESULTITEM hItem;
  141. hr = ipResultData->FindItemByLParam(thing, &hItem);
  142. if (hr == S_OK)
  143. {
  144. RESULTDATAITEM data = { 0 };
  145. data.mask = RDI_IMAGE;
  146. data.itemID = hItem;
  147. switch((*item)->matchType)
  148. {
  149. case MATCH_PGM:
  150. data.nImage = ALIASRULES_IMAGE;
  151. break;
  152. case MATCH_DIR:
  153. data.nImage = ALIASRULES_IMAGE;
  154. break;
  155. case MATCH_ANY:
  156. data.nImage = ALIASRULES_IMAGE;
  157. break;
  158. default:
  159. ASSERT(FALSE);
  160. data.nImage = ITEMIMAGE_ERROR;
  161. break;
  162. }
  163. hr = ipResultData->SetItem(&data);
  164. if (hr == S_OK)
  165. hr = ipResultData->UpdateItem(hItem);
  166. }
  167. }
  168. break;
  169. case PC_VIEW_UPDATEITEM:
  170. {
  171. HRESULTITEM hItem;
  172. hr = ipResultData->FindItemByLParam(thing, &hItem);
  173. if (hr == S_OK)
  174. hr = ipResultData->UpdateItem(hItem);
  175. }
  176. break;
  177. case PC_VIEW_ADDITEM:
  178. hr = ShowAllItems(ipResultData, TRUE);
  179. break;
  180. case PC_VIEW_DELETEITEM:
  181. {
  182. HRESULTITEM hItem;
  183. hr = ipResultData->FindItemByLParam(thing, &hItem);
  184. if (hr == S_OK)
  185. hr = ipResultData->DeleteItem(hItem, 0);
  186. }
  187. break;
  188. default:
  189. hr = E_UNEXPECTED;
  190. break;
  191. }
  192. ASSERT(hr == S_OK);
  193. return hr;
  194. }
  195. HRESULT CNameRuleFolder::ShowAllItems(IResultData* ipResultData, BOOL bCacheValid)
  196. {
  197. list<PCNameRule*>::iterator item;
  198. LPARAM selected = 0;
  199. LPARAM focused = 0;
  200. RESULTDATAITEM data;
  201. if (bCacheValid)
  202. {
  203. memset(&data, 0, sizeof(data));
  204. data.nIndex = -1;
  205. data.nState = LVIS_SELECTED;
  206. data.mask = RDI_STATE;
  207. if (S_OK == ipResultData->GetNextItem(&data) && data.nIndex != -1 )
  208. {
  209. selected = data.lParam;
  210. }
  211. memset(&data, 0, sizeof(data));
  212. data.nIndex = -1;
  213. data.nState = LVIS_FOCUSED;
  214. data.mask = RDI_STATE;
  215. if (S_OK == ipResultData->GetNextItem(&data) && data.nIndex != -1)
  216. {
  217. focused = data.lParam;
  218. }
  219. }
  220. ipResultData->DeleteAllRsltItems();
  221. memset(&data, 0, sizeof(data));
  222. data.mask = RDI_STR | RDI_IMAGE | RDI_PARAM | RDI_STATE;
  223. data.bScopeItem = FALSE;
  224. //data.itemID;
  225. data.nIndex = 0;
  226. data.nCol = 0;
  227. data.str = (LPOLESTR)MMC_CALLBACK;
  228. data.nState = 0;
  229. data.iIndent = 0; //reserved
  230. HRESULT hr = S_OK;
  231. for (list<PCNameRule*>::iterator i = Cache.begin(); i != Cache.end(); ++i)
  232. {
  233. data.lParam = reinterpret_cast<LPARAM>(*i);
  234. switch((*i)->matchType)
  235. {
  236. case MATCH_PGM:
  237. data.nImage = ALIASRULES_IMAGE;
  238. break;
  239. case MATCH_DIR:
  240. data.nImage = ALIASRULES_IMAGE;
  241. break;
  242. case MATCH_ANY:
  243. data.nImage = ALIASRULES_IMAGE;
  244. break;
  245. default:
  246. ASSERT(FALSE);
  247. data.nImage = ITEMIMAGE_ERROR;
  248. break;
  249. }
  250. data.nState = 0;
  251. if (data.lParam == selected)
  252. data.nState |= LVIS_SELECTED;
  253. if (data.lParam == focused)
  254. data.nState |= LVIS_FOCUSED;
  255. hr = ipResultData->InsertItem(&data);
  256. if (hr != S_OK)
  257. break;
  258. }
  259. return hr;
  260. }
  261. void CNameRuleFolder::ClearCache()
  262. {
  263. Cache.clear();
  264. for (list<PCNameRule*>::iterator chunck = MemBlocks.begin(); chunck != MemBlocks.end(); ++chunck)
  265. {
  266. delete [] (*chunck);
  267. }
  268. MemBlocks.clear();
  269. }
  270. BOOL CNameRuleFolder::RefreshCache()
  271. {
  272. PCINT32 res = 0;
  273. PCINT32 nFirst = 0;
  274. PCULONG32 err = 0;
  275. const int MINIMUM_ALLOCATION = min((COM_BUFFER_SIZE/sizeof(PCNameRule)), 100);
  276. ClearCache();
  277. PCid hID = GetPCid();
  278. if (!hID)
  279. {
  280. ReportPCError();
  281. return false;
  282. }
  283. do
  284. {
  285. PCNameRule *ptr = new PCNameRule[MINIMUM_ALLOCATION];
  286. if (!ptr)
  287. {
  288. err = ERROR_OUTOFMEMORY;
  289. break;
  290. }
  291. res = PCGetNameRules( hID, ptr, MINIMUM_ALLOCATION * sizeof(PCNameRule), nFirst, &nUpdateCtr);
  292. if (res < 0 )
  293. {
  294. err = GetLastPCError();
  295. delete [] ptr;
  296. break;
  297. }
  298. if (res > 0)
  299. {
  300. MemBlocks.push_front(ptr);
  301. for (INT32 i = 0; i < res; i++)
  302. {
  303. Cache.insert(Cache.end(), ptr);
  304. ptr++;
  305. nFirst++;
  306. }
  307. }
  308. } while (res > 0 && PCERROR_MORE_DATA == GetLastPCError() );
  309. if (err)
  310. ReportPCError();
  311. return err == 0;
  312. }
  313. HRESULT CNameRuleFolder::AddMenuItems(LPCONTEXTMENUCALLBACK piCallback, long * pInsertionAllowed )
  314. {
  315. if (*pInsertionAllowed & CCM_INSERTIONALLOWED_VIEW)
  316. *pInsertionAllowed ^= CCM_INSERTIONALLOWED_VIEW;
  317. return S_OK;
  318. }
  319. HRESULT CNameRuleFolder::AddMenuItems(LPCONTEXTMENUCALLBACK piCallback, long * pInsertionAllowed, LPARAM Cookie)
  320. {
  321. HRESULT hr = S_OK;
  322. if (*pInsertionAllowed & CCM_INSERTIONALLOWED_VIEW)
  323. *pInsertionAllowed ^= CCM_INSERTIONALLOWED_VIEW;
  324. if (*pInsertionAllowed & CCM_INSERTIONALLOWED_TOP)
  325. {
  326. list<PCNameRule*>::iterator item;
  327. item = find(Cache.begin(), Cache.end(), reinterpret_cast<PCNameRule*>(Cookie) );
  328. if (item == Cache.end())
  329. {
  330. ASSERT(FALSE); // multiple view issue?
  331. return E_UNEXPECTED;
  332. }
  333. bool MoveUpAllowed = false;
  334. bool MoveDownAllowed = false;
  335. if ( Cache.size() > 2 )
  336. {
  337. if (item != Cache.begin() && item != --(Cache.end()) ) // not first and not last
  338. MoveUpAllowed = true;
  339. if (item != --(Cache.end()) && item != --(--(Cache.end())) ) // not last and not second to last
  340. MoveDownAllowed = true;
  341. }
  342. CONTEXTMENUITEM m = { 0 };
  343. ITEM_STR name;
  344. ITEM_STR status;
  345. for (const CONTEXTMENUITEMBYID *M = ResultsTopMenuItems; M->lCommandID; M++)
  346. {
  347. m.strName = const_cast<TCHAR *>(LoadStringHelper(name, M->strNameID));
  348. m.strStatusBarText = const_cast<TCHAR *>(LoadStringHelper(status, M->strStatusBarTextID));
  349. m.lCommandID = M->lCommandID;
  350. m.lInsertionPointID = M->lInsertionPointID;
  351. //m.fSpecialFlags = 0; // currently always 0, initialized to 0
  352. if (m.lCommandID == ID_NRULE_INSERT || m.lCommandID == ID_NRULE_EDIT)
  353. m.fFlags = MF_ENABLED;
  354. else if (m.lCommandID == ID_NRULE_MOVEUP && MoveUpAllowed)
  355. m.fFlags = MF_ENABLED;
  356. else if (m.lCommandID == ID_NRULE_MOVEDOWN && MoveDownAllowed)
  357. m.fFlags = MF_ENABLED;
  358. else
  359. m.fFlags = MF_GRAYED;
  360. hr = piCallback->AddItem(&m);
  361. if (FAILED(hr))
  362. break;
  363. }
  364. }
  365. return hr;
  366. }
  367. HRESULT CNameRuleFolder::OnHelpCmd(IDisplayHelp *ipDisplayHelp)
  368. {
  369. if (!ipDisplayHelp)
  370. return E_UNEXPECTED;
  371. ipDisplayHelp->ShowTopic(const_cast<TCHAR *>(HELP_ru_alias));
  372. return S_OK;
  373. }
  374. HRESULT CNameRuleFolder::OnSelect(BOOL bScope, BOOL bSelect, IConsoleVerb* ipConsoleVerb )
  375. {
  376. ASSERT(bScope);
  377. if ( bSelect )
  378. {
  379. VERIFY( ipConsoleVerb->SetVerbState( MMC_VERB_REFRESH, ENABLED, TRUE ) == S_OK);
  380. VERIFY( ipConsoleVerb->SetDefaultVerb( MMC_VERB_OPEN ) == S_OK );
  381. }
  382. return S_OK;
  383. }
  384. HRESULT CNameRuleFolder::OnSelect(BOOL bScope, BOOL bSelect, IConsoleVerb* ipConsoleVerb, LPARAM Cookie)
  385. {
  386. ASSERT(!bScope);
  387. VERIFY( ipConsoleVerb->SetVerbState( MMC_VERB_REFRESH, ENABLED, TRUE ) == S_OK);
  388. if (bSelect && !bScope) // incase the rules are changed again leave !bScope test
  389. {
  390. VERIFY( ipConsoleVerb->SetDefaultVerb( MMC_VERB_NONE ) == S_OK );
  391. if (Cache.size() > 1 )
  392. {
  393. list<PCNameRule*>::iterator item;
  394. item = find(Cache.begin(), Cache.end(), reinterpret_cast<PCNameRule*>(Cookie) );
  395. if (item != Cache.end() && ++item != Cache.end())
  396. VERIFY( ipConsoleVerb->SetVerbState( MMC_VERB_DELETE, ENABLED, TRUE ) == S_OK);
  397. }
  398. }
  399. return S_OK;
  400. }
  401. HRESULT CNameRuleFolder::OnDblClick(IConsole2 *ipConsole2, LPARAM Cookie)
  402. {
  403. return OnMenuCommand(ipConsole2, ID_NRULE_EDIT, Cookie);
  404. }
  405. HRESULT CNameRuleFolder::OnMenuCommand(IConsole2 *ipConsole2, long nCommandID )
  406. {
  407. return E_UNEXPECTED; // no naming rule folder commands
  408. }
  409. HRESULT CNameRuleFolder::OnMenuCommand(IConsole2 *ipConsole2, long nCommandID, LPARAM Cookie )
  410. {
  411. HRESULT hr = S_FALSE;
  412. ASSERT(ipConsole2);
  413. if (!ipConsole2)
  414. return E_UNEXPECTED;
  415. PCNameRule *SelectedItem = reinterpret_cast<PCNameRule*>(Cookie);
  416. list<PCNameRule*>::iterator item;
  417. INT32 index;
  418. for (index = 0, item = Cache.begin(); item != Cache.end(); item ++, index++)
  419. if (*item == SelectedItem)
  420. break;
  421. if (item == Cache.end() )
  422. return E_UNEXPECTED;
  423. switch(nCommandID)
  424. {
  425. case ID_NRULE_EDIT:
  426. ATLTRACE(_T("Process Alias edit\n"));
  427. hr = OnEdit(ipConsole2, SelectedItem, index, ( (UINT) 1 + index == Cache.size()) );
  428. break;
  429. case ID_NRULE_INSERT:
  430. {
  431. ATLTRACE(_T("NamingRule insert\n"));
  432. OnInsertNameRule(ipConsole2, SelectedItem);
  433. }
  434. break;
  435. case ID_NRULE_MOVEUP:
  436. //first and last item in the list cannot be moved up...
  437. if (item != Cache.begin() && item != --(Cache.end()) )
  438. {
  439. if (PCSwapNameRules( GetPCid(), --index, nUpdateCtr) < 0)
  440. ReportPCError();
  441. else
  442. {
  443. nUpdateCtr++;
  444. item = Cache.erase(item);
  445. --item;
  446. Cache.insert(item, SelectedItem);
  447. hr = SendViewChange(ipConsole2, NULL, PC_VIEW_REDRAWALL);
  448. }
  449. }
  450. ATLTRACE(_T("Name Rule Move up\n"));
  451. break;
  452. case ID_NRULE_MOVEDOWN:
  453. //last and 2nd to last item in the list cannot be moved down...
  454. {
  455. list<PCNameRule*>::iterator last = --(Cache.end()); // we know the list has at least one item so this is OK
  456. if (Cache.size() > 2 && item != last && item != --last)
  457. {
  458. if (PCSwapNameRules( GetPCid(), index, nUpdateCtr) < 0)
  459. ReportPCError();
  460. else
  461. {
  462. nUpdateCtr++;
  463. item = Cache.erase(item); // returns next
  464. item++;
  465. Cache.insert(item, SelectedItem); //insert inserts before the iterator
  466. hr = SendViewChange(ipConsole2, NULL, PC_VIEW_REDRAWALL);
  467. }
  468. }
  469. }
  470. ATLTRACE(_T("Name Rule Move down\n"));
  471. break;
  472. default:
  473. break;
  474. }
  475. return hr;
  476. }
  477. // return TRUE if an edit was actually made
  478. HRESULT CNameRuleFolder::OnEdit(IConsole2 *ipConsole2, PCNameRule *item, INT32 index, BOOL bReadOnly)
  479. {
  480. PCNameRule NewInfo = { 0 };
  481. if (NameRuleDlg(NewInfo, item, bReadOnly) &&
  482. !bReadOnly && memcmp(item, &NewInfo, sizeof(PCNameRule)) )
  483. {
  484. if ( PCReplNameRule( GetPCid(), &NewInfo, index, nUpdateCtr ) < 0)
  485. {
  486. ReportPCError();
  487. }
  488. else
  489. {
  490. nUpdateCtr++;
  491. _tcscpy(item->matchString, NewInfo.matchString);
  492. _tcscpy(item->procName, NewInfo.procName);
  493. _tcscpy(item->description, NewInfo.description);
  494. // just an update will not if the icon is changed
  495. // we are(were) changing the icon so do an addition SetItem
  496. if (item->matchType != NewInfo.matchType )
  497. {
  498. item->matchType = NewInfo.matchType;
  499. SendViewChange(ipConsole2, (INT_PTR) item, PC_VIEW_SETITEM);
  500. }
  501. else
  502. SendViewChange(ipConsole2, (INT_PTR) item, PC_VIEW_UPDATEITEM);
  503. }
  504. }
  505. return S_OK;
  506. }
  507. BOOL CNameRuleFolder::OnInsertNameRule(IConsole2 *ipConsole2, PCNameRule *InsertPoint)
  508. {
  509. list<PCNameRule*>::iterator item;
  510. INT32 index;
  511. for (index = 0, item = Cache.begin(); item != Cache.end(); item ++, index++)
  512. if (*item == InsertPoint)
  513. break;
  514. if (item == Cache.end() )
  515. return FALSE;
  516. PCNameRule *ptr = new PCNameRule[1];
  517. if (!ptr)
  518. return FALSE;
  519. if (NameRuleDlg(*ptr))
  520. {
  521. if (PCAddNameRule(GetPCid(), ptr, index, nUpdateCtr) < 0)
  522. {
  523. ReportPCError();
  524. }
  525. else
  526. {
  527. nUpdateCtr++;
  528. MemBlocks.push_front(ptr);
  529. Cache.insert(item, ptr);
  530. SendViewChange(ipConsole2, (INT_PTR) ptr, PC_VIEW_ADDITEM);
  531. return TRUE;
  532. }
  533. }
  534. delete [] ptr;
  535. return FALSE;
  536. }
  537. HRESULT CNameRuleFolder::OnDelete(IConsole2 *ipConsole2, LPARAM Cookie)
  538. {
  539. ASSERT(ipConsole2);
  540. if (!ipConsole2)
  541. return E_UNEXPECTED;
  542. list<PCNameRule*>::iterator item;
  543. INT32 index;
  544. for (index = 0, item = Cache.begin(); item != Cache.end(); item ++, index++)
  545. if (*item == reinterpret_cast<PCNameRule *>(Cookie))
  546. break;
  547. if (item == Cache.end() )
  548. {
  549. SendViewChange(ipConsole2, NULL, PC_VIEW_UPDATEALL);
  550. return E_UNEXPECTED;
  551. }
  552. if (PCDeleteNameRule(GetPCid(), index, nUpdateCtr) < 0)
  553. {
  554. ReportPCError();
  555. return E_UNEXPECTED;
  556. }
  557. nUpdateCtr++;
  558. Cache.erase(item);
  559. return SendViewChange(ipConsole2, Cookie, PC_VIEW_DELETEITEM);
  560. }
  561. HRESULT CNameRuleFolder::OnRefresh(IConsole2 *ipConsole2)
  562. {
  563. RefreshCache();
  564. return SendViewChange(ipConsole2, NULL, PC_VIEW_UPDATEALL);
  565. }