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 FIXME("Not implemented\n");
140 static HRESULT WINAPI
BITS_IBackgroundCopyJob_GetProgress(
141 IBackgroundCopyJob
* iface
,
142 BG_JOB_PROGRESS
*pVal
)
144 FIXME("Not implemented\n");
148 static HRESULT WINAPI
BITS_IBackgroundCopyJob_GetTimes(
149 IBackgroundCopyJob
* iface
,
152 FIXME("Not implemented\n");
156 static HRESULT WINAPI
BITS_IBackgroundCopyJob_GetState(
157 IBackgroundCopyJob
* iface
,
160 FIXME("Not implemented\n");
164 static HRESULT WINAPI
BITS_IBackgroundCopyJob_GetError(
165 IBackgroundCopyJob
* iface
,
166 IBackgroundCopyError
**ppError
)
168 FIXME("Not implemented\n");
172 static HRESULT WINAPI
BITS_IBackgroundCopyJob_GetOwner(
173 IBackgroundCopyJob
* iface
,
176 FIXME("Not implemented\n");
180 static HRESULT WINAPI
BITS_IBackgroundCopyJob_SetDisplayName(
181 IBackgroundCopyJob
* iface
,
184 FIXME("Not implemented\n");
188 static HRESULT WINAPI
BITS_IBackgroundCopyJob_GetDisplayName(
189 IBackgroundCopyJob
* iface
,
192 FIXME("Not implemented\n");
196 static HRESULT WINAPI
BITS_IBackgroundCopyJob_SetDescription(
197 IBackgroundCopyJob
* iface
,
200 FIXME("Not implemented\n");
204 static HRESULT WINAPI
BITS_IBackgroundCopyJob_GetDescription(
205 IBackgroundCopyJob
* iface
,
208 FIXME("Not implemented\n");
212 static HRESULT WINAPI
BITS_IBackgroundCopyJob_SetPriority(
213 IBackgroundCopyJob
* iface
,
216 FIXME("Not implemented\n");
220 static HRESULT WINAPI
BITS_IBackgroundCopyJob_GetPriority(
221 IBackgroundCopyJob
* iface
,
222 BG_JOB_PRIORITY
*pVal
)
224 FIXME("Not implemented\n");
228 static HRESULT WINAPI
BITS_IBackgroundCopyJob_SetNotifyFlags(
229 IBackgroundCopyJob
* iface
,
232 FIXME("Not implemented\n");
236 static HRESULT WINAPI
BITS_IBackgroundCopyJob_GetNotifyFlags(
237 IBackgroundCopyJob
* iface
,
240 FIXME("Not implemented\n");
244 static HRESULT WINAPI
BITS_IBackgroundCopyJob_SetNotifyInterface(
245 IBackgroundCopyJob
* iface
,
248 FIXME("Not implemented\n");
252 static HRESULT WINAPI
BITS_IBackgroundCopyJob_GetNotifyInterface(
253 IBackgroundCopyJob
* iface
,
256 FIXME("Not implemented\n");
260 static HRESULT WINAPI
BITS_IBackgroundCopyJob_SetMinimumRetryDelay(
261 IBackgroundCopyJob
* iface
,
264 FIXME("Not implemented\n");
268 static HRESULT WINAPI
BITS_IBackgroundCopyJob_GetMinimumRetryDelay(
269 IBackgroundCopyJob
* iface
,
272 FIXME("Not implemented\n");
276 static HRESULT WINAPI
BITS_IBackgroundCopyJob_SetNoProgressTimeout(
277 IBackgroundCopyJob
* iface
,
280 FIXME("Not implemented\n");
284 static HRESULT WINAPI
BITS_IBackgroundCopyJob_GetNoProgressTimeout(
285 IBackgroundCopyJob
* iface
,
288 FIXME("Not implemented\n");
292 static HRESULT WINAPI
BITS_IBackgroundCopyJob_GetErrorCount(
293 IBackgroundCopyJob
* iface
,
296 FIXME("Not implemented\n");
300 static HRESULT WINAPI
BITS_IBackgroundCopyJob_SetProxySettings(
301 IBackgroundCopyJob
* iface
,
302 BG_JOB_PROXY_USAGE ProxyUsage
,
303 const WCHAR
*ProxyList
,
304 const WCHAR
*ProxyBypassList
)
306 FIXME("Not implemented\n");
310 static HRESULT WINAPI
BITS_IBackgroundCopyJob_GetProxySettings(
311 IBackgroundCopyJob
* iface
,
312 BG_JOB_PROXY_USAGE
*pProxyUsage
,
314 LPWSTR
*pProxyBypassList
)
316 FIXME("Not implemented\n");
320 static HRESULT WINAPI
BITS_IBackgroundCopyJob_TakeOwnership(
321 IBackgroundCopyJob
* iface
)
323 FIXME("Not implemented\n");
328 static const IBackgroundCopyJobVtbl BITS_IBackgroundCopyJob_Vtbl
=
330 BITS_IBackgroundCopyJob_QueryInterface
,
331 BITS_IBackgroundCopyJob_AddRef
,
332 BITS_IBackgroundCopyJob_Release
,
333 BITS_IBackgroundCopyJob_AddFileSet
,
334 BITS_IBackgroundCopyJob_AddFile
,
335 BITS_IBackgroundCopyJob_EnumFiles
,
336 BITS_IBackgroundCopyJob_Suspend
,
337 BITS_IBackgroundCopyJob_Resume
,
338 BITS_IBackgroundCopyJob_Cancel
,
339 BITS_IBackgroundCopyJob_Complete
,
340 BITS_IBackgroundCopyJob_GetId
,
341 BITS_IBackgroundCopyJob_GetType
,
342 BITS_IBackgroundCopyJob_GetProgress
,
343 BITS_IBackgroundCopyJob_GetTimes
,
344 BITS_IBackgroundCopyJob_GetState
,
345 BITS_IBackgroundCopyJob_GetError
,
346 BITS_IBackgroundCopyJob_GetOwner
,
347 BITS_IBackgroundCopyJob_SetDisplayName
,
348 BITS_IBackgroundCopyJob_GetDisplayName
,
349 BITS_IBackgroundCopyJob_SetDescription
,
350 BITS_IBackgroundCopyJob_GetDescription
,
351 BITS_IBackgroundCopyJob_SetPriority
,
352 BITS_IBackgroundCopyJob_GetPriority
,
353 BITS_IBackgroundCopyJob_SetNotifyFlags
,
354 BITS_IBackgroundCopyJob_GetNotifyFlags
,
355 BITS_IBackgroundCopyJob_SetNotifyInterface
,
356 BITS_IBackgroundCopyJob_GetNotifyInterface
,
357 BITS_IBackgroundCopyJob_SetMinimumRetryDelay
,
358 BITS_IBackgroundCopyJob_GetMinimumRetryDelay
,
359 BITS_IBackgroundCopyJob_SetNoProgressTimeout
,
360 BITS_IBackgroundCopyJob_GetNoProgressTimeout
,
361 BITS_IBackgroundCopyJob_GetErrorCount
,
362 BITS_IBackgroundCopyJob_SetProxySettings
,
363 BITS_IBackgroundCopyJob_GetProxySettings
,
364 BITS_IBackgroundCopyJob_TakeOwnership
,
367 HRESULT
BackgroundCopyJobConstructor(LPCWSTR displayName
, BG_JOB_TYPE type
,
368 GUID
*pJobId
, LPVOID
*ppObj
)
371 BackgroundCopyJobImpl
*This
;
374 TRACE("(%s,%d,%p)\n", debugstr_w(displayName
), type
, ppObj
);
376 This
= HeapAlloc(GetProcessHeap(), 0, sizeof *This
);
378 return E_OUTOFMEMORY
;
380 This
->lpVtbl
= &BITS_IBackgroundCopyJob_Vtbl
;
384 n
= (lstrlenW(displayName
) + 1) * sizeof *displayName
;
385 This
->displayName
= HeapAlloc(GetProcessHeap(), 0, n
);
386 if (!This
->displayName
)
388 HeapFree(GetProcessHeap(), 0, This
);
389 return E_OUTOFMEMORY
;
391 memcpy(This
->displayName
, displayName
, n
);
393 hr
= CoCreateGuid(&This
->jobId
);
396 HeapFree(GetProcessHeap(), 0, This
->displayName
);
397 HeapFree(GetProcessHeap(), 0, This
);
400 memcpy(pJobId
, &This
->jobId
, sizeof(GUID
));
402 *ppObj
= &This
->lpVtbl
;