ReactOS  0.4.13-dev-651-g5dbc677
enumx.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct tagEnumSTATPROPSETSTG_impl enumx_impl
 
typedef void(* enumx_copy_cb) (IUnknown *parent, void *orig, void *dest)
 

Functions

HRESULT WINAPI enumx_QueryInterface (enumx_impl *, REFIID, void **) DECLSPEC_HIDDEN
 
ULONG WINAPI enumx_AddRef (enumx_impl *) DECLSPEC_HIDDEN
 
ULONG WINAPI enumx_Release (enumx_impl *) DECLSPEC_HIDDEN
 
HRESULT WINAPI enumx_Next (enumx_impl *, ULONG, void *, ULONG *) DECLSPEC_HIDDEN
 
HRESULT WINAPI enumx_Skip (enumx_impl *, ULONG) DECLSPEC_HIDDEN
 
HRESULT WINAPI enumx_Reset (enumx_impl *) DECLSPEC_HIDDEN
 
HRESULT WINAPI enumx_Clone (enumx_impl *, enumx_impl **) DECLSPEC_HIDDEN
 
enumx_implenumx_allocate (REFIID, const void *, ULONG, IUnknown *, enumx_copy_cb) DECLSPEC_HIDDEN
 
voidenumx_add_element (enumx_impl *, const void *) DECLSPEC_HIDDEN
 

Typedef Documentation

◆ enumx_copy_cb

typedef void(* enumx_copy_cb) (IUnknown *parent, void *orig, void *dest)

Definition at line 24 of file enumx.h.

◆ enumx_impl

Definition at line 22 of file enumx.h.

Function Documentation

◆ enumx_add_element()

void* enumx_add_element ( enumx_impl ,
const void  
)

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);
215  list_add_tail(&enumx->elements, element);
216  return &element[1];
217 }
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: _list.h:228

Referenced by create_EnumSTATPROPSETSTG(), and prop_enum_stat().

◆ enumx_AddRef()

ULONG WINAPI enumx_AddRef ( enumx_impl )

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  ,
const void ,
ULONG  ,
IUnknown ,
enumx_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 }
enumx_copy_cb copy_cb
Definition: enumx.c:45
REFIID riid
Definition: precomp.h:44
struct list elements
Definition: enumx.c:40
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
r parent
Definition: btrfs.c:2708
struct list * current
Definition: enumx.c:41
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
const void * vtbl
Definition: enumx.c:38

Referenced by create_EnumSTATPROPSETSTG(), and create_EnumSTATPROPSTG().

◆ enumx_Clone()

HRESULT WINAPI enumx_Clone ( enumx_impl ,
enumx_impl **   
)

Definition at line 165 of file enumx.c.

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

Referenced by IEnumSTATPROPSETSTG_fnClone(), and IEnumSTATPROPSTG_fnClone().

◆ enumx_Next()

HRESULT WINAPI enumx_Next ( enumx_impl ,
ULONG  ,
void ,
ULONG  
)

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
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:59
unsigned int ULONG
Definition: retypes.h:1
GLfloat GLfloat p
Definition: glext.h:8902
struct task_struct * current
Definition: linux.c:32

Referenced by IEnumSTATPROPSETSTG_fnNext(), and IEnumSTATPROPSTG_fnNext().

◆ enumx_QueryInterface()

HRESULT WINAPI enumx_QueryInterface ( enumx_impl ,
REFIID  ,
void **   
)

Definition at line 51 of file enumx.c.

55 {
56  if ( ppvObject==0 )
57  return E_INVALIDARG;
58 
59  *ppvObject = 0;
60 
61  if (IsEqualGUID(&IID_IUnknown, riid) ||
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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define E_INVALIDARG
Definition: ddrawi.h:101
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

Referenced by IEnumSTATPROPSETSTG_fnQueryInterface(), and IEnumSTATPROPSTG_fnQueryInterface().

◆ enumx_Release()

ULONG WINAPI enumx_Release ( enumx_impl )

Definition at line 83 of file enumx.c.

84 {
85  ULONG ref;
86 
87  ref = InterlockedDecrement(&This->ref);
88  if (ref == 0)
89  {
90  while (!list_empty(&This->elements))
91  {
92  struct list *x = list_head(&This->elements);
93  list_remove(x);
94  HeapFree(GetProcessHeap(), 0, x);
95  }
96  IUnknown_Release(This->parent);
98  }
99  return ref;
100 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
Definition: send.c:47
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
GLenum GLint ref
Definition: glext.h:6028
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define GetProcessHeap()
Definition: compat.h:395
#define InterlockedDecrement
Definition: armddk.h:52
Definition: _list.h:228
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
Definition: list.h:143
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394

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

◆ enumx_Reset()

HRESULT WINAPI enumx_Reset ( enumx_impl )

Definition at line 154 of file enumx.c.

155 {
156  TRACE("\n");
157 
158  This->current = NULL;
159  return S_OK;
160 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

Referenced by IEnumSTATPROPSETSTG_fnReset(), and IEnumSTATPROPSTG_fnReset().

◆ enumx_Skip()

HRESULT WINAPI enumx_Skip ( enumx_impl ,
ULONG   
)

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 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
unsigned int ULONG
Definition: retypes.h:1
struct task_struct * current
Definition: linux.c:32

Referenced by IEnumSTATPROPSETSTG_fnSkip(), and IEnumSTATPROPSTG_fnSkip().