ReactOS 0.4.15-dev-7712-gbbbcd8e
enum_files.c File Reference
#include "qmgr.h"
#include "wine/debug.h"
Include dependency graph for enum_files.c:

Go to the source code of this file.

Classes

struct  EnumBackgroundCopyFilesImpl
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (qmgr)
 
static EnumBackgroundCopyFilesImplimpl_from_IEnumBackgroundCopyFiles (IEnumBackgroundCopyFiles *iface)
 
static HRESULT WINAPI EnumBackgroundCopyFiles_QueryInterface (IEnumBackgroundCopyFiles *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI EnumBackgroundCopyFiles_AddRef (IEnumBackgroundCopyFiles *iface)
 
static ULONG WINAPI EnumBackgroundCopyFiles_Release (IEnumBackgroundCopyFiles *iface)
 
static HRESULT WINAPI EnumBackgroundCopyFiles_Next (IEnumBackgroundCopyFiles *iface, ULONG celt, IBackgroundCopyFile **rgelt, ULONG *pceltFetched)
 
static HRESULT WINAPI EnumBackgroundCopyFiles_Skip (IEnumBackgroundCopyFiles *iface, ULONG celt)
 
static HRESULT WINAPI EnumBackgroundCopyFiles_Reset (IEnumBackgroundCopyFiles *iface)
 
static HRESULT WINAPI EnumBackgroundCopyFiles_Clone (IEnumBackgroundCopyFiles *iface, IEnumBackgroundCopyFiles **ppenum)
 
static HRESULT WINAPI EnumBackgroundCopyFiles_GetCount (IEnumBackgroundCopyFiles *iface, ULONG *puCount)
 
HRESULT EnumBackgroundCopyFilesConstructor (BackgroundCopyJobImpl *job, IEnumBackgroundCopyFiles **enum_files)
 

Variables

static const IEnumBackgroundCopyFilesVtbl EnumBackgroundCopyFilesVtbl
 

Function Documentation

◆ EnumBackgroundCopyFiles_AddRef()

static ULONG WINAPI EnumBackgroundCopyFiles_AddRef ( IEnumBackgroundCopyFiles iface)
static

Definition at line 58 of file enum_files.c.

59{
62
63 TRACE("(%p)->(%d)\n", This, ref);
64 return ref;
65}
#define InterlockedIncrement
Definition: armddk.h:53
static EnumBackgroundCopyFilesImpl * impl_from_IEnumBackgroundCopyFiles(IEnumBackgroundCopyFiles *iface)
Definition: enum_files.c:35
#define TRACE(s)
Definition: solgame.cpp:4
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ EnumBackgroundCopyFiles_Clone()

static HRESULT WINAPI EnumBackgroundCopyFiles_Clone ( IEnumBackgroundCopyFiles iface,
IEnumBackgroundCopyFiles **  ppenum 
)
static

Definition at line 154 of file enum_files.c.

156{
158 FIXME("(%p)->(%p): stub\n", This, ppenum);
159 return E_NOTIMPL;
160}
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ EnumBackgroundCopyFiles_GetCount()

static HRESULT WINAPI EnumBackgroundCopyFiles_GetCount ( IEnumBackgroundCopyFiles iface,
ULONG puCount 
)
static

Definition at line 162 of file enum_files.c.

164{
166 TRACE("(%p)->(%p)\n", This, puCount);
167 *puCount = This->numFiles;
168 return S_OK;
169}
#define S_OK
Definition: intsafe.h:52

◆ EnumBackgroundCopyFiles_Next()

static HRESULT WINAPI EnumBackgroundCopyFiles_Next ( IEnumBackgroundCopyFiles iface,
ULONG  celt,
IBackgroundCopyFile **  rgelt,
ULONG pceltFetched 
)
static

Definition at line 87 of file enum_files.c.

89{
91 ULONG fetched;
92 ULONG i;
94
95 TRACE("(%p)->(%d %p %p)\n", This, celt, rgelt, pceltFetched);
96
97 /* Despite documented behavior, Windows (tested on XP) is not verifying
98 that the caller set pceltFetched to zero. No check here. */
99
100 fetched = min(celt, This->numFiles - This->indexFiles);
101 if (pceltFetched)
102 *pceltFetched = fetched;
103 else
104 {
105 /* We need to initialize this array if the caller doesn't request
106 the length because length_is will default to celt. */
107 for (i = 0; i < celt; i++)
108 rgelt[i] = NULL;
109
110 /* pceltFetched can only be NULL if celt is 1 */
111 if (celt != 1)
112 return E_INVALIDARG;
113 }
114
115 /* Fill in the array of objects */
116 for (i = 0; i < fetched; i++)
117 {
118 file = This->files[This->indexFiles++];
119 IBackgroundCopyFile2_AddRef(file);
120 rgelt[i] = (IBackgroundCopyFile *)file;
121 }
122
123 return fetched == celt ? S_OK : S_FALSE;
124}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define NULL
Definition: types.h:112
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 min(a, b)
Definition: monoChain.cc:55
Definition: fci.c:127
#define S_FALSE
Definition: winerror.h:2357

◆ EnumBackgroundCopyFiles_QueryInterface()

static HRESULT WINAPI EnumBackgroundCopyFiles_QueryInterface ( IEnumBackgroundCopyFiles iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 40 of file enum_files.c.

42{
44
45 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv);
46
47 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IEnumBackgroundCopyFiles))
48 {
49 *ppv = iface;
50 IEnumBackgroundCopyFiles_AddRef(iface);
51 return S_OK;
52 }
53
54 *ppv = NULL;
55 return E_NOINTERFACE;
56}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ EnumBackgroundCopyFiles_Release()

