ReactOS 0.4.15-dev-5672-gf73ac17
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{
14private:
18public:
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
45 bool dir;
48 {
49 *pceltFetched = 1;
51 return S_OK;
52 }
53
54 return S_FALSE;
55 }
57 {
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
81public:
84
86 COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
88};
89
90
92{
93 return ShellObjectCreatorInit<CEnumZipContents>(zip, flags, prefix, riid, ppvOut);
94}
95
HRESULT _CEnumZipContents_CreateInstance(IZip *zip, DWORD flags, const char *prefix, REFIID riid, LPVOID *ppvOut)
unsigned int dir
Definition: maze.c:112
#define STDMETHODIMP
Definition: basetyps.h:43
STDMETHODIMP Initialize(IZip *zip, DWORD flags, const char *prefix)
STDMETHODIMP Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched)
STDMETHODIMP Skip(ULONG celt)
STDMETHODIMP Reset()
CZipEnumerator mEnumerator
STDMETHODIMP Clone(IEnumIDList **ppenum)
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
unsigned long DWORD
Definition: ntddk_ex.h:95
LPITEMIDLIST _ILCreate(LPCWSTR lpString, ULONG Index)
Definition: fontpidl.cpp:10
GLbitfield flags
Definition: glext.h:7161
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:542
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:562
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:640
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:612
#define END_COM_MAP()
Definition: atlcom.h:553
#define REFIID
Definition: guiddef.h:118
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
bool initialize(IZip *zip)
bool next_unique(const char *prefix, CStringA &name, bool &folder, unz_file_info64 &info)
Definition: IZip.hpp:9
Definition: name.c:39
uint32_t ULONG
Definition: typedefs.h:59
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
#define S_FALSE
Definition: winerror.h:2357
#define E_POINTER
Definition: winerror.h:2365
#define const
Definition: zconf.h:233
@ ZIP_PIDL_FILE
Definition: zippidl.hpp:12
@ ZIP_PIDL_DIRECTORY
Definition: zippidl.hpp:11