ReactOS 0.4.15-dev-8116-gf69e256
enumregfilters.c File Reference
#include "quartz_private.h"
#include "wine/unicode.h"
#include "wine/debug.h"
Include dependency graph for enumregfilters.c:

Go to the source code of this file.

Classes

struct  IEnumRegFiltersImpl
 

Typedefs

typedef struct IEnumRegFiltersImpl IEnumRegFiltersImpl
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (quartz)
 
static IEnumRegFiltersImplimpl_from_IEnumRegFilters (IEnumRegFilters *iface)
 
HRESULT IEnumRegFiltersImpl_Construct (REGFILTER *pInRegFilters, const ULONG size, IEnumRegFilters **ppEnum)
 
static HRESULT WINAPI IEnumRegFiltersImpl_QueryInterface (IEnumRegFilters *iface, REFIID riid, LPVOID *ppv)
 
static ULONG WINAPI IEnumRegFiltersImpl_AddRef (IEnumRegFilters *iface)
 
static ULONG WINAPI IEnumRegFiltersImpl_Release (IEnumRegFilters *iface)
 
static HRESULT WINAPI IEnumRegFiltersImpl_Next (IEnumRegFilters *iface, ULONG cFilters, REGFILTER **ppRegFilter, ULONG *pcFetched)
 
static HRESULT WINAPI IEnumRegFiltersImpl_Skip (IEnumRegFilters *iface, ULONG n)
 
static HRESULT WINAPI IEnumRegFiltersImpl_Reset (IEnumRegFilters *iface)
 
static HRESULT WINAPI IEnumRegFiltersImpl_Clone (IEnumRegFilters *iface, IEnumRegFilters **ppEnum)
 

Variables

static const struct IEnumRegFiltersVtbl IEnumRegFiltersImpl_Vtbl
 

Typedef Documentation

◆ IEnumRegFiltersImpl

Function Documentation

◆ IEnumRegFiltersImpl_AddRef()

static ULONG WINAPI IEnumRegFiltersImpl_AddRef ( IEnumRegFilters iface)
static

Definition at line 120 of file enumregfilters.c.

121{
123 ULONG refCount = InterlockedIncrement(&This->refCount);
124
125 TRACE("(%p)\n", iface);
126
127 return refCount;
128}
#define InterlockedIncrement
Definition: armddk.h:53
static IEnumRegFiltersImpl * impl_from_IEnumRegFilters(IEnumRegFilters *iface)
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t ULONG
Definition: typedefs.h:59

◆ IEnumRegFiltersImpl_Clone()

static HRESULT WINAPI IEnumRegFiltersImpl_Clone ( IEnumRegFilters iface,
IEnumRegFilters **  ppEnum 
)
static

Definition at line 209 of file enumregfilters.c.

210{
211 TRACE("(%p)->(%p)\n", iface, ppEnum);
212
213 return E_NOTIMPL;
214}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ IEnumRegFiltersImpl_Construct()

HRESULT IEnumRegFiltersImpl_Construct ( REGFILTER pInRegFilters,
const ULONG  size,
IEnumRegFilters **  ppEnum 
)

Definition at line 45 of file enumregfilters.c.

