qmgr: Implement the IUnknown interface for IEnumBackgroundCopyJobs.

This commit is contained in:
Roy Shea 2008-02-25 17:42:46 -08:00 committed by Alexandre Julliard
parent 28e7c3b9a9
commit 00a3dceb75
3 changed files with 132 additions and 0 deletions

View File

@ -7,6 +7,7 @@ IMPORTS = advpack ole32 advapi32 kernel32
EXTRALIBS = -luuid
C_SRCS = \
enum_jobs.c \
factory.c \
job.c \
qmgr.c \

122
dlls/qmgr/enum_jobs.c Normal file
View File

@ -0,0 +1,122 @@
/*
* Queue Manager (BITS) Job Enumerator
*
* Copyright 2007 Google (Roy Shea)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "qmgr.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
static void EnumBackgroundCopyJobsDestructor(EnumBackgroundCopyJobsImpl *This)
{
HeapFree(GetProcessHeap(), 0, This);
}
static ULONG WINAPI BITS_IEnumBackgroundCopyJobs_AddRef(
IEnumBackgroundCopyJobs* iface)
{
EnumBackgroundCopyJobsImpl *This = (EnumBackgroundCopyJobsImpl *) iface;
return InterlockedIncrement(&This->ref);
}
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_QueryInterface(
IEnumBackgroundCopyJobs* iface,
REFIID riid,
void **ppvObject)
{
EnumBackgroundCopyJobsImpl *This = (EnumBackgroundCopyJobsImpl *) iface;
TRACE("IID: %s\n", debugstr_guid(riid));
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IEnumBackgroundCopyJobs))
{
*ppvObject = &This->lpVtbl;
BITS_IEnumBackgroundCopyJobs_AddRef(iface);
return S_OK;
}
*ppvObject = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI BITS_IEnumBackgroundCopyJobs_Release(
IEnumBackgroundCopyJobs* iface)
{
EnumBackgroundCopyJobsImpl *This = (EnumBackgroundCopyJobsImpl *) iface;
ULONG ref = InterlockedDecrement(&This->ref);
if (ref == 0)
EnumBackgroundCopyJobsDestructor(This);
return ref;
}
/*** IEnumBackgroundCopyJobs methods ***/
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Next(
IEnumBackgroundCopyJobs* iface,
ULONG celt,
IBackgroundCopyJob **rgelt,
ULONG *pceltFetched)
{
FIXME("Not implemented\n");
return E_NOTIMPL;
}
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Skip(
IEnumBackgroundCopyJobs* iface,
ULONG celt)
{
FIXME("Not implemented\n");
return E_NOTIMPL;
}
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Reset(
IEnumBackgroundCopyJobs* iface)
{
FIXME("Not implemented\n");
return E_NOTIMPL;
}
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Clone(
IEnumBackgroundCopyJobs* iface,
IEnumBackgroundCopyJobs **ppenum)
{
FIXME("Not implemented\n");
return E_NOTIMPL;
}
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_GetCount(
IEnumBackgroundCopyJobs* iface,
ULONG *puCount)
{
FIXME("Not implemented\n");
return E_NOTIMPL;
}
static const IEnumBackgroundCopyJobsVtbl BITS_IEnumBackgroundCopyJobs_Vtbl =
{
BITS_IEnumBackgroundCopyJobs_QueryInterface,
BITS_IEnumBackgroundCopyJobs_AddRef,
BITS_IEnumBackgroundCopyJobs_Release,
BITS_IEnumBackgroundCopyJobs_Next,
BITS_IEnumBackgroundCopyJobs_Skip,
BITS_IEnumBackgroundCopyJobs_Reset,
BITS_IEnumBackgroundCopyJobs_Clone,
BITS_IEnumBackgroundCopyJobs_GetCount
};

View File

@ -39,6 +39,13 @@ typedef struct
GUID jobId;
} BackgroundCopyJobImpl;
/* Enum background copy jobs vtbl and related data */
typedef struct
{
const IEnumBackgroundCopyJobsVtbl *lpVtbl;
LONG ref;
} EnumBackgroundCopyJobsImpl;
/* Background copy manager vtbl and related data */
typedef struct
{
@ -56,6 +63,8 @@ extern ClassFactoryImpl BITS_ClassFactory;
HRESULT BackgroundCopyManagerConstructor(IUnknown *pUnkOuter, LPVOID *ppObj);
HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
GUID *pJobId, LPVOID *ppObj);
HRESULT EnumBackgroundCopyJobsConstructor(LPVOID *ppObj,
IBackgroundCopyManager* copyManager);
/* Little helper functions */
static inline char *