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.

88 lines
2.1 KiB

  1. // Enum.h -- Definition of class CEnumStorage
  2. #ifndef __ENUM_H__
  3. #define __ENUM_H__
  4. class CEnumStorage : public CITUnknown
  5. {
  6. public:
  7. static HRESULT NewEnumStorage
  8. (IUnknown *pUnkOuter,
  9. IITFileSystem *pITFS, PathInfo *pPI,
  10. IEnumSTATSTG **ppEnumSTATSTG
  11. );
  12. ~CEnumStorage(void);
  13. private:
  14. CEnumStorage(IUnknown *pUnkOuter);
  15. class CImpIEnumStorage : public IITEnumSTATSTG
  16. {
  17. public:
  18. CImpIEnumStorage(CEnumStorage *pBackObj, IUnknown *punkOuter);
  19. ~CImpIEnumStorage(void);
  20. HRESULT Initial(IITFileSystem *pITFS, PathInfo *pPI);
  21. HRESULT InitClone(CImpIEnumStorage *pEnum);
  22. // IEnumSTATSTG methods:
  23. HRESULT STDMETHODCALLTYPE GetNextEntryInSeq(ULONG celt, PathInfo *rgelt, ULONG *pceltFetched);
  24. HRESULT STDMETHODCALLTYPE GetFirstEntryInSeq(PathInfo *rgelt);
  25. /* [local] */ HRESULT __stdcall Next(
  26. /* [in] */ ULONG celt,
  27. /* [in] */ STATSTG __RPC_FAR *rgelt,
  28. /* [out] */ ULONG __RPC_FAR *pceltFetched);
  29. HRESULT __stdcall Skip(
  30. /* [in] */ ULONG celt);
  31. HRESULT __stdcall Reset( void);
  32. HRESULT __stdcall Clone(
  33. /* [out] */ IEnumSTATSTG __RPC_FAR *__RPC_FAR *ppenum);
  34. private:
  35. HRESULT __stdcall NextPathEntry(STATSTG *pStatStg);
  36. enum EnumState { Before, During, After };
  37. IEnumSTATSTG *m_pEnumPaths;
  38. UINT m_cwcBasePath;
  39. WCHAR m_awszBasePath[MAX_PATH];
  40. WCHAR m_awcKeyBuffer[MAX_PATH];
  41. enum EnumState m_State;
  42. };
  43. friend CImpIEnumStorage;
  44. CImpIEnumStorage m_ImpIEnumStorage;
  45. public:
  46. static HRESULT NewClone(IUnknown *pUnkOuter, CImpIEnumStorage *pEnum,
  47. IEnumSTATSTG **ppEnumSTATSTG);
  48. };
  49. typedef CEnumStorage *PCEnumStorage;
  50. inline CEnumStorage::CEnumStorage(IUnknown *pUnkOuter)
  51. : m_ImpIEnumStorage(this, pUnkOuter),
  52. CITUnknown(&IID_IEnumSTATSTG, 1, &m_ImpIEnumStorage)
  53. {
  54. }
  55. inline CEnumStorage::~CEnumStorage(void)
  56. {
  57. }
  58. #endif // __ENUM_H__