2 * Queue Manager (BITS) core functions
4 * Copyright 2007 Google (Roy Shea)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/debug.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
26 /* Destructor for instances of background copy manager */
27 static void BackgroundCopyManagerDestructor(BackgroundCopyManagerImpl *This)
30 HeapFree(GetProcessHeap(), 0, This);
33 /* Add a reference to the iface pointer */
34 static ULONG WINAPI BITS_IBackgroundCopyManager_AddRef(
35 IBackgroundCopyManager* iface)
37 BackgroundCopyManagerImpl * This = (BackgroundCopyManagerImpl *)iface;
42 ref = InterlockedIncrement(&This->ref);
46 /* Attempt to provide a new interface to interact with iface */
47 static HRESULT WINAPI BITS_IBackgroundCopyManager_QueryInterface(
48 IBackgroundCopyManager* iface,
52 BackgroundCopyManagerImpl * This = (BackgroundCopyManagerImpl *)iface;
54 TRACE("IID: %s\n", debugstr_guid(riid));
56 if (IsEqualGUID(riid, &IID_IUnknown) ||
57 IsEqualGUID(riid, &IID_IBackgroundCopyManager))
59 *ppvObject = &This->lpVtbl;
60 BITS_IBackgroundCopyManager_AddRef(iface);
68 /* Release an interface to iface */
69 static ULONG WINAPI BITS_IBackgroundCopyManager_Release(
70 IBackgroundCopyManager* iface)
72 BackgroundCopyManagerImpl * This = (BackgroundCopyManagerImpl *)iface;
77 ref = InterlockedDecrement(&This->ref);
80 BackgroundCopyManagerDestructor(This);
85 /*** IBackgroundCopyManager interface methods ***/
87 static HRESULT WINAPI BITS_IBackgroundCopyManager_CreateJob(
88 IBackgroundCopyManager* iface,
92 IBackgroundCopyJob **ppJob)
95 return BackgroundCopyJobConstructor(DisplayName, Type, pJobId,
99 static HRESULT WINAPI BITS_IBackgroundCopyManager_GetJob(
100 IBackgroundCopyManager* iface,
102 IBackgroundCopyJob **ppJob)
104 FIXME("Not implemented\n");
108 static HRESULT WINAPI BITS_IBackgroundCopyManager_EnumJobs(
109 IBackgroundCopyManager* iface,
111 IEnumBackgroundCopyJobs **ppEnum)
114 return EnumBackgroundCopyJobsConstructor((LPVOID *) ppEnum, iface);
117 static HRESULT WINAPI BITS_IBackgroundCopyManager_GetErrorDescription(
118 IBackgroundCopyManager* iface,
121 LPWSTR *pErrorDescription)
123 FIXME("Not implemented\n");
128 static const IBackgroundCopyManagerVtbl BITS_IBackgroundCopyManager_Vtbl =
130 BITS_IBackgroundCopyManager_QueryInterface,
131 BITS_IBackgroundCopyManager_AddRef,
132 BITS_IBackgroundCopyManager_Release,
133 BITS_IBackgroundCopyManager_CreateJob,
134 BITS_IBackgroundCopyManager_GetJob,
135 BITS_IBackgroundCopyManager_EnumJobs,
136 BITS_IBackgroundCopyManager_GetErrorDescription
139 /* Constructor for instances of background copy manager */
140 HRESULT BackgroundCopyManagerConstructor(IUnknown *pUnkOuter, LPVOID *ppObj)
142 BackgroundCopyManagerImpl *This;
144 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
146 This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
149 return E_OUTOFMEMORY;
152 This->lpVtbl = &BITS_IBackgroundCopyManager_Vtbl;
155 *ppObj = &This->lpVtbl;