2 * IUpdateDownloader implementation
4 * Copyright 2008 Hans Leidekker
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
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(wuapi);
37 typedef struct _update_downloader
39 const struct IUpdateDownloaderVtbl *vtbl;
43 static inline update_downloader *impl_from_IUpdateDownloader( IUpdateDownloader *iface )
45 return (update_downloader *)((char *)iface - FIELD_OFFSET( update_downloader, vtbl ));
48 static ULONG WINAPI update_downloader_AddRef(
49 IUpdateDownloader *iface )
51 update_downloader *update_downloader = impl_from_IUpdateDownloader( iface );
52 return InterlockedIncrement( &update_downloader->refs );
55 static ULONG WINAPI update_downloader_Release(
56 IUpdateDownloader *iface )
58 update_downloader *update_downloader = impl_from_IUpdateDownloader( iface );
59 LONG refs = InterlockedDecrement( &update_downloader->refs );
62 TRACE("destroying %p\n", update_downloader);
63 HeapFree( GetProcessHeap(), 0, update_downloader );
68 static HRESULT WINAPI update_downloader_QueryInterface(
69 IUpdateDownloader *iface,
73 update_downloader *This = impl_from_IUpdateDownloader( iface );
75 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
77 if ( IsEqualGUID( riid, &IID_IUpdateDownloader ) ||
78 IsEqualGUID( riid, &IID_IDispatch ) ||
79 IsEqualGUID( riid, &IID_IUnknown ) )
85 FIXME("interface %s not implemented\n", debugstr_guid(riid));
88 IUpdateDownloader_AddRef( iface );
92 static HRESULT WINAPI update_downloader_GetTypeInfoCount(
93 IUpdateDownloader *iface,
100 static HRESULT WINAPI update_downloader_GetTypeInfo(
101 IUpdateDownloader *iface,
104 ITypeInfo **ppTInfo )
110 static HRESULT WINAPI update_downloader_GetIDsOfNames(
111 IUpdateDownloader *iface,
122 static HRESULT WINAPI update_downloader_Invoke(
123 IUpdateDownloader *iface,
128 DISPPARAMS *pDispParams,
130 EXCEPINFO *pExcepInfo,
137 static HRESULT WINAPI update_downloader_get_IsForced(
138 IUpdateDownloader *This,
139 VARIANT_BOOL *retval )
145 static HRESULT WINAPI update_downloader_put_IsForced(
146 IUpdateDownloader *This,
149 FIXME("%p, %d\n", This, value);
153 static HRESULT WINAPI update_downloader_get_ClientApplicationID(
154 IUpdateDownloader *This,
161 static HRESULT WINAPI update_downloader_put_ClientApplicationID(
162 IUpdateDownloader *This,
165 FIXME("%p, %s\n", This, debugstr_w(value));
169 static HRESULT WINAPI update_downloader_get_Priority(
170 IUpdateDownloader *This,
171 DownloadPriority *retval )
177 static HRESULT WINAPI update_downloader_put_Priority(
178 IUpdateDownloader *This,
179 DownloadPriority value )
185 static HRESULT WINAPI update_downloader_get_Updates(
186 IUpdateDownloader *This,
187 IUpdateCollection **retval )
193 static HRESULT WINAPI update_downloader_put_Updates(
194 IUpdateDownloader *This,
195 IUpdateCollection *value )
201 static HRESULT WINAPI update_downloader_BeginDownload(
202 IUpdateDownloader *This,
203 IUnknown *onProgressChanged,
204 IUnknown *onCompleted,
206 IDownloadJob **retval )
212 static HRESULT WINAPI update_downloader_Download(
213 IUpdateDownloader *This,
214 IDownloadResult **retval )
220 static HRESULT WINAPI update_downloader_EndDownload(
221 IUpdateDownloader *This,
223 IDownloadResult **retval )
229 static const struct IUpdateDownloaderVtbl update_downloader_vtbl =
231 update_downloader_QueryInterface,
232 update_downloader_AddRef,
233 update_downloader_Release,
234 update_downloader_GetTypeInfoCount,
235 update_downloader_GetTypeInfo,
236 update_downloader_GetIDsOfNames,
237 update_downloader_Invoke,
238 update_downloader_get_ClientApplicationID,
239 update_downloader_put_ClientApplicationID,
240 update_downloader_get_IsForced,
241 update_downloader_put_IsForced,
242 update_downloader_get_Priority,
243 update_downloader_put_Priority,
244 update_downloader_get_Updates,
245 update_downloader_put_Updates,
246 update_downloader_BeginDownload,
247 update_downloader_Download,
248 update_downloader_EndDownload
251 HRESULT UpdateDownloader_create( IUnknown *pUnkOuter, LPVOID *ppObj )
253 update_downloader *downloader;
255 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
257 downloader = HeapAlloc( GetProcessHeap(), 0, sizeof(*downloader) );
258 if (!downloader) return E_OUTOFMEMORY;
260 downloader->vtbl = &update_downloader_vtbl;
261 downloader->refs = 1;
263 *ppObj = &downloader->vtbl;
265 TRACE("returning iface %p\n", *ppObj);