ReactOS  0.4.15-dev-448-gd6c4411
recyclebin_generic_enumerator.c File Reference
Include dependency graph for recyclebin_generic_enumerator.c:

Go to the source code of this file.

Classes

struct  RecycleBinGenericEnum
 

Functions

static HRESULT STDMETHODCALLTYPE RecycleBinGenericEnum_RecycleBinEnumList_QueryInterface (IN IRecycleBinEnumList *This, IN REFIID riid, OUT void **ppvObject)
 
static ULONG STDMETHODCALLTYPE RecycleBinGenericEnum_RecycleBinEnumList_AddRef (IN IRecycleBinEnumList *This)
 
static VOID RecycleBinGenericEnum_Destructor (struct RecycleBinGenericEnum *s)
 
static ULONG STDMETHODCALLTYPE RecycleBinGenericEnum_RecycleBinEnumList_Release (IN IRecycleBinEnumList *This)
 
static HRESULT STDMETHODCALLTYPE RecycleBinGenericEnum_RecycleBinEnumList_Next (IN IRecycleBinEnumList *This, IN DWORD celt, IN OUT IRecycleBinFile **rgelt, OUT DWORD *pceltFetched)
 
static HRESULT STDMETHODCALLTYPE RecycleBinGenericEnum_RecycleBinEnumList_Skip (IN IRecycleBinEnumList *This, IN DWORD celt)
 
static HRESULT STDMETHODCALLTYPE RecycleBinGenericEnum_RecycleBinEnumList_Reset (IN IRecycleBinEnumList *This)
 
HRESULT RecycleBinGenericEnum_Constructor (OUT IRecycleBinEnumList **pprbel)
 

Variables

CONST_VTBL struct IRecycleBinEnumListVtbl RecycleBinGenericEnumVtbl
 

Function Documentation

◆ RecycleBinGenericEnum_Constructor()

HRESULT RecycleBinGenericEnum_Constructor ( OUT IRecycleBinEnumList **  pprbel)

Definition at line 219 of file recyclebin_generic_enumerator.c.

221 {
222  struct RecycleBinGenericEnum *s;
223 
224  s = CoTaskMemAlloc(sizeof(struct RecycleBinGenericEnum));
225  if (!s)
226  return E_OUTOFMEMORY;
227  ZeroMemory(s, sizeof(struct RecycleBinGenericEnum));
228  s->ref = 1;
229  s->recycleBinEnumImpl.lpVtbl = &RecycleBinGenericEnumVtbl;
230 
231  *pprbel = &s->recycleBinEnumImpl;
232  return IRecycleBinEnumList_Reset(*pprbel);
233 }
#define ZeroMemory
Definition: winbase.h:1648
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
CONST_VTBL struct IRecycleBinEnumListVtbl RecycleBinGenericEnumVtbl
GLdouble s
Definition: gl.h:2039
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426

Referenced by RecycleBinGeneric_RecycleBin_EnumObjects().

◆ RecycleBinGenericEnum_Destructor()

static VOID RecycleBinGenericEnum_Destructor ( struct RecycleBinGenericEnum s)
static

Definition at line 58 of file recyclebin_generic_enumerator.c.

60 {
61  TRACE("(%p)\n", s);
62 
63  if (s->current)
64  IRecycleBinEnumList_Release(s->current);
66 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define TRACE(s)
Definition: solgame.cpp:4
GLdouble s
Definition: gl.h:2039

Referenced by RecycleBinGenericEnum_RecycleBinEnumList_Release().

◆ RecycleBinGenericEnum_RecycleBinEnumList_AddRef()

static ULONG STDMETHODCALLTYPE RecycleBinGenericEnum_RecycleBinEnumList_AddRef ( IN IRecycleBinEnumList *  This)
static

Definition at line 48 of file recyclebin_generic_enumerator.c.

50 {
52  ULONG refCount = InterlockedIncrement((PLONG)&s->ref);
53  TRACE("(%p)\n", This);
54  return refCount;
55 }
IRecycleBinEnumList recycleBinEnumImpl
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define TRACE(s)
Definition: solgame.cpp:4
GLdouble s
Definition: gl.h:2039
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1
signed int * PLONG
Definition: retypes.h:5

◆ RecycleBinGenericEnum_RecycleBinEnumList_Next()

static HRESULT STDMETHODCALLTYPE RecycleBinGenericEnum_RecycleBinEnumList_Next ( IN IRecycleBinEnumList *  This,
IN DWORD  celt,
IN OUT IRecycleBinFile **  rgelt,
OUT DWORD pceltFetched 
)
static

Definition at line 86 of file recyclebin_generic_enumerator.c.

91 {
93  IRecycleBin *prb;
94  DWORD i;
95  DWORD fetched = 0, newFetched;
96  HRESULT hr;
97 
98  TRACE("(%p, %u, %p, %p)\n", This, celt, rgelt, pceltFetched);
99 
100  if (!rgelt)
101  return E_POINTER;
102  if (!pceltFetched && celt > 1)
103  return E_INVALIDARG;
104 
105  while (TRUE)
106  {
107  /* Get enumerator implementation */
108  if (!s->current && s->dwLogicalDrives)
109  {
110  for (i = 0; i < 26; i++)
111  if (s->dwLogicalDrives & (1 << i))
112  {
113  WCHAR szVolumeName[4];
114  szVolumeName[0] = (WCHAR)('A' + i);
115  szVolumeName[1] = ':';
116  szVolumeName[2] = '\\';
117  szVolumeName[3] = UNICODE_NULL;
118  if (GetDriveTypeW(szVolumeName) != DRIVE_FIXED)
119  {
120  s->dwLogicalDrives &= ~(1 << i);
121  continue;
122  }
123  hr = GetDefaultRecycleBin(szVolumeName, &prb);
124  if (!SUCCEEDED(hr))
125  return hr;
126  hr = IRecycleBin_EnumObjects(prb, &s->current);
127  IRecycleBin_Release(prb);
128  if (!SUCCEEDED(hr))
129  return hr;
130  s->dwLogicalDrives &= ~(1 << i);
131  break;
132  }
133  }
134  if (!s->current)
135  {
136  /* Nothing more to enumerate */
137  if (pceltFetched)
138  *pceltFetched = fetched;
139  return S_FALSE;
140  }
141 
142  /* Skip some elements */
143  while (s->skip > 0)
144  {
145  IRecycleBinFile *rbf;
146  hr = IRecycleBinEnumList_Next(s->current, 1, &rbf, NULL);
147  if (hr == S_OK)
148  hr = IRecycleBinFile_Release(rbf);
149  else if (hr == S_FALSE)
150  break;
151  else if (!SUCCEEDED(hr))
152  return hr;
153  }
154  if (s->skip > 0)
155  continue;
156 
157  /* Fill area */
158  hr = IRecycleBinEnumList_Next(s->current, celt - fetched, &rgelt[fetched], &newFetched);
159  if (SUCCEEDED(hr))
160  fetched += newFetched;
161  if (hr == S_FALSE || newFetched == 0)
162  {
163  hr = IRecycleBinEnumList_Release(s->current);
164  s->current = NULL;
165  }
166  else if (!SUCCEEDED(hr))
167  return hr;
168  if (fetched == celt)
169  {
170  if (pceltFetched)
171  *pceltFetched = fetched;
172  return S_OK;
173  }
174  }
175 
176  /* Never go here */
177 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI GetDefaultRecycleBin(IN LPCWSTR pszVolume OPTIONAL, OUT IRecycleBin **pprb)
Definition: recyclebin.c:385
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
#define UNICODE_NULL
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
IRecycleBinEnumList recycleBinEnumImpl
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble s
Definition: gl.h:2039
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
#define DRIVE_FIXED
Definition: winbase.h:249
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ RecycleBinGenericEnum_RecycleBinEnumList_QueryInterface()

static HRESULT STDMETHODCALLTYPE RecycleBinGenericEnum_RecycleBinEnumList_QueryInterface ( IN IRecycleBinEnumList *  This,
IN REFIID  riid,
OUT void **  ppvObject 
)
static

Definition at line 21 of file recyclebin_generic_enumerator.c.

25 {
27 
28  TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppvObject);
29 
30  if (!ppvObject)
31  return E_POINTER;
32 
34  *ppvObject = &s->recycleBinEnumImpl;
36  *ppvObject = &s->recycleBinEnumImpl;
37  else
38  {
39  *ppvObject = NULL;
40  return E_NOINTERFACE;
41  }
42 
43  IUnknown_AddRef(This);
44  return S_OK;
45 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
EXTERN_C const IID IID_IRecycleBinEnumList
Definition: recyclebin.h:248
smooth NULL
Definition: ftsmooth.c:416
IRecycleBinEnumList recycleBinEnumImpl
#define debugstr_guid
Definition: kernel32.h:35
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
GLdouble s
Definition: gl.h:2039
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ RecycleBinGenericEnum_RecycleBinEnumList_Release()

static ULONG STDMETHODCALLTYPE RecycleBinGenericEnum_RecycleBinEnumList_Release ( IN IRecycleBinEnumList *  This)
static

Definition at line 69 of file recyclebin_generic_enumerator.c.

71 {
73  ULONG refCount;
74 
75  TRACE("(%p)\n", This);
76 
77  refCount = InterlockedDecrement((PLONG)&s->ref);
78 
79  if (refCount == 0)
81 
82  return refCount;
83 }
static VOID RecycleBinGenericEnum_Destructor(struct RecycleBinGenericEnum *s)
IRecycleBinEnumList recycleBinEnumImpl
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
GLdouble s
Definition: gl.h:2039
unsigned int ULONG
Definition: retypes.h:1
signed int * PLONG
Definition: retypes.h:5

◆ RecycleBinGenericEnum_RecycleBinEnumList_Reset()

static HRESULT STDMETHODCALLTYPE RecycleBinGenericEnum_RecycleBinEnumList_Reset ( IN IRecycleBinEnumList *  This)
static

Definition at line 191 of file recyclebin_generic_enumerator.c.

193 {
195 
196  TRACE("(%p)\n", This);
197 
198  if (s->current)
199  {
200  IRecycleBinEnumList_Release(s->current);
201  s->current = NULL;
202  s->skip = 0;
203  }
204  s->dwLogicalDrives = GetLogicalDrives();
205  return S_OK;
206 }
smooth NULL
Definition: ftsmooth.c:416
IRecycleBinEnumList recycleBinEnumImpl
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define TRACE(s)
Definition: solgame.cpp:4
GLdouble s
Definition: gl.h:2039
DWORD WINAPI GetLogicalDrives(VOID)
Definition: disk.c:110
#define S_OK
Definition: intsafe.h:59

◆ RecycleBinGenericEnum_RecycleBinEnumList_Skip()

static HRESULT STDMETHODCALLTYPE RecycleBinGenericEnum_RecycleBinEnumList_Skip ( IN IRecycleBinEnumList *  This,
IN DWORD  celt 
)
static

Definition at line 180 of file recyclebin_generic_enumerator.c.

183 {
185  TRACE("(%p, %u)\n", This, celt);
186  s->skip += celt;
187  return S_OK;
188 }
IRecycleBinEnumList recycleBinEnumImpl
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define TRACE(s)
Definition: solgame.cpp:4
GLdouble s
Definition: gl.h:2039
#define S_OK
Definition: intsafe.h:59

Variable Documentation

◆ RecycleBinGenericEnumVtbl

CONST_VTBL struct IRecycleBinEnumListVtbl RecycleBinGenericEnumVtbl
Initial value:
=
{
}
static HRESULT STDMETHODCALLTYPE RecycleBinGenericEnum_RecycleBinEnumList_Next(IN IRecycleBinEnumList *This, IN DWORD celt, IN OUT IRecycleBinFile **rgelt, OUT DWORD *pceltFetched)
static HRESULT STDMETHODCALLTYPE RecycleBinGenericEnum_RecycleBinEnumList_Reset(IN IRecycleBinEnumList *This)
static ULONG STDMETHODCALLTYPE RecycleBinGenericEnum_RecycleBinEnumList_AddRef(IN IRecycleBinEnumList *This)
static HRESULT STDMETHODCALLTYPE RecycleBinGenericEnum_RecycleBinEnumList_QueryInterface(IN IRecycleBinEnumList *This, IN REFIID riid, OUT void **ppvObject)
static ULONG STDMETHODCALLTYPE RecycleBinGenericEnum_RecycleBinEnumList_Release(IN IRecycleBinEnumList *This)
static HRESULT STDMETHODCALLTYPE RecycleBinGenericEnum_RecycleBinEnumList_Skip(IN IRecycleBinEnumList *This, IN DWORD celt)

Definition at line 208 of file recyclebin_generic_enumerator.c.

Referenced by RecycleBinGenericEnum_Constructor().