ReactOS  0.4.14-dev-1007-g90d795b
enum_jobs.c File Reference
#include "qmgr.h"
#include "wine/debug.h"
Include dependency graph for enum_jobs.c:

Go to the source code of this file.

Classes

struct  EnumBackgroundCopyJobsImpl
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (qmgr)
 
static EnumBackgroundCopyJobsImplimpl_from_IEnumBackgroundCopyJobs (IEnumBackgroundCopyJobs *iface)
 
static HRESULT WINAPI EnumBackgroundCopyJobs_QueryInterface (IEnumBackgroundCopyJobs *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI EnumBackgroundCopyJobs_AddRef (IEnumBackgroundCopyJobs *iface)
 
static ULONG WINAPI EnumBackgroundCopyJobs_Release (IEnumBackgroundCopyJobs *iface)
 
static HRESULT WINAPI EnumBackgroundCopyJobs_Next (IEnumBackgroundCopyJobs *iface, ULONG celt, IBackgroundCopyJob **rgelt, ULONG *pceltFetched)
 
static HRESULT WINAPI EnumBackgroundCopyJobs_Skip (IEnumBackgroundCopyJobs *iface, ULONG celt)
 
static HRESULT WINAPI EnumBackgroundCopyJobs_Reset (IEnumBackgroundCopyJobs *iface)
 
static HRESULT WINAPI EnumBackgroundCopyJobs_Clone (IEnumBackgroundCopyJobs *iface, IEnumBackgroundCopyJobs **ppenum)
 
static HRESULT WINAPI EnumBackgroundCopyJobs_GetCount (IEnumBackgroundCopyJobs *iface, ULONG *puCount)
 
HRESULT enum_copy_job_create (BackgroundCopyManagerImpl *qmgr, IEnumBackgroundCopyJobs **enumjob)
 

Variables

static const IEnumBackgroundCopyJobsVtbl EnumBackgroundCopyJobsVtbl
 

Function Documentation

◆ enum_copy_job_create()

HRESULT enum_copy_job_create ( BackgroundCopyManagerImpl qmgr,
IEnumBackgroundCopyJobs **  enumjob 
)

Definition at line 179 of file enum_jobs.c.

180 {
183  ULONG i;
184 
185  TRACE("%p, %p)\n", qmgr, enumjob);
186 
187  This = HeapAlloc(GetProcessHeap(), 0, sizeof *This);
188  if (!This)
189  return E_OUTOFMEMORY;
190  This->IEnumBackgroundCopyJobs_iface.lpVtbl = &EnumBackgroundCopyJobsVtbl;
191  This->ref = 1;
192 
193  /* Create array of jobs */
194  This->indexJobs = 0;
195 
196  EnterCriticalSection(&qmgr->cs);
197  This->numJobs = list_count(&qmgr->jobs);
198 
199  if (0 < This->numJobs)
200  {
201  This->jobs = HeapAlloc(GetProcessHeap(), 0,
202  This->numJobs * sizeof *This->jobs);
203  if (!This->jobs)
204  {
205  LeaveCriticalSection(&qmgr->cs);
207  return E_OUTOFMEMORY;
208  }
209  }
210  else
211  This->jobs = NULL;
212 
213  i = 0;
214  LIST_FOR_EACH_ENTRY(job, &qmgr->jobs, BackgroundCopyJobImpl, entryFromQmgr)
215  {
216  IBackgroundCopyJob3_AddRef(&job->IBackgroundCopyJob3_iface);
217  This->jobs[i++] = &job->IBackgroundCopyJob3_iface;
218  }
219  LeaveCriticalSection(&qmgr->cs);
220 
221  *enumjob = &This->IEnumBackgroundCopyJobs_iface;
222  return S_OK;
223 }
static HANDLE job
Definition: process.c:77
CRITICAL_SECTION cs
Definition: qmgr.h:89
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
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 E_OUTOFMEMORY
Definition: ddrawi.h:100
__WINE_SERVER_LIST_INLINE unsigned int list_count(const struct list *list)
Definition: list.h:155
smooth NULL
Definition: ftsmooth.c:416
struct list jobs
Definition: qmgr.h:91
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define S_OK
Definition: intsafe.h:59
static const IEnumBackgroundCopyJobsVtbl EnumBackgroundCopyJobsVtbl
Definition: enum_jobs.c:167
unsigned int ULONG
Definition: retypes.h:1
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by BackgroundCopyManager_EnumJobs().

◆ EnumBackgroundCopyJobs_AddRef()

static ULONG WINAPI EnumBackgroundCopyJobs_AddRef ( IEnumBackgroundCopyJobs iface)
static

Definition at line 58 of file enum_jobs.c.

59 {
62 
63  TRACE("(%p)->(%d)\n", This, ref);
64 
65  return ref;
66 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
static EnumBackgroundCopyJobsImpl * impl_from_IEnumBackgroundCopyJobs(IEnumBackgroundCopyJobs *iface)
Definition: enum_jobs.c:35
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ EnumBackgroundCopyJobs_Clone()

static HRESULT WINAPI EnumBackgroundCopyJobs_Clone ( IEnumBackgroundCopyJobs iface,
IEnumBackgroundCopyJobs **  ppenum 
)
static

Definition at line 148 of file enum_jobs.c.

150 {
152  FIXME("(%p)->(%p): stub\n", This, ppenum);
153  return E_NOTIMPL;
154 }
#define FIXME(fmt,...)
Definition: debug.h:110
static EnumBackgroundCopyJobsImpl * impl_from_IEnumBackgroundCopyJobs(IEnumBackgroundCopyJobs *iface)
Definition: enum_jobs.c:35
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ EnumBackgroundCopyJobs_GetCount()

static HRESULT WINAPI EnumBackgroundCopyJobs_GetCount ( IEnumBackgroundCopyJobs iface,
ULONG puCount 
)
static

Definition at line 156 of file enum_jobs.c.

158 {
160 
161  TRACE("(%p)->(%p)\n", This, puCount);
162 
163  *puCount = This->numJobs;
164  return S_OK;
165 }
#define TRACE(s)
Definition: solgame.cpp:4
static EnumBackgroundCopyJobsImpl * impl_from_IEnumBackgroundCopyJobs(IEnumBackgroundCopyJobs *iface)
Definition: enum_jobs.c:35
#define S_OK
Definition: intsafe.h:59

◆ EnumBackgroundCopyJobs_Next()

static HRESULT WINAPI EnumBackgroundCopyJobs_Next ( IEnumBackgroundCopyJobs iface,
ULONG  celt,
IBackgroundCopyJob **  rgelt,
ULONG pceltFetched 
)
static

Definition at line 86 of file enum_jobs.c.

88 {
90  ULONG fetched;
91  ULONG i;
93 
94  TRACE("(%p)->(%d %p %p)\n", This, celt, rgelt, pceltFetched);
95 
96  fetched = min(celt, This->numJobs - This->indexJobs);
97  if (pceltFetched)
98  *pceltFetched = fetched;
99  else
100  {
101  /* We need to initialize this array if the caller doesn't request
102  the length because length_is will default to celt. */
103  for (i = 0; i < celt; ++i)
104  rgelt[i] = NULL;
105 
106  /* pceltFetched can only be NULL if celt is 1 */
107  if (celt != 1)
108  return E_INVALIDARG;
109  }
110 
111  /* Fill in the array of objects */
112  for (i = 0; i < fetched; ++i)
113  {
114  job = This->jobs[This->indexJobs++];
115  IBackgroundCopyJob3_AddRef(job);
116  rgelt[i] = (IBackgroundCopyJob *)job;
117  }
118 
119  return fetched == celt ? S_OK : S_FALSE;
120 }
static HANDLE job
Definition: process.c:77
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 S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static EnumBackgroundCopyJobsImpl * impl_from_IEnumBackgroundCopyJobs(IEnumBackgroundCopyJobs *iface)
Definition: enum_jobs.c:35
#define S_OK
Definition: intsafe.h:59
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1

◆ EnumBackgroundCopyJobs_QueryInterface()

static HRESULT WINAPI EnumBackgroundCopyJobs_QueryInterface ( IEnumBackgroundCopyJobs iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 40 of file enum_jobs.c.

42 {
44 
45  TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv);
46 
47  if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IEnumBackgroundCopyJobs))
48  {
49  *ppv = iface;
50  IEnumBackgroundCopyJobs_AddRef(iface);
51  return S_OK;
52  }
53 
54  *ppv = NULL;
55  return E_NOINTERFACE;
56 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
static EnumBackgroundCopyJobsImpl * impl_from_IEnumBackgroundCopyJobs(IEnumBackgroundCopyJobs *iface)
Definition: enum_jobs.c:35
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ EnumBackgroundCopyJobs_Release()

static ULONG WINAPI EnumBackgroundCopyJobs_Release ( IEnumBackgroundCopyJobs iface)
static

Definition at line 68 of file enum_jobs.c.

69 {
72  ULONG i;
73 
74  TRACE("(%p)->(%d)\n", This, ref);
75 
76  if (ref == 0) {
77  for(i = 0; i < This->numJobs; i++)
78  IBackgroundCopyJob3_Release(This->jobs[i]);
79  HeapFree(GetProcessHeap(), 0, This->jobs);
81  }
82 
83  return ref;
84 }
Definition: send.c:47
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
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define InterlockedDecrement
Definition: armddk.h:52
static EnumBackgroundCopyJobsImpl * impl_from_IEnumBackgroundCopyJobs(IEnumBackgroundCopyJobs *iface)
Definition: enum_jobs.c:35
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ EnumBackgroundCopyJobs_Reset()

static HRESULT WINAPI EnumBackgroundCopyJobs_Reset ( IEnumBackgroundCopyJobs iface)
static

Definition at line 138 of file enum_jobs.c.

139 {
141 
142  TRACE("(%p)\n", This);
143 
144  This->indexJobs = 0;
145  return S_OK;
146 }
#define TRACE(s)
Definition: solgame.cpp:4
static EnumBackgroundCopyJobsImpl * impl_from_IEnumBackgroundCopyJobs(IEnumBackgroundCopyJobs *iface)
Definition: enum_jobs.c:35
#define S_OK
Definition: intsafe.h:59

◆ EnumBackgroundCopyJobs_Skip()

static HRESULT WINAPI EnumBackgroundCopyJobs_Skip ( IEnumBackgroundCopyJobs iface,
ULONG  celt 
)
static

Definition at line 122 of file enum_jobs.c.

123 {
125 
126  TRACE("(%p)->(%d)\n", This, celt);
127 
128  if (This->numJobs - This->indexJobs < celt)
129  {
130  This->indexJobs = This->numJobs;
131  return S_FALSE;
132  }
133 
134  This->indexJobs += celt;
135  return S_OK;
136 }
#define S_FALSE
Definition: winerror.h:2357
#define TRACE(s)
Definition: solgame.cpp:4
static EnumBackgroundCopyJobsImpl * impl_from_IEnumBackgroundCopyJobs(IEnumBackgroundCopyJobs *iface)
Definition: enum_jobs.c:35
#define S_OK
Definition: intsafe.h:59

◆ impl_from_IEnumBackgroundCopyJobs()

static EnumBackgroundCopyJobsImpl* impl_from_IEnumBackgroundCopyJobs ( IEnumBackgroundCopyJobs iface)
inlinestatic

Definition at line 35 of file enum_jobs.c.

36 {
37  return CONTAINING_RECORD(iface, EnumBackgroundCopyJobsImpl, IEnumBackgroundCopyJobs_iface);
38 }
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

Referenced by EnumBackgroundCopyJobs_AddRef(), EnumBackgroundCopyJobs_Clone(), EnumBackgroundCopyJobs_GetCount(), EnumBackgroundCopyJobs_Next(), EnumBackgroundCopyJobs_QueryInterface(), EnumBackgroundCopyJobs_Release(), EnumBackgroundCopyJobs_Reset(), and EnumBackgroundCopyJobs_Skip().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( qmgr  )

Variable Documentation

◆ EnumBackgroundCopyJobsVtbl

const IEnumBackgroundCopyJobsVtbl EnumBackgroundCopyJobsVtbl
static
Initial value:
=
{
}
static ULONG WINAPI EnumBackgroundCopyJobs_Release(IEnumBackgroundCopyJobs *iface)
Definition: enum_jobs.c:68
static HRESULT WINAPI EnumBackgroundCopyJobs_GetCount(IEnumBackgroundCopyJobs *iface, ULONG *puCount)
Definition: enum_jobs.c:156
static HRESULT WINAPI EnumBackgroundCopyJobs_Clone(IEnumBackgroundCopyJobs *iface, IEnumBackgroundCopyJobs **ppenum)
Definition: enum_jobs.c:148
static HRESULT WINAPI EnumBackgroundCopyJobs_Skip(IEnumBackgroundCopyJobs *iface, ULONG celt)
Definition: enum_jobs.c:122
static ULONG WINAPI EnumBackgroundCopyJobs_AddRef(IEnumBackgroundCopyJobs *iface)
Definition: enum_jobs.c:58
static HRESULT WINAPI EnumBackgroundCopyJobs_Reset(IEnumBackgroundCopyJobs *iface)
Definition: enum_jobs.c:138
static HRESULT WINAPI EnumBackgroundCopyJobs_QueryInterface(IEnumBackgroundCopyJobs *iface, REFIID riid, void **ppv)
Definition: enum_jobs.c:40
static HRESULT WINAPI EnumBackgroundCopyJobs_Next(IEnumBackgroundCopyJobs *iface, ULONG celt, IBackgroundCopyJob **rgelt, ULONG *pceltFetched)
Definition: enum_jobs.c:86

Definition at line 167 of file enum_jobs.c.

Referenced by enum_copy_job_create().