ReactOS 0.4.15-dev-7942-gd23573b
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 * Copyright 2023 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
7 */
8
9#include "precomp.h"
10
12 public CComObjectRootEx<CComMultiThreadModelNoCS>,
13 public IEnumIDList
14{
15private:
19public:
21 :dwFlags(0)
22 {
23 }
24
26 {
27 dwFlags = flags;
28 m_Prefix = prefix;
29 if (mEnumerator.initialize(zip))
30 return S_OK;
31 return E_FAIL;
32 }
33
34 // *** IEnumIDList methods ***
35 STDMETHODIMP Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched)
36 {
37 if (!rgelt || (!pceltFetched && celt != 1))
38 return E_POINTER;
39
40 HRESULT hr = S_OK;
41 ULONG fetched = 0;
44 bool dir;
46
47 while (fetched < celt)
48 {
50 {
52 if (!item)
53 {
54 hr = fetched ? S_FALSE : E_OUTOFMEMORY;
55 break;
56 }
57 rgelt[fetched++] = item;
58 }
59 else
60 {
61 hr = S_FALSE;
62 break;
63 }
64 }
65
66 if (pceltFetched)
67 *pceltFetched = fetched;
68 return hr;
69 }
71 {
73 bool dir;
75 while (celt--)
76 {
78 return E_FAIL;
79 ;
80 }
81 return S_OK;
82 }
84 {
85 if (mEnumerator.reset())
86 return S_OK;
87 return E_FAIL;
88 }
90 {
91 return E_NOTIMPL;
92 }
93
94
95public:
98
100 COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
102};
103
104
106{
107 return ShellObjectCreatorInit<CEnumZipContents>(zip, flags, prefix, riid, ppvOut);
108}
109
HRESULT _CEnumZipContents_CreateInstance(IZip *zip, DWORD flags, PCWSTR prefix, REFIID riid, LPVOID *ppvOut)
unsigned int dir
Definition: maze.c:112
#define STDMETHODIMP
Definition: basetyps.h:43
STDMETHODIMP Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched)
STDMETHODIMP Skip(ULONG celt)
STDMETHODIMP Reset()
STDMETHODIMP Initialize(IZip *zip, DWORD flags, PCWSTR prefix)
CZipEnumerator mEnumerator
STDMETHODIMP Clone(IEnumIDList **ppenum)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#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:581
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:601
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:679
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:651
#define END_COM_MAP()
Definition: atlcom.h:592
static ATOM item
Definition: dde.c:856
#define REFIID
Definition: guiddef.h:118
HRESULT hr
Definition: shlfolder.c:183
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
bool next_unique(PCWSTR prefix, CStringW &name, bool &folder, unz_file_info64 &info)
bool initialize(IZip *zip)
Definition: IZip.hpp:9
Definition: name.c:39
const uint16_t * PCWSTR
Definition: typedefs.h:57
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
@ ZIP_PIDL_FILE
Definition: zippidl.hpp:13
@ ZIP_PIDL_DIRECTORY
Definition: zippidl.hpp:12