mfplat: Read queue subscriber within the critical section.
[wine/zf.git] / dlls / wuapi / downloader.c
blobff66dd1869943960223de8ee35b60056285267f3
1 /*
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
21 #define COBJMACROS
23 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "ole2.h"
29 #include "initguid.h"
30 #include "wuapi.h"
31 #include "wuapi_private.h"
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(wuapi);
37 typedef struct _update_downloader
39 IUpdateDownloader IUpdateDownloader_iface;
40 LONG refs;
41 } update_downloader;
43 static inline update_downloader *impl_from_IUpdateDownloader( IUpdateDownloader *iface )
45 return CONTAINING_RECORD(iface, update_downloader, IUpdateDownloader_iface);
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 );
60 if (!refs)
62 TRACE("destroying %p\n", update_downloader);
63 HeapFree( GetProcessHeap(), 0, update_downloader );
65 return refs;
68 static HRESULT WINAPI update_downloader_QueryInterface(
69 IUpdateDownloader *iface,
70 REFIID riid,
71 void **ppvObject )
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 ) )
81 *ppvObject = iface;
83 else
85 FIXME("interface %s not implemented\n", debugstr_guid(riid));
86 return E_NOINTERFACE;
88 IUpdateDownloader_AddRef( iface );
89 return S_OK;
92 static HRESULT WINAPI update_downloader_GetTypeInfoCount(
93 IUpdateDownloader *iface,
94 UINT *pctinfo )
96 FIXME("\n");
97 return E_NOTIMPL;
100 static HRESULT WINAPI update_downloader_GetTypeInfo(
101 IUpdateDownloader *iface,
102 UINT iTInfo,
103 LCID lcid,
104 ITypeInfo **ppTInfo )
106 FIXME("\n");
107 return E_NOTIMPL;
110 static HRESULT WINAPI update_downloader_GetIDsOfNames(
111 IUpdateDownloader *iface,
112 REFIID riid,
113 LPOLESTR *rgszNames,
114 UINT cNames,
115 LCID lcid,
116 DISPID *rgDispId )
118 FIXME("\n");
119 return E_NOTIMPL;
122 static HRESULT WINAPI update_downloader_Invoke(
123 IUpdateDownloader *iface,
124 DISPID dispIdMember,
125 REFIID riid,
126 LCID lcid,
127 WORD wFlags,
128 DISPPARAMS *pDispParams,
129 VARIANT *pVarResult,
130 EXCEPINFO *pExcepInfo,
131 UINT *puArgErr )
133 FIXME("\n");
134 return E_NOTIMPL;
137 static HRESULT WINAPI update_downloader_get_IsForced(
138 IUpdateDownloader *This,
139 VARIANT_BOOL *retval )
141 FIXME("\n");
142 return E_NOTIMPL;
145 static HRESULT WINAPI update_downloader_put_IsForced(
146 IUpdateDownloader *This,
147 VARIANT_BOOL value )
149 FIXME("%p, %d\n", This, value);
150 return S_OK;
153 static HRESULT WINAPI update_downloader_get_ClientApplicationID(
154 IUpdateDownloader *This,
155 BSTR *retval )
157 FIXME("\n");
158 return E_NOTIMPL;
161 static HRESULT WINAPI update_downloader_put_ClientApplicationID(
162 IUpdateDownloader *This,
163 BSTR value )
165 FIXME("%p, %s\n", This, debugstr_w(value));
166 return E_NOTIMPL;
169 static HRESULT WINAPI update_downloader_get_Priority(
170 IUpdateDownloader *This,
171 DownloadPriority *retval )
173 FIXME("\n");
174 return E_NOTIMPL;
177 static HRESULT WINAPI update_downloader_put_Priority(
178 IUpdateDownloader *This,
179 DownloadPriority value )
181 FIXME("\n");
182 return E_NOTIMPL;
185 static HRESULT WINAPI update_downloader_get_Updates(
186 IUpdateDownloader *This,
187 IUpdateCollection **retval )
189 FIXME("\n");
190 return E_NOTIMPL;
193 static HRESULT WINAPI update_downloader_put_Updates(
194 IUpdateDownloader *This,
195 IUpdateCollection *value )
197 FIXME("\n");
198 return E_NOTIMPL;
201 static HRESULT WINAPI update_downloader_BeginDownload(
202 IUpdateDownloader *This,
203 IUnknown *onProgressChanged,
204 IUnknown *onCompleted,
205 VARIANT state,
206 IDownloadJob **retval )
208 FIXME("\n");
209 return E_NOTIMPL;
212 static HRESULT WINAPI update_downloader_Download(
213 IUpdateDownloader *This,
214 IDownloadResult **retval )
216 FIXME("\n");
217 return E_NOTIMPL;
220 static HRESULT WINAPI update_downloader_EndDownload(
221 IUpdateDownloader *This,
222 IDownloadJob *value,
223 IDownloadResult **retval )
225 FIXME("\n");
226 return E_NOTIMPL;
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( LPVOID *ppObj )
253 update_downloader *downloader;
255 TRACE("(%p)\n", ppObj);
257 downloader = HeapAlloc( GetProcessHeap(), 0, sizeof(*downloader) );
258 if (!downloader) return E_OUTOFMEMORY;
260 downloader->IUpdateDownloader_iface.lpVtbl = &update_downloader_vtbl;
261 downloader->refs = 1;
263 *ppObj = &downloader->IUpdateDownloader_iface;
265 TRACE("returning iface %p\n", *ppObj);
266 return S_OK;