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.

75 lines
2.4 KiB

  1. //==========================================================================
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. // PURPOSE.
  7. //
  8. // Copyright 1998 - 1999 Microsoft Corporation. All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------
  11. // header file for handler specific items
  12. #ifndef _ENUMERATOR_CLASS_
  13. #define _ENUMERATOR_CLASS_
  14. // structure for keeping track of items as a whole
  15. typedef struct _tagGENERICITEM
  16. {
  17. DWORD cbSize; // total size of item (this structure + whatever caller needs for data)
  18. _tagGENERICITEM *pNextGenericItem;
  19. } GENERICITEM;
  20. typedef GENERICITEM *LPGENERICITEM;
  21. typedef struct _tagGENERICITEMLIST
  22. {
  23. DWORD _cRefs; // reference count on this structure
  24. DWORD dwNumItems; // number of items in array.
  25. LPGENERICITEM pFirstGenericItem; // ptr to first Item in linked list
  26. } GENERICITEMLIST;
  27. typedef GENERICITEMLIST *LPGENERICITEMLIST;
  28. class CGenericEnum
  29. {
  30. public:
  31. DWORD m_cRef;
  32. DWORD m_cOffset;
  33. LPGENERICITEMLIST m_pGenericItemList; // array of items
  34. LPGENERICITEM m_pNextItem;
  35. public:
  36. CGenericEnum(LPGENERICITEMLIST pGenericItemList,DWORD cOffset);
  37. ~CGenericEnum();
  38. virtual void DeleteThisObject() = 0;
  39. //IUnknown members
  40. STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
  41. STDMETHODIMP_(ULONG) AddRef();
  42. STDMETHODIMP_(ULONG) Release();
  43. STDMETHODIMP Next(ULONG celt,LPGENERICITEM rgelt,ULONG *pceltFetched);
  44. STDMETHODIMP Clone(CGenericEnum **ppenum);
  45. STDMETHODIMP Skip(ULONG celt);
  46. STDMETHODIMP Reset();
  47. };
  48. // helper functions for managing list.
  49. DWORD AddRef_ItemList(LPGENERICITEMLIST pGenericItemList);
  50. DWORD Release_ItemList(LPGENERICITEMLIST pGenericItemList);
  51. LPGENERICITEMLIST CreateItemList();
  52. LPGENERICITEMLIST DuplicateItemList(LPGENERICITEMLIST pItemList);
  53. LPGENERICITEM AddNewItemToList(LPGENERICITEMLIST lpGenericList,ULONG cbSize);
  54. BOOL AddItemToList(LPGENERICITEMLIST lpGenericList,LPGENERICITEM pGenericItem);
  55. BOOL DeleteItemFromList(LPGENERICITEMLIST lpGenericList,LPGENERICITEM pGenericItem);
  56. LPGENERICITEM CreateNewListItem(ULONG cbSize);
  57. #endif // #define _ENUMERATOR_CLASS_