static ULONG WINAPI EnumBackgroundCopyFiles_Release ( IEnumBackgroundCopyFiles iface)
static

Definition at line 67 of file enum_files.c.

68{
71 ULONG i;
72
73 TRACE("(%p)->(%d)\n", This, ref);
74
75 if (ref == 0)
76 {
77 for(i = 0; i < This->numFiles; i++)
78 IBackgroundCopyFile2_Release(This->files[i]);
79 HeapFree(GetProcessHeap(), 0, This->files);
81 }
82
83 return ref;
84}
#define InterlockedDecrement
Definition: armddk.h:52
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735

◆ EnumBackgroundCopyFiles_Reset()

static HRESULT WINAPI EnumBackgroundCopyFiles_Reset ( IEnumBackgroundCopyFiles iface)
static

Definition at line 144 of file enum_files.c.

145{
147
148 TRACE("(%p)\n", This);
149
150 This->indexFiles = 0;
151 return S_OK;
152}

◆ EnumBackgroundCopyFiles_Skip()

static HRESULT WINAPI EnumBackgroundCopyFiles_Skip ( IEnumBackgroundCopyFiles iface,
ULONG  celt 
)
static

Definition at line 127 of file enum_files.c.

129{
131
132 TRACE("(%p)->(%d)\n", This, celt);
133
134 if (celt > This->numFiles - This->indexFiles)
135 {
136 This->indexFiles = This->numFiles;
137 return S_FALSE;
138 }
139
140 This->indexFiles += celt;
141 return S_OK;
142}

◆ EnumBackgroundCopyFilesConstructor()

HRESULT EnumBackgroundCopyFilesConstructor ( BackgroundCopyJobImpl job,
IEnumBackgroundCopyFiles **  enum_files 
)

Definition at line 183 of file enum_files.c.

184{
187 ULONG i;
188
189 TRACE("%p, %p)\n", job, enum_files);
190
191 This = HeapAlloc(GetProcessHeap(), 0, sizeof *This);
192 if (!This)
193 return E_OUTOFMEMORY;
194
195 This->IEnumBackgroundCopyFiles_iface.lpVtbl = &EnumBackgroundCopyFilesVtbl;
196 This->ref = 1;
197
198 /* Create array of files */
199 This->indexFiles = 0;
201 This->numFiles = list_count(&job->files);
202 This->files = NULL;
203 if (This->numFiles > 0)
204 {
205 This->files = HeapAlloc(GetProcessHeap(), 0,
206 This->numFiles * sizeof This->files[0]);
207 if (!This->files)
208 {
211 return E_OUTOFMEMORY;
212 }
213 }
214
215 i = 0;
216 LIST_FOR_EACH_ENTRY(file, &job->files, BackgroundCopyFileImpl, entryFromJob)
217 {
218 IBackgroundCopyFile2_AddRef(&file->IBackgroundCopyFile2_iface);
219 This->files[i] = &file->IBackgroundCopyFile2_iface;
220 ++i;
221 }
223
224 *enum_files = &This->IEnumBackgroundCopyFiles_iface;
225 return S_OK;
226}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define HeapAlloc
Definition: compat.h:733
static const IEnumBackgroundCopyFilesVtbl EnumBackgroundCopyFilesVtbl
Definition: enum_files.c:171
static HANDLE job
Definition: process.c:77
__WINE_SERVER_LIST_INLINE unsigned int list_count(const struct list *list)
Definition: list.h:155
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

Referenced by BackgroundCopyJob_EnumFiles().

◆ impl_from_IEnumBackgroundCopyFiles()

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( qmgr  )

Variable Documentation

◆ EnumBackgroundCopyFilesVtbl

const IEnumBackgroundCopyFilesVtbl EnumBackgroundCopyFilesVtbl
static
Initial value:
=
{
}
static HRESULT WINAPI EnumBackgroundCopyFiles_Clone(IEnumBackgroundCopyFiles *iface, IEnumBackgroundCopyFiles **ppenum)
Definition: enum_files.c:154
static HRESULT WINAPI EnumBackgroundCopyFiles_QueryInterface(IEnumBackgroundCopyFiles *iface, REFIID riid, void **ppv)
Definition: enum_files.c:40
static HRESULT WINAPI EnumBackgroundCopyFiles_Reset(IEnumBackgroundCopyFiles *iface)
Definition: enum_files.c:144
static HRESULT WINAPI EnumBackgroundCopyFiles_Skip(IEnumBackgroundCopyFiles *iface, ULONG celt)
Definition: enum_files.c:127
static ULONG WINAPI EnumBackgroundCopyFiles_Release(IEnumBackgroundCopyFiles *iface)
Definition: enum_files.c:67
static HRESULT WINAPI EnumBackgroundCopyFiles_GetCount(IEnumBackgroundCopyFiles *iface, ULONG *puCount)
Definition: enum_files.c:162
static HRESULT WINAPI EnumBackgroundCopyFiles_Next(IEnumBackgroundCopyFiles *iface, ULONG celt, IBackgroundCopyFile **rgelt, ULONG *pceltFetched)
Definition: enum_files.c:87
static ULONG WINAPI EnumBackgroundCopyFiles_AddRef(IEnumBackgroundCopyFiles *iface)
Definition: enum_files.c:58

Definition at line 171 of file enum_files.c.

Referenced by EnumBackgroundCopyFilesConstructor().