46{
47 IEnumRegFiltersImpl* pEnumRegFilters;
48 REGFILTER* pRegFilters = NULL;
49 unsigned int i;
50
51 TRACE("(%p, %d, %p)\n", pInRegFilters, size, ppEnum);
52
53 pEnumRegFilters = CoTaskMemAlloc(sizeof(IEnumRegFiltersImpl));
54 if (!pEnumRegFilters)
55 {
56 *ppEnum = NULL;
57 return E_OUTOFMEMORY;
58 }
59
60 /* Accept size of 0 */
61 if (size)
62 {
63 pRegFilters = CoTaskMemAlloc(sizeof(REGFILTER)*size);
64 if (!pRegFilters)
65 {
66 CoTaskMemFree(pEnumRegFilters);
67 *ppEnum = NULL;
68 return E_OUTOFMEMORY;
69 }
70 }
71
72 for(i = 0; i < size; i++)
73 {
74 pRegFilters[i].Clsid = pInRegFilters[i].Clsid;
75 pRegFilters[i].Name = CoTaskMemAlloc((strlenW(pInRegFilters[i].Name)+1)*sizeof(WCHAR));
76 if (!pRegFilters[i].Name)
77 {
78 while(i)
79 CoTaskMemFree(pRegFilters[--i].Name);
80 CoTaskMemFree(pRegFilters);
81 CoTaskMemFree(pEnumRegFilters);
82 return E_OUTOFMEMORY;
83 }
84 CopyMemory(pRegFilters[i].Name, pInRegFilters[i].Name, (strlenW(pInRegFilters[i].Name)+1)*sizeof(WCHAR));
85 }
86
87 pEnumRegFilters->IEnumRegFilters_iface.lpVtbl = &IEnumRegFiltersImpl_Vtbl;
88 pEnumRegFilters->refCount = 1;
89 pEnumRegFilters->uIndex = 0;
90 pEnumRegFilters->RegFilters = pRegFilters;
91 pEnumRegFilters->size = size;
92
93 *ppEnum = &pEnumRegFilters->IEnumRegFilters_iface;
94
95 return S_OK;
96}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
static const struct IEnumRegFiltersVtbl IEnumRegFiltersImpl_Vtbl
GLsizeiptr size
Definition: glext.h:5919
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
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define S_OK
Definition: intsafe.h:52
#define strlenW(s)
Definition: unicode.h:34
IEnumRegFilters IEnumRegFilters_iface
REGFILTER * RegFilters
CLSID Clsid
Definition: axextend.idl:81
LPWSTR Name
Definition: axextend.idl:82
#define CopyMemory
Definition: winbase.h:1710
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by FilterMapper_EnumMatchingFilters().

◆ IEnumRegFiltersImpl_Next()

static HRESULT WINAPI IEnumRegFiltersImpl_Next ( IEnumRegFilters iface,
ULONG  cFilters,
REGFILTER **  ppRegFilter,
ULONG pcFetched 
)
static

Definition at line 152 of file enumregfilters.c.

153{
154 ULONG cFetched;
156 unsigned int i;
157
158 cFetched = min(This->size, This->uIndex + cFilters) - This->uIndex;
159
160 TRACE("(%p)->(%u, %p, %p)\n", iface, cFilters, ppRegFilter, pcFetched);
161
162 if (cFetched > 0)
163 {
164 for(i = 0; i < cFetched; i++)
165 {
166 /* The string in the REGFILTER structure must be allocated in the same block as the REGFILTER structure itself */
167 ppRegFilter[i] = CoTaskMemAlloc(sizeof(REGFILTER)+(strlenW(This->RegFilters[This->uIndex + i].Name)+1)*sizeof(WCHAR));
168 if (!ppRegFilter[i])
169 {
170 while(i)
171 {
172 CoTaskMemFree(ppRegFilter[--i]);
173 ppRegFilter[i] = NULL;
174 }
175 return E_OUTOFMEMORY;
176 }
177 ppRegFilter[i]->Clsid = This->RegFilters[This->uIndex + i].Clsid;
178 ppRegFilter[i]->Name = (WCHAR*)((char*)ppRegFilter[i]+sizeof(REGFILTER));
179 CopyMemory(ppRegFilter[i]->Name, This->RegFilters[This->uIndex + i].Name,
180 (strlenW(This->RegFilters[This->uIndex + i].Name)+1)*sizeof(WCHAR));
181 }
182
183 This->uIndex += cFetched;
184 if (pcFetched)
185 *pcFetched = cFetched;
186 return S_OK;
187 }
188
189 return S_FALSE;
190}
#define min(a, b)
Definition: monoChain.cc:55
#define S_FALSE
Definition: winerror.h:2357

◆ IEnumRegFiltersImpl_QueryInterface()

static HRESULT WINAPI IEnumRegFiltersImpl_QueryInterface ( IEnumRegFilters iface,
REFIID  riid,
LPVOID ppv 
)
static

