ReactOS 0.4.15-dev-8614-gbc76250
RecycleBinGenericEnum Class Reference
Inheritance diagram for RecycleBinGenericEnum:
Collaboration diagram for RecycleBinGenericEnum:

Public Member Functions

 RecycleBinGenericEnum ()
 
virtual ~RecycleBinGenericEnum ()
 
STDMETHODIMP QueryInterface (REFIID riid, void **ppvObject) override
 
 STDMETHODIMP_ (ULONG) AddRef() override
 
 STDMETHODIMP_ (ULONG) Release() override
 
STDMETHODIMP Next (DWORD celt, IRecycleBinFile **rgelt, DWORD *pceltFetched) override
 
STDMETHODIMP Skip (DWORD celt) override
 
STDMETHODIMP Reset () override
 

Protected Attributes

LONG m_ref
 
IRecycleBinEnumList * m_current
 
DWORD m_dwLogicalDrives
 
SIZE_T m_skip
 

Detailed Description

Definition at line 11 of file recyclebin_generic_enumerator.cpp.

Constructor & Destructor Documentation

◆ RecycleBinGenericEnum()

RecycleBinGenericEnum::RecycleBinGenericEnum ( )

◆ ~RecycleBinGenericEnum()

RecycleBinGenericEnum::~RecycleBinGenericEnum ( )
virtual

Definition at line 62 of file recyclebin_generic_enumerator.cpp.

63{
64 TRACE("(%p)\n", this);
65
66 if (m_current)
67 m_current->Release();
68}
#define TRACE(s)
Definition: solgame.cpp:4

Member Function Documentation

◆ Next()

STDMETHODIMP RecycleBinGenericEnum::Next ( DWORD  celt,
IRecycleBinFile **  rgelt,
DWORD pceltFetched 
)
override

Definition at line 82 of file recyclebin_generic_enumerator.cpp.

83{
84 TRACE("(%p, %u, %p, %p)\n", this, celt, rgelt, pceltFetched);
85
86 if (!rgelt)
87 return E_POINTER;
88 if (!pceltFetched && celt > 1)
89 return E_INVALIDARG;
90
91 HRESULT hr;
92 DWORD fetched = 0;
93 while (TRUE)
94 {
95 /* Get enumerator implementation */
97 {
98 for (DWORD i = 0; i < L'Z' - L'A' + 1; ++i)
99 {
100 if (m_dwLogicalDrives & (1 << i))
101 {
102 WCHAR szVolumeName[4];
103 szVolumeName[0] = (WCHAR)(L'A' + i);
104 szVolumeName[1] = L':';
105 szVolumeName[2] = L'\\';
106 szVolumeName[3] = UNICODE_NULL;
107 if (GetDriveTypeW(szVolumeName) != DRIVE_FIXED)
108 {
109 m_dwLogicalDrives &= ~(1 << i);
110 continue;
111 }
112
113 IRecycleBin *prb;
114 hr = GetDefaultRecycleBin(szVolumeName, &prb);
115 if (!SUCCEEDED(hr))
116 return hr;
117 hr = prb->EnumObjects(&m_current);
118 prb->Release();
119
120 if (!SUCCEEDED(hr))
121 return hr;
122
123 m_dwLogicalDrives &= ~(1 << i);
124 break;
125 }
126 }
127 }
128
129 if (!m_current)
130 {
131 /* Nothing more to enumerate */
132 if (pceltFetched)
133 *pceltFetched = fetched;
134 return S_FALSE;
135 }
136
137 /* Skip some elements */
138 while (m_skip > 0)
139 {
140 IRecycleBinFile *rbf;
141 hr = m_current->Next(1, &rbf, NULL);
142 if (hr == S_OK)
143 rbf->Release();
144 else if (hr == S_FALSE)
145 break;
146 else if (!SUCCEEDED(hr))
147 return hr;
148 }
149
150 if (m_skip > 0)
151 continue;
152
153 /* Fill area */
154 DWORD newFetched;
155 hr = m_current->Next(celt - fetched, &rgelt[fetched], &newFetched);
156 if (SUCCEEDED(hr))
157 fetched += newFetched;
158
159 if (hr == S_FALSE || newFetched == 0)
160 {
161 m_current->Release();
162 m_current = NULL;
163 }
164 else if (!SUCCEEDED(hr))
165 return hr;
166
167 if (fetched == celt)
168 {
169 if (pceltFetched)
170 *pceltFetched = fetched;
171 return S_OK;
172 }
173 }
174
175 /* Never go here */
177}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRUE
Definition: types.h:120
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
HRESULT WINAPI GetDefaultRecycleBin(IN LPCWSTR pszVolume OPTIONAL, OUT IRecycleBin **pprb)
Definition: recyclebin.c:399
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ULONG Release()
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define UNREACHABLE
#define UNICODE_NULL
#define L(x)
Definition: ntvdm.h:50
HRESULT hr
Definition: shlfolder.c:183
#define DRIVE_FIXED
Definition: winbase.h:252
#define S_FALSE
Definition: winerror.h:2357
#define E_POINTER
Definition: winerror.h:2365
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ QueryInterface()

