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.

66 lines
1.6 KiB

  1. class CGenList
  2. {
  3. public:
  4. CGenList(UINT cbItem) : _hList(NULL), _cbItem(cbItem) {}
  5. ~CGenList() {Empty();}
  6. void *GetPtr(UINT i)
  7. {return(i<GetItemCount() ? DSA_GetItemPtr(_hList, i) : NULL);}
  8. UINT GetItemCount() {return(_hList ? DSA_GetItemCount(_hList) : 0);}
  9. int Add(void *pv, int nInsert);
  10. void Empty() {if (_hList) DSA_Destroy(_hList); _hList=NULL;}
  11. protected:
  12. void Steal(CGenList* pList)
  13. {
  14. Empty();
  15. _cbItem = pList->_cbItem;
  16. _hList = pList->_hList;
  17. pList->_hList = NULL;
  18. }
  19. private:
  20. UINT _cbItem;
  21. HDSA _hList;
  22. } ;
  23. class CViewsList : public CGenList
  24. {
  25. public:
  26. CViewsList() : CGenList(SIZEOF(SFVVIEWSDATA*)), _bGotDef(FALSE) {}
  27. ~CViewsList() {Empty();}
  28. SFVVIEWSDATA* GetPtr(UINT i)
  29. {
  30. SFVVIEWSDATA** ppViewsData = (SFVVIEWSDATA**)CGenList::GetPtr(i);
  31. return(ppViewsData ? *ppViewsData : NULL);
  32. }
  33. int Add(const SFVVIEWSDATA*pView, int nInsert, BOOL bCopy);
  34. int Add(const SFVVIEWSDATA*pView, BOOL bCopy=TRUE) {return Add(pView, DA_LAST, bCopy);}
  35. int Prepend(const SFVVIEWSDATA*pView, BOOL bCopy=TRUE) {return Add(pView, 0, bCopy);}
  36. void AddReg(HKEY hkParent, LPCTSTR pszSubKey);
  37. void AddCLSID(CLSID const* pclsid);
  38. void AddIni(LPCTSTR szIniFile, LPCTSTR szPath);
  39. void SetDef(SHELLVIEWID const *pvid) { _bGotDef=TRUE; _vidDef=*pvid; }
  40. BOOL GetDef(SHELLVIEWID *pvid) { if (_bGotDef) *pvid=_vidDef; return(_bGotDef); }
  41. void Empty();
  42. static SFVVIEWSDATA* CopyData(const SFVVIEWSDATA* pData);
  43. int NextUnique(int nLast);
  44. int NthUnique(int nUnique);
  45. private:
  46. BOOL _bGotDef;
  47. SHELLVIEWID _vidDef;
  48. } ;