ReactOS 0.4.16-dev-240-gdb5fa3b
qmgr.c File Reference
#include "qmgr.h"
#include "wine/debug.h"
Include dependency graph for qmgr.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (qmgr)
 
static HRESULT WINAPI BackgroundCopyManager_QueryInterface (IBackgroundCopyManager *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI BackgroundCopyManager_AddRef (IBackgroundCopyManager *iface)
 
static ULONG WINAPI BackgroundCopyManager_Release (IBackgroundCopyManager *iface)
 
static HRESULT WINAPI BackgroundCopyManager_CreateJob (IBackgroundCopyManager *iface, LPCWSTR DisplayName, BG_JOB_TYPE Type, GUID *pJobId, IBackgroundCopyJob **ppJob)
 
static HRESULT WINAPI BackgroundCopyManager_GetJob (IBackgroundCopyManager *iface, REFGUID jobID, IBackgroundCopyJob **job)
 
static HRESULT WINAPI BackgroundCopyManager_EnumJobs (IBackgroundCopyManager *iface, DWORD flags, IEnumBackgroundCopyJobs **ppEnum)
 
static HRESULT WINAPI BackgroundCopyManager_GetErrorDescription (IBackgroundCopyManager *iface, HRESULT hr, DWORD langid, LPWSTR *error_description)
 
HRESULT BackgroundCopyManagerConstructor (LPVOID *ppObj)
 
DWORD WINAPI fileTransfer (void *param)
 

Variables

BackgroundCopyManagerImpl globalMgr
 
static const IBackgroundCopyManagerVtbl BackgroundCopyManagerVtbl
 

Function Documentation

◆ BackgroundCopyManager_AddRef()

static ULONG WINAPI BackgroundCopyManager_AddRef ( IBackgroundCopyManager iface)
static

Definition at line 44 of file qmgr.c.

45{
46 return 2;
47}

◆ BackgroundCopyManager_CreateJob()

static HRESULT WINAPI BackgroundCopyManager_CreateJob ( IBackgroundCopyManager iface,
LPCWSTR  DisplayName,
BG_JOB_TYPE  Type,
GUID pJobId,
IBackgroundCopyJob **  ppJob 
)
static

Definition at line 56 of file qmgr.c.

58{
61
62 TRACE("(%s %d %p %p)\n", debugstr_w(DisplayName), Type, pJobId, ppJob);
63
64 hres = BackgroundCopyJobConstructor(DisplayName, Type, pJobId, &job);
65 if (FAILED(hres))
66 return hres;
67
68 /* Add a reference to the job to job list */
69 *ppJob = (IBackgroundCopyJob *)&job->IBackgroundCopyJob3_iface;
70 IBackgroundCopyJob_AddRef(*ppJob);
72 list_add_head(&globalMgr.jobs, &job->entryFromQmgr);
74 return S_OK;
75}
Type
Definition: Type.h:7
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type, GUID *job_id, BackgroundCopyJobImpl **job)
Definition: job.c:1197
BackgroundCopyManagerImpl globalMgr
Definition: qmgr.c:26
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_w
Definition: kernel32.h:32
HRESULT hres
Definition: protocol.c:465
static HANDLE job
Definition: process.c:77
#define TRACE(s)
Definition: solgame.cpp:4
struct list jobs
Definition: qmgr.h:91
CRITICAL_SECTION cs
Definition: qmgr.h:89
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

◆ BackgroundCopyManager_EnumJobs()

static HRESULT WINAPI BackgroundCopyManager_EnumJobs ( IBackgroundCopyManager iface,
DWORD  flags,
IEnumBackgroundCopyJobs **  ppEnum 
)
static

Definition at line 108 of file qmgr.c.

110{
111 TRACE("(0x%x %p)\n", flags, ppEnum);
112 return enum_copy_job_create(&globalMgr, ppEnum);
113}
HRESULT enum_copy_job_create(BackgroundCopyManagerImpl *qmgr, IEnumBackgroundCopyJobs **enumjob)
Definition: enum_jobs.c:179
GLbitfield flags
Definition: glext.h:7161

