2 * Background Copy Job Interface for BITS
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 static void BackgroundCopyJobDestructor(BackgroundCopyJobImpl *This)
28 HeapFree(GetProcessHeap(), 0, This->displayName);
29 HeapFree(GetProcessHeap(), 0, This);
32 static ULONG WINAPI BITS_IBackgroundCopyJob_AddRef(IBackgroundCopyJob* iface)
34 BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
35 return InterlockedIncrement(&This->ref);
38 static HRESULT WINAPI BITS_IBackgroundCopyJob_QueryInterface(
39 IBackgroundCopyJob* iface, REFIID riid, LPVOID *ppvObject)
41 BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
42 TRACE("IID: %s\n", debugstr_guid(riid));
44 if (IsEqualGUID(riid, &IID_IUnknown)
45 || IsEqualGUID(riid, &IID_IBackgroundCopyJob))
47 *ppvObject = &This->lpVtbl;
48 BITS_IBackgroundCopyJob_AddRef(iface);
56 static ULONG WINAPI BITS_IBackgroundCopyJob_Release(IBackgroundCopyJob* iface)
58 BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
59 ULONG ref = InterlockedDecrement(&This->ref);
62 BackgroundCopyJobDestructor(This);
67 /*** IBackgroundCopyJob methods ***/
69 static HRESULT WINAPI BITS_IBackgroundCopyJob_AddFileSet(
70 IBackgroundCopyJob* iface,
72 BG_FILE_INFO *pFileSet)
74 FIXME("Not implemented\n");
78 static HRESULT WINAPI BITS_IBackgroundCopyJob_AddFile(
79 IBackgroundCopyJob* iface,
83 FIXME("Not implemented\n");
87 static HRESULT WINAPI BITS_IBackgroundCopyJob_EnumFiles(
88 IBackgroundCopyJob* iface,
89 IEnumBackgroundCopyFiles **pEnum)
91 FIXME("Not implemented\n");
95 static HRESULT WINAPI BITS_IBackgroundCopyJob_Suspend(
96 IBackgroundCopyJob* iface)
98 FIXME("Not implemented\n");
102 static HRESULT WINAPI BITS_IBackgroundCopyJob_Resume(
103 IBackgroundCopyJob* iface)
105 FIXME("Not implemented\n");
109 static HRESULT WINAPI BITS_IBackgroundCopyJob_Cancel(
110 IBackgroundCopyJob* iface)
112 FIXME("Not implemented\n");
116 static HRESULT WINAPI BITS_IBackgroundCopyJob_Complete(
117 IBackgroundCopyJob* iface)
119 FIXME("Not implemented\n");
123 static HRESULT WINAPI BITS_IBackgroundCopyJob_GetId(
124 IBackgroundCopyJob* iface,
127 BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
128 memcpy(pVal, &This->jobId, sizeof *pVal);
132 static HRESULT WINAPI BITS_IBackgroundCopyJob_GetType(
133 IBackgroundCopyJob* iface,
136 BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
145 static HRESULT WINAPI BITS_IBackgroundCopyJob_GetProgress(
146 IBackgroundCopyJob* iface,
147 BG_JOB_PROGRESS *pVal)
149 FIXME("Not implemented\n");
153 static HRESULT WINAPI BITS_IBackgroundCopyJob_GetTimes(
154 IBackgroundCopyJob* iface,
157 FIXME("Not implemented\n");
161 static HRESULT WINAPI BITS_IBackgroundCopyJob_GetState(
162 IBackgroundCopyJob* iface,
165 FIXME("Not implemented\n");
169 static HRESULT WINAPI BITS_IBackgroundCopyJob_GetError(
170 IBackgroundCopyJob* iface,
171 IBackgroundCopyError **ppError)
173 FIXME("Not implemented\n");
177 static HRESULT WINAPI BITS_IBackgroundCopyJob_GetOwner(
178 IBackgroundCopyJob* iface,
181 FIXME("Not implemented\n");
185 static HRESULT WINAPI BITS_IBackgroundCopyJob_SetDisplayName(
186 IBackgroundCopyJob* iface,
189 FIXME("Not implemented\n");
193 static HRESULT WINAPI BITS_IBackgroundCopyJob_GetDisplayName(
194 IBackgroundCopyJob* iface,
197 FIXME("Not implemented\n");
201 static HRESULT WINAPI BITS_IBackgroundCopyJob_SetDescription(
202 IBackgroundCopyJob* iface,
205 FIXME("Not implemented\n");
209 static HRESULT WINAPI BITS_IBackgroundCopyJob_GetDescription(
210 IBackgroundCopyJob* iface,
213 FIXME("Not implemented\n");
217 static HRESULT WINAPI BITS_IBackgroundCopyJob_SetPriority(
218 IBackgroundCopyJob* iface,
221 FIXME("Not implemented\n");
225 static HRESULT WINAPI BITS_IBackgroundCopyJob_GetPriority(
226 IBackgroundCopyJob* iface,
227 BG_JOB_PRIORITY *pVal)
229 FIXME("Not implemented\n");
233 static HRESULT WINAPI BITS_IBackgroundCopyJob_SetNotifyFlags(
234 IBackgroundCopyJob* iface,
237 FIXME("Not implemented\n");
241 static HRESULT WINAPI BITS_IBackgroundCopyJob_GetNotifyFlags(
242 IBackgroundCopyJob* iface,
245 FIXME("Not implemented\n");
249 static HRESULT WINAPI BITS_IBackgroundCopyJob_SetNotifyInterface(
250 IBackgroundCopyJob* iface,
253 FIXME("Not implemented\n");
257 static HRESULT WINAPI BITS_IBackgroundCopyJob_GetNotifyInterface(
258 IBackgroundCopyJob* iface,
261 FIXME("Not implemented\n");
265 static HRESULT WINAPI BITS_IBackgroundCopyJob_SetMinimumRetryDelay(
266 IBackgroundCopyJob* iface,
269 FIXME("Not implemented\n");
273 static HRESULT WINAPI BITS_IBackgroundCopyJob_GetMinimumRetryDelay(
274 IBackgroundCopyJob* iface,
277 FIXME("Not implemented\n");
281 static HRESULT WINAPI BITS_IBackgroundCopyJob_SetNoProgressTimeout(
282 IBackgroundCopyJob* iface,
285 FIXME("Not implemented\n");
289 static HRESULT WINAPI BITS_IBackgroundCopyJob_GetNoProgressTimeout(
290 IBackgroundCopyJob* iface,
293 FIXME("Not implemented\n");
297 static HRESULT WINAPI BITS_IBackgroundCopyJob_GetErrorCount(
298 IBackgroundCopyJob* iface,
301 FIXME("Not implemented\n");
305 static HRESULT WINAPI BITS_IBackgroundCopyJob_SetProxySettings(
306 IBackgroundCopyJob* iface,
307 BG_JOB_PROXY_USAGE ProxyUsage,
308 const WCHAR *ProxyList,
309 const WCHAR *ProxyBypassList)
311 FIXME("Not implemented\n");
315 static HRESULT WINAPI BITS_IBackgroundCopyJob_GetProxySettings(
316 IBackgroundCopyJob* iface,
317 BG_JOB_PROXY_USAGE *pProxyUsage,
319 LPWSTR *pProxyBypassList)
321 FIXME("Not implemented\n");
325 static HRESULT WINAPI BITS_IBackgroundCopyJob_TakeOwnership(
326 IBackgroundCopyJob* iface)
328 FIXME("Not implemented\n");
333 static const IBackgroundCopyJobVtbl BITS_IBackgroundCopyJob_Vtbl =
335 BITS_IBackgroundCopyJob_QueryInterface,
336 BITS_IBackgroundCopyJob_AddRef,
337 BITS_IBackgroundCopyJob_Release,
338 BITS_IBackgroundCopyJob_AddFileSet,
339 BITS_IBackgroundCopyJob_AddFile,
340 BITS_IBackgroundCopyJob_EnumFiles,
341 BITS_IBackgroundCopyJob_Suspend,
342 BITS_IBackgroundCopyJob_Resume,
343 BITS_IBackgroundCopyJob_Cancel,
344 BITS_IBackgroundCopyJob_Complete,
345 BITS_IBackgroundCopyJob_GetId,
346 BITS_IBackgroundCopyJob_GetType,
347 BITS_IBackgroundCopyJob_GetProgress,
348 BITS_IBackgroundCopyJob_GetTimes,
349 BITS_IBackgroundCopyJob_GetState,
350 BITS_IBackgroundCopyJob_GetError,
351 BITS_IBackgroundCopyJob_GetOwner,
352 BITS_IBackgroundCopyJob_SetDisplayName,
353 BITS_IBackgroundCopyJob_GetDisplayName,
354 BITS_IBackgroundCopyJob_SetDescription,
355 BITS_IBackgroundCopyJob_GetDescription,
356 BITS_IBackgroundCopyJob_SetPriority,
357 BITS_IBackgroundCopyJob_GetPriority,
358 BITS_IBackgroundCopyJob_SetNotifyFlags,
359 BITS_IBackgroundCopyJob_GetNotifyFlags,
360 BITS_IBackgroundCopyJob_SetNotifyInterface,
361 BITS_IBackgroundCopyJob_GetNotifyInterface,
362 BITS_IBackgroundCopyJob_SetMinimumRetryDelay,
363 BITS_IBackgroundCopyJob_GetMinimumRetryDelay,
364 BITS_IBackgroundCopyJob_SetNoProgressTimeout,
365 BITS_IBackgroundCopyJob_GetNoProgressTimeout,
366 BITS_IBackgroundCopyJob_GetErrorCount,
367 BITS_IBackgroundCopyJob_SetProxySettings,
368 BITS_IBackgroundCopyJob_GetProxySettings,
369 BITS_IBackgroundCopyJob_TakeOwnership,
372 HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
373 GUID *pJobId, LPVOID *ppObj)
376 BackgroundCopyJobImpl *This;
379 TRACE("(%s,%d,%p)\n", debugstr_w(displayName), type, ppObj);
381 This = HeapAlloc(GetProcessHeap(), 0, sizeof *This);
383 return E_OUTOFMEMORY;
385 This->lpVtbl = &BITS_IBackgroundCopyJob_Vtbl;
389 n = (lstrlenW(displayName) + 1) * sizeof *displayName;
390 This->displayName = HeapAlloc(GetProcessHeap(), 0, n);
391 if (!This->displayName)
393 HeapFree(GetProcessHeap(), 0, This);
394 return E_OUTOFMEMORY;
396 memcpy(This->displayName, displayName, n);
398 hr = CoCreateGuid(&This->jobId);
401 HeapFree(GetProcessHeap(), 0, This->displayName);
402 HeapFree(GetProcessHeap(), 0, This);
405 memcpy(pJobId, &This->jobId, sizeof(GUID));
407 *ppObj = &This->lpVtbl;