1c2c66affSColin Finck /*
2c2c66affSColin Finck * IUpdateDownloader implementation
3c2c66affSColin Finck *
4c2c66affSColin Finck * Copyright 2008 Hans Leidekker
5c2c66affSColin Finck *
6c2c66affSColin Finck * This library is free software; you can redistribute it and/or
7c2c66affSColin Finck * modify it under the terms of the GNU Lesser General Public
8c2c66affSColin Finck * License as published by the Free Software Foundation; either
9c2c66affSColin Finck * version 2.1 of the License, or (at your option) any later version.
10c2c66affSColin Finck *
11c2c66affSColin Finck * This library is distributed in the hope that it will be useful,
12c2c66affSColin Finck * but WITHOUT ANY WARRANTY; without even the implied warranty of
13c2c66affSColin Finck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14c2c66affSColin Finck * Lesser General Public License for more details.
15c2c66affSColin Finck *
16c2c66affSColin Finck * You should have received a copy of the GNU Lesser General Public
17c2c66affSColin Finck * License along with this library; if not, write to the Free Software
18c2c66affSColin Finck * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19c2c66affSColin Finck */
20c2c66affSColin Finck
21*150fba8dSAmine Khaldi #define COBJMACROS
22*150fba8dSAmine Khaldi
23*150fba8dSAmine Khaldi #include <stdarg.h>
24*150fba8dSAmine Khaldi
25*150fba8dSAmine Khaldi #include "windef.h"
26*150fba8dSAmine Khaldi #include "winbase.h"
27*150fba8dSAmine Khaldi #include "winuser.h"
28*150fba8dSAmine Khaldi #include "ole2.h"
29*150fba8dSAmine Khaldi #include "initguid.h"
30*150fba8dSAmine Khaldi #include "wuapi.h"
31c2c66affSColin Finck #include "wuapi_private.h"
32c2c66affSColin Finck
33*150fba8dSAmine Khaldi #include "wine/debug.h"
34*150fba8dSAmine Khaldi
35*150fba8dSAmine Khaldi WINE_DEFAULT_DEBUG_CHANNEL(wuapi);
36*150fba8dSAmine Khaldi
37c2c66affSColin Finck typedef struct _update_downloader
38c2c66affSColin Finck {
39c2c66affSColin Finck IUpdateDownloader IUpdateDownloader_iface;
40c2c66affSColin Finck LONG refs;
41c2c66affSColin Finck } update_downloader;
42c2c66affSColin Finck
impl_from_IUpdateDownloader(IUpdateDownloader * iface)43c2c66affSColin Finck static inline update_downloader *impl_from_IUpdateDownloader( IUpdateDownloader *iface )
44c2c66affSColin Finck {
45c2c66affSColin Finck return CONTAINING_RECORD(iface, update_downloader, IUpdateDownloader_iface);
46c2c66affSColin Finck }
47c2c66affSColin Finck
update_downloader_AddRef(IUpdateDownloader * iface)48c2c66affSColin Finck static ULONG WINAPI update_downloader_AddRef(
49c2c66affSColin Finck IUpdateDownloader *iface )
50c2c66affSColin Finck {
51c2c66affSColin Finck update_downloader *update_downloader = impl_from_IUpdateDownloader( iface );
52c2c66affSColin Finck return InterlockedIncrement( &update_downloader->refs );
53c2c66affSColin Finck }
54c2c66affSColin Finck
update_downloader_Release(IUpdateDownloader * iface)55c2c66affSColin Finck static ULONG WINAPI update_downloader_Release(
56c2c66affSColin Finck IUpdateDownloader *iface )
57c2c66affSColin Finck {
58c2c66affSColin Finck update_downloader *update_downloader = impl_from_IUpdateDownloader( iface );
59c2c66affSColin Finck LONG refs = InterlockedDecrement( &update_downloader->refs );
60c2c66affSColin Finck if (!refs)
61c2c66affSColin Finck {
62c2c66affSColin Finck TRACE("destroying %p\n", update_downloader);
63c2c66affSColin Finck HeapFree( GetProcessHeap(), 0, update_downloader );
64c2c66affSColin Finck }
65c2c66affSColin Finck return refs;
66c2c66affSColin Finck }
67c2c66affSColin Finck
update_downloader_QueryInterface(IUpdateDownloader * iface,REFIID riid,void ** ppvObject)68c2c66affSColin Finck static HRESULT WINAPI update_downloader_QueryInterface(
69c2c66affSColin Finck IUpdateDownloader *iface,
70c2c66affSColin Finck REFIID riid,
71c2c66affSColin Finck void **ppvObject )
72c2c66affSColin Finck {
73c2c66affSColin Finck update_downloader *This = impl_from_IUpdateDownloader( iface );
74c2c66affSColin Finck
75c2c66affSColin Finck TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
76c2c66affSColin Finck
77c2c66affSColin Finck if ( IsEqualGUID( riid, &IID_IUpdateDownloader ) ||
78c2c66affSColin Finck IsEqualGUID( riid, &IID_IDispatch ) ||
79c2c66affSColin Finck IsEqualGUID( riid, &IID_IUnknown ) )
80c2c66affSColin Finck {
81c2c66affSColin Finck *ppvObject = iface;
82c2c66affSColin Finck }
83c2c66affSColin Finck else
84c2c66affSColin Finck {
85c2c66affSColin Finck FIXME("interface %s not implemented\n", debugstr_guid(riid));
86c2c66affSColin Finck return E_NOINTERFACE;
87c2c66affSColin Finck }
88c2c66affSColin Finck IUpdateDownloader_AddRef( iface );
89c2c66affSColin Finck return S_OK;
90c2c66affSColin Finck }
91c2c66affSColin Finck
update_downloader_GetTypeInfoCount(IUpdateDownloader * iface,UINT * pctinfo)92c2c66affSColin Finck static HRESULT WINAPI update_downloader_GetTypeInfoCount(
93c2c66affSColin Finck IUpdateDownloader *iface,
94c2c66affSColin Finck UINT *pctinfo )
95c2c66affSColin Finck {
96c2c66affSColin Finck FIXME("\n");
97c2c66affSColin Finck return E_NOTIMPL;
98c2c66affSColin Finck }
99c2c66affSColin Finck
update_downloader_GetTypeInfo(IUpdateDownloader * iface,UINT iTInfo,LCID lcid,ITypeInfo ** ppTInfo)100c2c66affSColin Finck static HRESULT WINAPI update_downloader_GetTypeInfo(
101c2c66affSColin Finck IUpdateDownloader *iface,
102c2c66affSColin Finck UINT iTInfo,
103c2c66affSColin Finck LCID lcid,
104c2c66affSColin Finck ITypeInfo **ppTInfo )
105c2c66affSColin Finck {
106c2c66affSColin Finck FIXME("\n");
107c2c66affSColin Finck return E_NOTIMPL;
108c2c66affSColin Finck }
109c2c66affSColin Finck
update_downloader_GetIDsOfNames(IUpdateDownloader * iface,REFIID riid,LPOLESTR * rgszNames,UINT cNames,LCID lcid,DISPID * rgDispId)110c2c66affSColin Finck static HRESULT WINAPI update_downloader_GetIDsOfNames(
111c2c66affSColin Finck IUpdateDownloader *iface,
112c2c66affSColin Finck REFIID riid,
113c2c66affSColin Finck LPOLESTR *rgszNames,
114c2c66affSColin Finck UINT cNames,
115c2c66affSColin Finck LCID lcid,
116c2c66affSColin Finck DISPID *rgDispId )
117c2c66affSColin Finck {
118c2c66affSColin Finck FIXME("\n");
119c2c66affSColin Finck return E_NOTIMPL;
120c2c66affSColin Finck }
121c2c66affSColin Finck
update_downloader_Invoke(IUpdateDownloader * iface,DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS * pDispParams,VARIANT * pVarResult,EXCEPINFO * pExcepInfo,UINT * puArgErr)122c2c66affSColin Finck static HRESULT WINAPI update_downloader_Invoke(
123c2c66affSColin Finck IUpdateDownloader *iface,
124c2c66affSColin Finck DISPID dispIdMember,
125c2c66affSColin Finck REFIID riid,
126c2c66affSColin Finck LCID lcid,
127c2c66affSColin Finck WORD wFlags,
128c2c66affSColin Finck DISPPARAMS *pDispParams,
129c2c66affSColin Finck VARIANT *pVarResult,
130c2c66affSColin Finck EXCEPINFO *pExcepInfo,
131c2c66affSColin Finck UINT *puArgErr )
132c2c66affSColin Finck {
133c2c66affSColin Finck FIXME("\n");
134c2c66affSColin Finck return E_NOTIMPL;
135c2c66affSColin Finck }
136c2c66affSColin Finck
update_downloader_get_IsForced(IUpdateDownloader * This,VARIANT_BOOL * retval)137c2c66affSColin Finck static HRESULT WINAPI update_downloader_get_IsForced(
138c2c66affSColin Finck IUpdateDownloader *This,
139c2c66affSColin Finck VARIANT_BOOL *retval )
140c2c66affSColin Finck {
141c2c66affSColin Finck FIXME("\n");
142c2c66affSColin Finck return E_NOTIMPL;
143c2c66affSColin Finck }
144c2c66affSColin Finck
update_downloader_put_IsForced(IUpdateDownloader * This,VARIANT_BOOL value)145c2c66affSColin Finck static HRESULT WINAPI update_downloader_put_IsForced(
146c2c66affSColin Finck IUpdateDownloader *This,
147c2c66affSColin Finck VARIANT_BOOL value )
148c2c66affSColin Finck {
149c2c66affSColin Finck FIXME("%p, %d\n", This, value);
150c2c66affSColin Finck return S_OK;
151c2c66affSColin Finck }
152c2c66affSColin Finck
update_downloader_get_ClientApplicationID(IUpdateDownloader * This,BSTR * retval)153c2c66affSColin Finck static HRESULT WINAPI update_downloader_get_ClientApplicationID(
154c2c66affSColin Finck IUpdateDownloader *This,
155c2c66affSColin Finck BSTR *retval )
156c2c66affSColin Finck {
157c2c66affSColin Finck FIXME("\n");
158c2c66affSColin Finck return E_NOTIMPL;
159c2c66affSColin Finck }
160c2c66affSColin Finck
update_downloader_put_ClientApplicationID(IUpdateDownloader * This,BSTR value)161c2c66affSColin Finck static HRESULT WINAPI update_downloader_put_ClientApplicationID(
162c2c66affSColin Finck IUpdateDownloader *This,
163c2c66affSColin Finck BSTR value )
164c2c66affSColin Finck {
165c2c66affSColin Finck FIXME("%p, %s\n", This, debugstr_w(value));
166c2c66affSColin Finck return E_NOTIMPL;
167c2c66affSColin Finck }
168c2c66affSColin Finck
update_downloader_get_Priority(IUpdateDownloader * This,DownloadPriority * retval)169c2c66affSColin Finck static HRESULT WINAPI update_downloader_get_Priority(
170c2c66affSColin Finck IUpdateDownloader *This,
171c2c66affSColin Finck DownloadPriority *retval )
172c2c66affSColin Finck {
173c2c66affSColin Finck FIXME("\n");
174c2c66affSColin Finck return E_NOTIMPL;
175c2c66affSColin Finck }
176c2c66affSColin Finck
update_downloader_put_Priority(IUpdateDownloader * This,DownloadPriority value)177c2c66affSColin Finck static HRESULT WINAPI update_downloader_put_Priority(
178c2c66affSColin Finck IUpdateDownloader *This,
179c2c66affSColin Finck DownloadPriority value )
180c2c66affSColin Finck {
181c2c66affSColin Finck FIXME("\n");
182c2c66affSColin Finck return E_NOTIMPL;
183c2c66affSColin Finck }
184c2c66affSColin Finck
update_downloader_get_Updates(IUpdateDownloader * This,IUpdateCollection ** retval)185c2c66affSColin Finck static HRESULT WINAPI update_downloader_get_Updates(
186c2c66affSColin Finck IUpdateDownloader *This,
187c2c66affSColin Finck IUpdateCollection **retval )
188c2c66affSColin Finck {
189c2c66affSColin Finck FIXME("\n");
190c2c66affSColin Finck return E_NOTIMPL;
191c2c66affSColin Finck }
192c2c66affSColin Finck
update_downloader_put_Updates(IUpdateDownloader * This,IUpdateCollection * value)193c2c66affSColin Finck static HRESULT WINAPI update_downloader_put_Updates(
194c2c66affSColin Finck IUpdateDownloader *This,
195c2c66affSColin Finck IUpdateCollection *value )
196c2c66affSColin Finck {
197c2c66affSColin Finck FIXME("\n");
198c2c66affSColin Finck return E_NOTIMPL;
199c2c66affSColin Finck }
200c2c66affSColin Finck
update_downloader_BeginDownload(IUpdateDownloader * This,IUnknown * onProgressChanged,IUnknown * onCompleted,VARIANT state,IDownloadJob ** retval)201c2c66affSColin Finck static HRESULT WINAPI update_downloader_BeginDownload(
202c2c66affSColin Finck IUpdateDownloader *This,
203c2c66affSColin Finck IUnknown *onProgressChanged,
204c2c66affSColin Finck IUnknown *onCompleted,
205c2c66affSColin Finck VARIANT state,
206c2c66affSColin Finck IDownloadJob **retval )
207c2c66affSColin Finck {
208c2c66affSColin Finck FIXME("\n");
209c2c66affSColin Finck return E_NOTIMPL;
210c2c66affSColin Finck }
211c2c66affSColin Finck
update_downloader_Download(IUpdateDownloader * This,IDownloadResult ** retval)212c2c66affSColin Finck static HRESULT WINAPI update_downloader_Download(
213c2c66affSColin Finck IUpdateDownloader *This,
214c2c66affSColin Finck IDownloadResult **retval )
215c2c66affSColin Finck {
216c2c66affSColin Finck FIXME("\n");
217c2c66affSColin Finck return E_NOTIMPL;
218c2c66affSColin Finck }
219c2c66affSColin Finck
update_downloader_EndDownload(IUpdateDownloader * This,IDownloadJob * value,IDownloadResult ** retval)220c2c66affSColin Finck static HRESULT WINAPI update_downloader_EndDownload(
221c2c66affSColin Finck IUpdateDownloader *This,
222c2c66affSColin Finck IDownloadJob *value,
223c2c66affSColin Finck IDownloadResult **retval )
224c2c66affSColin Finck {
225c2c66affSColin Finck FIXME("\n");
226c2c66affSColin Finck return E_NOTIMPL;
227c2c66affSColin Finck }
228c2c66affSColin Finck
229c2c66affSColin Finck static const struct IUpdateDownloaderVtbl update_downloader_vtbl =
230c2c66affSColin Finck {
231c2c66affSColin Finck update_downloader_QueryInterface,
232c2c66affSColin Finck update_downloader_AddRef,
233c2c66affSColin Finck update_downloader_Release,
234c2c66affSColin Finck update_downloader_GetTypeInfoCount,
235c2c66affSColin Finck update_downloader_GetTypeInfo,
236c2c66affSColin Finck update_downloader_GetIDsOfNames,
237c2c66affSColin Finck update_downloader_Invoke,
238c2c66affSColin Finck update_downloader_get_ClientApplicationID,
239c2c66affSColin Finck update_downloader_put_ClientApplicationID,
240c2c66affSColin Finck update_downloader_get_IsForced,
241c2c66affSColin Finck update_downloader_put_IsForced,
242c2c66affSColin Finck update_downloader_get_Priority,
243c2c66affSColin Finck update_downloader_put_Priority,
244c2c66affSColin Finck update_downloader_get_Updates,
245c2c66affSColin Finck update_downloader_put_Updates,
246c2c66affSColin Finck update_downloader_BeginDownload,
247c2c66affSColin Finck update_downloader_Download,
248c2c66affSColin Finck update_downloader_EndDownload
249c2c66affSColin Finck };
250c2c66affSColin Finck
UpdateDownloader_create(LPVOID * ppObj)251c2c66affSColin Finck HRESULT UpdateDownloader_create( LPVOID *ppObj )
252c2c66affSColin Finck {
253c2c66affSColin Finck update_downloader *downloader;
254c2c66affSColin Finck
255c2c66affSColin Finck TRACE("(%p)\n", ppObj);
256c2c66affSColin Finck
257c2c66affSColin Finck downloader = HeapAlloc( GetProcessHeap(), 0, sizeof(*downloader) );
258c2c66affSColin Finck if (!downloader) return E_OUTOFMEMORY;
259c2c66affSColin Finck
260c2c66affSColin Finck downloader->IUpdateDownloader_iface.lpVtbl = &update_downloader_vtbl;
261c2c66affSColin Finck downloader->refs = 1;
262c2c66affSColin Finck
263c2c66affSColin Finck *ppObj = &downloader->IUpdateDownloader_iface;
264c2c66affSColin Finck
265c2c66affSColin Finck TRACE("returning iface %p\n", *ppObj);
266c2c66affSColin Finck return S_OK;
267c2c66affSColin Finck }
268