◆ BackgroundCopyManager_GetErrorDescription()

static HRESULT WINAPI BackgroundCopyManager_GetErrorDescription ( IBackgroundCopyManager iface,
HRESULT  hr,
DWORD  langid,
LPWSTR error_description 
)
static

Definition at line 115 of file qmgr.c.

117{
118 FIXME("(0x%08x 0x%x %p): stub\n", hr, langid, error_description);
119 return E_NOTIMPL;
120}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99
LANGID langid
Definition: msctf.idl:644
HRESULT hr
Definition: shlfolder.c:183

◆ BackgroundCopyManager_GetJob()

static HRESULT WINAPI BackgroundCopyManager_GetJob ( IBackgroundCopyManager iface,
REFGUID  jobID,
IBackgroundCopyJob **  job 
)
static

Definition at line 77 of file qmgr.c.

79{
83
84 TRACE("(%s %p)\n", debugstr_guid(jobID), job);
85
86 if (!job || !jobID) return E_INVALIDARG;
87
88 *job = NULL;
89
91
92 LIST_FOR_EACH_ENTRY(cur, &qmgr->jobs, BackgroundCopyJobImpl, entryFromQmgr)
93 {
94 if (IsEqualGUID(&cur->jobId, jobID))
95 {
96 *job = (IBackgroundCopyJob *)&cur->IBackgroundCopyJob3_iface;
97 IBackgroundCopyJob3_AddRef(&cur->IBackgroundCopyJob3_iface);
98 hr = S_OK;
99 break;
100 }
101 }
102
103 LeaveCriticalSection(&qmgr->cs);
104
105 return hr;
106}
#define BG_E_NOT_FOUND
Definition: bitsmsg.h:38
#define E_INVALIDARG
Definition: ddrawi.h:101
#define NULL
Definition: types.h:112
FxCollectionEntry * cur
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198

◆ BackgroundCopyManager_QueryInterface()

static HRESULT WINAPI BackgroundCopyManager_QueryInterface ( IBackgroundCopyManager iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 28 of file qmgr.c.

30{
31 TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
32
33 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IBackgroundCopyManager))
34 {
35 *ppv = iface;
36 IBackgroundCopyManager_AddRef(iface);
37 return S_OK;
38 }
39
40 *ppv = NULL;
41 return E_NOINTERFACE;
42}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ BackgroundCopyManager_Release()

static ULONG WINAPI BackgroundCopyManager_Release ( IBackgroundCopyManager iface)
static

Definition at line 49 of file qmgr.c.

50{
51 return 1;
52}

◆ BackgroundCopyManagerConstructor()

HRESULT BackgroundCopyManagerConstructor ( LPVOID ppObj)

Definition at line 141 of file qmgr.c.

142{
143 TRACE("(%p)\n", ppObj);
144 *ppObj = &globalMgr;
145 return S_OK;
146}

Referenced by BITS_IClassFactory_CreateInstance().

◆ fileTransfer()

DWORD WINAPI fileTransfer ( void param)

Definition at line 148 of file qmgr.c.

