ReactOS  0.4.14-dev-98-gb0d4763
CEnumZipContents.cpp
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Zip Shell Extension
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE: CEnumZipContents
5  * COPYRIGHT: Copyright 2017 Mark Jansen (mark.jansen@reactos.org)
6  */
7 
8 #include "precomp.h"
9 
11  public CComObjectRootEx<CComMultiThreadModelNoCS>,
12  public IEnumIDList
13 {
14 private:
18 public:
20  :dwFlags(0)
21  {
22  }
23 
24  STDMETHODIMP Initialize(IZip* zip, DWORD flags, const char* prefix)
25  {
26  dwFlags = flags;
27  m_Prefix = prefix;
28  if (mEnumerator.initialize(zip))
29  return S_OK;
30  return E_FAIL;
31  }
32 
33  // *** IEnumIDList methods ***
34  STDMETHODIMP Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched)
35  {
36  if (!pceltFetched || !rgelt)
37  return E_POINTER;
38 
39  *pceltFetched = 0;
40 
41  if (celt != 1)
42  return E_FAIL;
43 
44  CStringA name;
45  bool dir;
48  {
49  *pceltFetched = 1;
51  return S_OK;
52  }
53 
54  return S_FALSE;
55  }
57  {
58  CStringA name;
59  bool dir;
61  while (celt--)
62  {
64  return E_FAIL;
65  ;
66  }
67  return S_OK;
68  }
70  {
71  if (mEnumerator.reset())
72  return S_OK;
73  return E_FAIL;
74  }
76  {
77  return E_NOTIMPL;
78  }
79 
80 
81 public:
84 
86  COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
87  END_COM_MAP()
88 };
89 
90 
92 {
93  return ShellObjectCreatorInit<CEnumZipContents>(zip, flags, prefix, riid, ppvOut);
94 }
95 
#define REFIID
Definition: guiddef.h:118
STDMETHODIMP Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched)
REFIID riid
Definition: precomp.h:44
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:611
bool initialize(IZip *zip)
#define E_FAIL
Definition: ddrawi.h:102
STDMETHODIMP Initialize(IZip *zip, DWORD flags, const char *prefix)
struct _test_info info[]
Definition: SetCursorPos.c:19
Definition: IZip.hpp:8
#define STDMETHODIMP
Definition: basetyps.h:43
#define S_FALSE
Definition: winerror.h:2357
unsigned int dir
Definition: maze.c:112
bool next_unique(const char *prefix, CStringA &name, bool &folder, unz_file_info64 &info)
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:541
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define S_OK
Definition: intsafe.h:59
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:561
#define E_NOTIMPL
Definition: ddrawi.h:99
CZipEnumerator mEnumerator
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:639
Definition: name.c:36
unsigned int ULONG
Definition: retypes.h:1
#define const
Definition: zconf.h:230
STDMETHODIMP Skip(ULONG celt)
#define END_COM_MAP()
Definition: atlcom.h:552
HRESULT _CEnumZipContents_CreateInstance(IZip *zip, DWORD flags, const char *prefix, REFIID riid, LPVOID *ppvOut)
#define E_POINTER
Definition: winerror.h:2365
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPITEMIDLIST _ILCreate(LPCWSTR lpString, ULONG Index)
Definition: fontpidl.cpp:10
STDMETHODIMP Reset()
STDMETHODIMP Clone(IEnumIDList **ppenum)
GLuint const GLchar * name
Definition: glext.h:6031