STDMETHODIMP RecycleBinGenericEnum::QueryInterface ( REFIID  riid,
void **  ppvObject 
)
override

Definition at line 35 of file recyclebin_generic_enumerator.cpp.

36{
37 TRACE("(%p, %s, %p)\n", this, debugstr_guid(&riid), ppvObject);
38
39 if (!ppvObject)
40 return E_POINTER;
41
43 *ppvObject = static_cast<IRecycleBinEnumList *>(this);
44 else
45 {
46 *ppvObject = NULL;
47 return E_NOINTERFACE;
48 }
49
50 AddRef();
51 return S_OK;
52}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
EXTERN_C const IID IID_IRecycleBinEnumList
Definition: recyclebin.h:245
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ Reset()

STDMETHODIMP RecycleBinGenericEnum::Reset ( )
override

Definition at line 186 of file recyclebin_generic_enumerator.cpp.

187{
188 TRACE("(%p)\n", this);
189
190 if (m_current)
191 {
192 m_current->Release();
193 m_current = NULL;
194 }
195 m_skip = 0;
197 return S_OK;
198}
DWORD WINAPI GetLogicalDrives(void)
Definition: disk.c:110

◆ Skip()

STDMETHODIMP RecycleBinGenericEnum::Skip ( DWORD  celt)
override

Definition at line 179 of file recyclebin_generic_enumerator.cpp.

180{
181 TRACE("(%p, %u)\n", this, celt);
182 m_skip += celt;
183 return S_OK;
184}

◆ STDMETHODIMP_() [1/2]

RecycleBinGenericEnum::STDMETHODIMP_ ( ULONG  )
override

◆ STDMETHODIMP_() [2/2]

RecycleBinGenericEnum::STDMETHODIMP_ ( ULONG  )
override

Member Data Documentation

◆ m_current

IRecycleBinEnumList* RecycleBinGenericEnum::m_current
protected

Definition at line 29 of file recyclebin_generic_enumerator.cpp.

Referenced by Next(), Reset(), and ~RecycleBinGenericEnum().

◆ m_dwLogicalDrives

DWORD RecycleBinGenericEnum::m_dwLogicalDrives
protected

Definition at line 30 of file recyclebin_generic_enumerator.cpp.

Referenced by Next(), and Reset().

◆ m_ref

LONG RecycleBinGenericEnum::m_ref
protected

Definition at line 28 of file recyclebin_generic_enumerator.cpp.

◆ m_skip

SIZE_T RecycleBinGenericEnum::m_skip
protected

Definition at line 31 of file recyclebin_generic_enumerator.cpp.

Referenced by Next(), Reset(), and Skip().


The documentation for this class was generated from the following file: