ReactOS 0.4.15-dev-7931-gfd331f1
enumx.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "enumx.h"
#include "wine/list.h"
#include "wine/debug.h"
Include dependency graph for enumx.c:

Go to the source code of this file.

Classes

struct  tagEnumSTATPROPSETSTG_impl
 

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
HRESULT WINAPI enumx_QueryInterface (enumx_impl *This, REFIID riid, void **ppvObject)
 
ULONG WINAPI enumx_AddRef (enumx_impl *This)
 
ULONG WINAPI enumx_Release (enumx_impl *This)
 
HRESULT WINAPI enumx_Next (enumx_impl *This, ULONG celt, void *rgelt, ULONG *pceltFetched)
 
HRESULT WINAPI enumx_Skip (enumx_impl *This, ULONG celt)
 
HRESULT WINAPI enumx_Reset (enumx_impl *This)
 
HRESULT WINAPI enumx_Clone (enumx_impl *iface, enumx_impl **ppenum)
 
enumx_implenumx_allocate (REFIID riid, const void *vtbl, ULONG elem_size, IUnknown *parent, enumx_copy_cb copy_cb)
 
voidenumx_add_element (enumx_impl *enumx, const void *data)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file enumx.c.

Function Documentation

◆ enumx_add_element()

void * enumx_add_element ( enumx_impl enumx,
const void data 
)

Definition at line 207 of file enumx.c.

208{
209 struct list *element;
210
211 element = HeapAlloc(GetProcessHeap(), 0, sizeof *element + enumx->elem_size);
212 if (!element)
213 return NULL;
214 memcpy(&element[1], data, enumx->elem_size);
216 return &element[1];
217}
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
Definition: list.h:37
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct list elements
Definition: enumx.c:40

Referenced by create_EnumSTATPROPSETSTG(), and prop_enum_stat().

◆ enumx_AddRef()

ULONG WINAPI enumx_AddRef ( enumx_impl This)

Definition at line 75 of file enumx.c.

76{
77 return InterlockedIncrement(&This->ref);
78}
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by IEnumSTATPROPSETSTG_fnAddRef(), and IEnumSTATPROPSTG_fnAddRef().

◆ enumx_allocate()

enumx_impl * enumx_allocate ( REFIID  riid,
const void vtbl,
ULONG  elem_size,
IUnknown parent,
enumx_copy_cb  copy_cb 
)

Definition at line 178 of file enumx.c.

180{
181 enumx_impl *enumx;
182
183 enumx = HeapAlloc(GetProcessHeap(), 0, sizeof *enumx);
184 if (enumx)
185 {
186 enumx->vtbl = vtbl;
187 enumx->ref = 1;
188 enumx->current = NULL;
189 enumx->elem_size = elem_size;
190 enumx->riid = *riid;
191 enumx->parent = parent;
192 enumx->copy_cb = copy_cb;
193
194 IUnknown_AddRef(parent);
195
196 list_init(&enumx->elements);
197 }
198
199 return enumx;
200}
static void list_init(struct list_entry *head)
Definition: list.h:51
r parent
Definition: btrfs.c:3010
REFIID riid
Definition: atlbase.h:39
struct list * current
Definition: enumx.c:41
enumx_copy_cb copy_cb
Definition: enumx.c:45
const void * vtbl
Definition: enumx.c:38

Referenced by create_EnumSTATPROPSETSTG(), and create_EnumSTATPROPSTG().

◆ enumx_Clone()

HRESULT WINAPI enumx_Clone ( enumx_impl iface,
enumx_impl **  ppenum 
)

Definition at line 165 of file enumx.c.

168{
169 FIXME("\n");
170 return E_NOTIMPL;
171}
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

Referenced by IEnumSTATPROPSETSTG_fnClone(), and IEnumSTATPROPSTG_fnClone().

◆ enumx_Next()

HRESULT WINAPI enumx_Next ( enumx_impl This,
ULONG  celt,
void rgelt,
ULONG pceltFetched 
)

Definition at line 105 of file enumx.c.

107{
108 unsigned char *p;
109 ULONG count = 0;
110
111 TRACE("%p %u %p\n", This, celt, pceltFetched);
112
113 if (This->current == NULL)
114 This->current = list_head(&This->elements);
115 p = rgelt;
116 while (count < celt && This->current && This->current != &This->elements)
117 {
118 if (This->copy_cb)
119 This->copy_cb(This->parent, &This->current[1], p);
120 else
121 memcpy(p, &This->current[1], This->elem_size);
122 p += This->elem_size;
123 This->current = This->current->next;
124 count++;
125 }
126 if (pceltFetched)
127 *pceltFetched = count;
128 if (count < celt)
129 return S_FALSE;
130 return S_OK;
131}
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLfloat GLfloat p
Definition: glext.h:8902
#define S_OK
Definition: intsafe.h:52
struct task_struct * current
Definition: linux.c:32
#define TRACE(s)
Definition: solgame.cpp:4
Definition: list.h:15
uint32_t ULONG
Definition: typedefs.h:59
#define S_FALSE
Definition: winerror.h:2357

Referenced by IEnumSTATPROPSETSTG_fnNext(), and IEnumSTATPROPSTG_fnNext().

◆ enumx_QueryInterface()

HRESULT WINAPI enumx_QueryInterface ( enumx_impl This,
REFIID  riid,
void **  ppvObject 
)

Definition at line 51 of file enumx.c.

55{
56 if ( ppvObject==0 )
57 return E_INVALIDARG;
58
59 *ppvObject = 0;
60
62 IsEqualGUID(&This->riid, riid))
63 {
64 IUnknown_AddRef(((IUnknown*)This));
65 *ppvObject = This;
66 return S_OK;
67 }
68
69 return E_NOINTERFACE;
70}
const GUID IID_IUnknown
#define E_INVALIDARG
Definition: ddrawi.h:101
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
_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

Referenced by IEnumSTATPROPSETSTG_fnQueryInterface(), and IEnumSTATPROPSTG_fnQueryInterface().

◆ enumx_Release()

ULONG WINAPI enumx_Release ( enumx_impl This)

Definition at line 83 of file enumx.c.

84{
85 ULONG ref;
86
88 if (ref == 0)
89 {
90 while (!list_empty(&This->elements))
91 {
92 struct list *x = list_head(&This->elements);
95 }
96 IUnknown_Release(This->parent);
98 }
99 return ref;
100}
#define InterlockedDecrement
Definition: armddk.h:52
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static int list_empty(struct list_entry *head)
Definition: list.h:58
#define HeapFree(x, y, z)
Definition: compat.h:735
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
Definition: send.c:48

Referenced by create_EnumSTATPROPSETSTG(), IEnumSTATPROPSETSTG_fnRelease(), and IEnumSTATPROPSTG_fnRelease().

◆ enumx_Reset()

HRESULT WINAPI enumx_Reset ( enumx_impl This)

Definition at line 154 of file enumx.c.

155{
156 TRACE("\n");
157
158 This->current = NULL;
159 return S_OK;
160}

Referenced by IEnumSTATPROPSETSTG_fnReset(), and IEnumSTATPROPSTG_fnReset().

◆ enumx_Skip()

HRESULT WINAPI enumx_Skip ( enumx_impl This,
ULONG  celt 
)

Definition at line 136 of file enumx.c.

137{
138 ULONG count = 0;
139
140 TRACE("%p %u\n", This, celt);
141
142 if (This->current == NULL)
143 This->current = list_head(&This->elements);
144
145 while (count < celt && This->current && This->current != &This->elements)
146 count++;
147
148 return S_OK;
149}

Referenced by IEnumSTATPROPSETSTG_fnSkip(), and IEnumSTATPROPSTG_fnSkip().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ole  )