149{
151 HANDLE events[2];
152
153 events[0] = stop_event;
154 events[1] = qmgr->jobEvent;
155
156 for (;;)
157 {
158 BackgroundCopyJobImpl *job, *jobCur;
159 BOOL haveJob = FALSE;
160
161 /* Check if it's the stop_event */
163 {
164 LIST_FOR_EACH_ENTRY_SAFE(job, jobCur, &qmgr->jobs, BackgroundCopyJobImpl, entryFromQmgr)
165 {
166 list_remove(&job->entryFromQmgr);
167 IBackgroundCopyJob3_Release(&job->IBackgroundCopyJob3_iface);
168 }
169 return 0;
170 }
171
172 /* Note that other threads may add files to the job list, but only
173 this thread ever deletes them so we don't need to worry about jobs
174 magically disappearing from the list. */
175 EnterCriticalSection(&qmgr->cs);
176
177 LIST_FOR_EACH_ENTRY_SAFE(job, jobCur, &qmgr->jobs, BackgroundCopyJobImpl, entryFromQmgr)
178 {
179 if (job->state == BG_JOB_STATE_ACKNOWLEDGED || job->state == BG_JOB_STATE_CANCELLED)
180 {
181 list_remove(&job->entryFromQmgr);
182 IBackgroundCopyJob3_Release(&job->IBackgroundCopyJob3_iface);
183 }
184 else if (job->state == BG_JOB_STATE_QUEUED)
185 {
186 haveJob = TRUE;
187 break;
188 }
189 else if (job->state == BG_JOB_STATE_CONNECTING
190 || job->state == BG_JOB_STATE_TRANSFERRING)
191 {
192 ERR("Invalid state for job %p: %d\n", job, job->state);
193 }
194 }
195
196 if (!haveJob)
197 ResetEvent(qmgr->jobEvent);
198
199 LeaveCriticalSection(&qmgr->cs);
200
201 if (haveJob)
203 }
204}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
#define ERR(fmt,...)
Definition: precomp.h:57
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
void processJob(BackgroundCopyJobImpl *job)
Definition: job.c:1265
#define INFINITE
Definition: serial.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE events[2]
Definition: event.c:4
HANDLE stop_event
Definition: nfs41_daemon.c:55
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
DWORD WINAPI WaitForMultipleObjects(IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds)
Definition: synch.c:151
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:714
#define WAIT_OBJECT_0
Definition: winbase.h:432

Referenced by ServiceMain().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( qmgr  )

Variable Documentation

◆ BackgroundCopyManagerVtbl

const IBackgroundCopyManagerVtbl BackgroundCopyManagerVtbl
static
Initial value:
=
{
}
static ULONG WINAPI BackgroundCopyManager_AddRef(IBackgroundCopyManager *iface)
Definition: qmgr.c:44
static HRESULT WINAPI BackgroundCopyManager_QueryInterface(IBackgroundCopyManager *iface, REFIID riid, void **ppv)
Definition: qmgr.c:28
static HRESULT WINAPI BackgroundCopyManager_GetErrorDescription(IBackgroundCopyManager *iface, HRESULT hr, DWORD langid, LPWSTR *error_description)
Definition: qmgr.c:115
static HRESULT WINAPI BackgroundCopyManager_CreateJob(IBackgroundCopyManager *iface, LPCWSTR DisplayName, BG_JOB_TYPE Type, GUID *pJobId, IBackgroundCopyJob **ppJob)
Definition: qmgr.c:56
static ULONG WINAPI BackgroundCopyManager_Release(IBackgroundCopyManager *iface)
Definition: qmgr.c:49
static HRESULT WINAPI BackgroundCopyManager_GetJob(IBackgroundCopyManager *iface, REFGUID jobID, IBackgroundCopyJob **job)
Definition: qmgr.c:77
static HRESULT WINAPI BackgroundCopyManager_EnumJobs(IBackgroundCopyManager *iface, DWORD flags, IEnumBackgroundCopyJobs **ppEnum)
Definition: qmgr.c:108

Definition at line 122 of file qmgr.c.

◆ globalMgr

Initial value:
= {
{ NULL, -1, 0, 0, 0, 0 },
}
static const IBackgroundCopyManagerVtbl BackgroundCopyManagerVtbl
Definition: qmgr.c:122

Definition at line 26 of file qmgr.c.

Referenced by BackgroundCopyJob_Resume(), BackgroundCopyManager_CreateJob(), BackgroundCopyManager_EnumJobs(), BackgroundCopyManager_GetJob(), BackgroundCopyManagerConstructor(), fileTransfer(), ServiceMain(), and transitionJobState().