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
32 #include "wuapi_private.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(wuapi
);
38 typedef struct _update_downloader
40 IUpdateDownloader IUpdateDownloader_iface
;
44 static inline update_downloader
*impl_from_IUpdateDownloader( IUpdateDownloader
*iface
)
46 return CONTAINING_RECORD(iface
, update_downloader
, IUpdateDownloader_iface
);
49 static ULONG WINAPI
update_downloader_AddRef(
50 IUpdateDownloader
*iface
)
52 update_downloader
*update_downloader
= impl_from_IUpdateDownloader( iface
);
53 return InterlockedIncrement( &update_downloader
->refs
);
56 static ULONG WINAPI
update_downloader_Release(
57 IUpdateDownloader
*iface
)
59 update_downloader
*update_downloader
= impl_from_IUpdateDownloader( iface
);
60 LONG refs
= InterlockedDecrement( &update_downloader
->refs
);
63 TRACE("destroying %p\n", update_downloader
);
64 HeapFree( GetProcessHeap(), 0, update_downloader
);
69 static HRESULT WINAPI
update_downloader_QueryInterface(
70 IUpdateDownloader
*iface
,
74 update_downloader
*This
= impl_from_IUpdateDownloader( iface
);
76 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
78 if ( IsEqualGUID( riid
, &IID_IUpdateDownloader
) ||
79 IsEqualGUID( riid
, &IID_IDispatch
) ||
80 IsEqualGUID( riid
, &IID_IUnknown
) )
86 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
89 IUpdateDownloader_AddRef( iface
);
93 static HRESULT WINAPI
update_downloader_GetTypeInfoCount(
94 IUpdateDownloader
*iface
,
101 static HRESULT WINAPI
update_downloader_GetTypeInfo(
102 IUpdateDownloader
*iface
,
105 ITypeInfo
**ppTInfo
)
111 static HRESULT WINAPI
update_downloader_GetIDsOfNames(
112 IUpdateDownloader
*iface
,
123 static HRESULT WINAPI
update_downloader_Invoke(
124 IUpdateDownloader
*iface
,
129 DISPPARAMS
*pDispParams
,
131 EXCEPINFO
*pExcepInfo
,
138 static HRESULT WINAPI
update_downloader_get_IsForced(
139 IUpdateDownloader
*This
,
140 VARIANT_BOOL
*retval
)
146 static HRESULT WINAPI
update_downloader_put_IsForced(
147 IUpdateDownloader
*This
,
150 FIXME("%p, %d\n", This
, value
);
154 static HRESULT WINAPI
update_downloader_get_ClientApplicationID(
155 IUpdateDownloader
*This
,
162 static HRESULT WINAPI
update_downloader_put_ClientApplicationID(
163 IUpdateDownloader
*This
,
166 FIXME("%p, %s\n", This
, debugstr_w(value
));
170 static HRESULT WINAPI
update_downloader_get_Priority(
171 IUpdateDownloader
*This
,
172 DownloadPriority
*retval
)
178 static HRESULT WINAPI
update_downloader_put_Priority(
179 IUpdateDownloader
*This
,
180 DownloadPriority value
)
186 static HRESULT WINAPI
update_downloader_get_Updates(
187 IUpdateDownloader
*This
,
188 IUpdateCollection
**retval
)
194 static HRESULT WINAPI
update_downloader_put_Updates(
195 IUpdateDownloader
*This
,
196 IUpdateCollection
*value
)
202 static HRESULT WINAPI
update_downloader_BeginDownload(
203 IUpdateDownloader
*This
,
204 IUnknown
*onProgressChanged
,
205 IUnknown
*onCompleted
,
207 IDownloadJob
**retval
)
213 static HRESULT WINAPI
update_downloader_Download(
214 IUpdateDownloader
*This
,
215 IDownloadResult
**retval
)
221 static HRESULT WINAPI
update_downloader_EndDownload(
222 IUpdateDownloader
*This
,
224 IDownloadResult
**retval
)
230 static const struct IUpdateDownloaderVtbl update_downloader_vtbl
=
232 update_downloader_QueryInterface
,
233 update_downloader_AddRef
,
234 update_downloader_Release
,
235 update_downloader_GetTypeInfoCount
,
236 update_downloader_GetTypeInfo
,
237 update_downloader_GetIDsOfNames
,
238 update_downloader_Invoke
,
239 update_downloader_get_ClientApplicationID
,
240 update_downloader_put_ClientApplicationID
,
241 update_downloader_get_IsForced
,
242 update_downloader_put_IsForced
,
243 update_downloader_get_Priority
,
244 update_downloader_put_Priority
,
245 update_downloader_get_Updates
,
246 update_downloader_put_Updates
,
247 update_downloader_BeginDownload
,
248 update_downloader_Download
,
249 update_downloader_EndDownload
252 HRESULT
UpdateDownloader_create( LPVOID
*ppObj
)
254 update_downloader
*downloader
;
256 TRACE("(%p)\n", ppObj
);
258 downloader
= HeapAlloc( GetProcessHeap(), 0, sizeof(*downloader
) );
259 if (!downloader
) return E_OUTOFMEMORY
;
261 downloader
->IUpdateDownloader_iface
.lpVtbl
= &update_downloader_vtbl
;
262 downloader
->refs
= 1;
264 *ppObj
= &downloader
->IUpdateDownloader_iface
;
266 TRACE("returning iface %p\n", *ppObj
);