Definition at line 98 of file enumregfilters.c.

99{
100 TRACE("(%p)->(%s, %p)\n", iface, qzdebugstr_guid(riid), ppv);
101
102 *ppv = NULL;
103
105 *ppv = iface;
106 else if (IsEqualIID(riid, &IID_IEnumRegFilters))
107 *ppv = iface;
108
109 if (*ppv)
110 {
111 IUnknown_AddRef((IUnknown *)(*ppv));
112 return S_OK;
113 }
114
115 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
116
117 return E_NOINTERFACE;
118}
const GUID IID_IUnknown
#define FIXME(fmt,...)
Definition: debug.h:114
const char * qzdebugstr_guid(const GUID *id)
Definition: main.c:279
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ IEnumRegFiltersImpl_Release()

static ULONG WINAPI IEnumRegFiltersImpl_Release ( IEnumRegFilters iface)
static

Definition at line 130 of file enumregfilters.c.

131{
133 ULONG refCount = InterlockedDecrement(&This->refCount);
134
135 TRACE("(%p)\n", iface);
136
137 if (!refCount)
138 {
139 ULONG i;
140
141 for(i = 0; i < This->size; i++)
142 {
143 CoTaskMemFree(This->RegFilters[i].Name);
144 }
145 CoTaskMemFree(This->RegFilters);
147 return 0;
148 } else
149 return refCount;
150}
#define InterlockedDecrement
Definition: armddk.h:52

◆ IEnumRegFiltersImpl_Reset()

static HRESULT WINAPI IEnumRegFiltersImpl_Reset ( IEnumRegFilters iface)
static

Definition at line 199 of file enumregfilters.c.

200{
202
203 TRACE("(%p)\n", iface);
204
205 This->uIndex = 0;
206 return S_OK;
207}

◆ IEnumRegFiltersImpl_Skip()

static HRESULT WINAPI IEnumRegFiltersImpl_Skip ( IEnumRegFilters iface,
ULONG  n 
)
static

Definition at line 192 of file enumregfilters.c.

193{
194 TRACE("(%p)->(%u)\n", iface, n);
195
196 return E_NOTIMPL;
197}
GLdouble n
Definition: glext.h:7729

◆ impl_from_IEnumRegFilters()

static IEnumRegFiltersImpl * impl_from_IEnumRegFilters ( IEnumRegFilters iface)
inlinestatic

Definition at line 38 of file enumregfilters.c.

39{
40 return CONTAINING_RECORD(iface, IEnumRegFiltersImpl, IEnumRegFilters_iface);
41}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by IEnumRegFiltersImpl_AddRef(), IEnumRegFiltersImpl_Next(), IEnumRegFiltersImpl_Release(), and IEnumRegFiltersImpl_Reset().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( quartz  )

Variable Documentation

◆ IEnumRegFiltersImpl_Vtbl

static const IEnumRegFiltersVtbl IEnumRegFiltersImpl_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI IEnumRegFiltersImpl_Next(IEnumRegFilters *iface, ULONG cFilters, REGFILTER **ppRegFilter, ULONG *pcFetched)
static HRESULT WINAPI IEnumRegFiltersImpl_Skip(IEnumRegFilters *iface, ULONG n)
static ULONG WINAPI IEnumRegFiltersImpl_AddRef(IEnumRegFilters *iface)
static HRESULT WINAPI IEnumRegFiltersImpl_Reset(IEnumRegFilters *iface)
static ULONG WINAPI IEnumRegFiltersImpl_Release(IEnumRegFilters *iface)
static HRESULT WINAPI IEnumRegFiltersImpl_QueryInterface(IEnumRegFilters *iface, REFIID riid, LPVOID *ppv)
static HRESULT WINAPI IEnumRegFiltersImpl_Clone(IEnumRegFilters *iface, IEnumRegFilters **ppEnum)

Definition at line 43 of file enumregfilters.c.

Referenced by IEnumRegFiltersImpl_Construct().