ReactOS  0.4.15-dev-1197-g8081ba9
downloader.c
Go to the documentation of this file.
1 /*
2  * IUpdateDownloader implementation
3  *
4  * Copyright 2008 Hans Leidekker
5  *
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.
10  *
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.
15  *
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
19  */
20 
21 #define COBJMACROS
22 
23 #include <stdarg.h>
24 
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"
32 
33 #include "wine/debug.h"
34 
36 
37 typedef struct _update_downloader
38 {
39  IUpdateDownloader IUpdateDownloader_iface;
42 
43 static inline update_downloader *impl_from_IUpdateDownloader( IUpdateDownloader *iface )
44 {
45  return CONTAINING_RECORD(iface, update_downloader, IUpdateDownloader_iface);
46 }
47 
49  IUpdateDownloader *iface )
50 {
53 }
54 
56  IUpdateDownloader *iface )
57 {
60  if (!refs)
61  {
62  TRACE("destroying %p\n", update_downloader);
64  }
65  return refs;
66 }
67 
69  IUpdateDownloader *iface,
70  REFIID riid,
71  void **ppvObject )
72 {
74 
75  TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
76 
77  if ( IsEqualGUID( riid, &IID_IUpdateDownloader ) ||
80  {
81  *ppvObject = iface;
82  }
83  else
84  {
85  FIXME("interface %s not implemented\n", debugstr_guid(riid));
86  return E_NOINTERFACE;
87  }
88  IUpdateDownloader_AddRef( iface );
89  return S_OK;
90 }
91 
93  IUpdateDownloader *iface,
94  UINT *pctinfo )
95 {
96  FIXME("\n");
97  return E_NOTIMPL;
98 }
99 
101  IUpdateDownloader *iface,
102  UINT iTInfo,
103  LCID lcid,
104  ITypeInfo **ppTInfo )
105 {
106  FIXME("\n");
107  return E_NOTIMPL;
108 }
109 
111  IUpdateDownloader *iface,
112  REFIID riid,
113  LPOLESTR *rgszNames,
114  UINT cNames,
115  LCID lcid,
116  DISPID *rgDispId )
117 {
118  FIXME("\n");
119  return E_NOTIMPL;
120 }
121 
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 )
132 {
133  FIXME("\n");
134  return E_NOTIMPL;
135 }
136 
138  IUpdateDownloader *This,
139  VARIANT_BOOL *retval )
140 {
141  FIXME("\n");
142  return E_NOTIMPL;
143 }
144 
146  IUpdateDownloader *This,
148 {
149  FIXME("%p, %d\n", This, value);
150  return S_OK;
151 }
152 
154  IUpdateDownloader *This,
155  BSTR *retval )
156 {
157  FIXME("\n");
158  return E_NOTIMPL;
159 }
160 
162  IUpdateDownloader *This,
163  BSTR value )
164 {
165  FIXME("%p, %s\n", This, debugstr_w(value));
166  return E_NOTIMPL;
167 }
168 
170  IUpdateDownloader *This,
171  DownloadPriority *retval )
172 {
173  FIXME("\n");
174  return E_NOTIMPL;
175 }
176 
178  IUpdateDownloader *This,
180 {
181  FIXME("\n");
182  return E_NOTIMPL;
183 }
184 
186  IUpdateDownloader *This,
187  IUpdateCollection **retval )
188 {
189  FIXME("\n");
190  return E_NOTIMPL;
191 }
192 
194  IUpdateDownloader *This,
195  IUpdateCollection *value )
196 {
197  FIXME("\n");
198  return E_NOTIMPL;
199 }
200 
202  IUpdateDownloader *This,
203  IUnknown *onProgressChanged,
204  IUnknown *onCompleted,
205  VARIANT state,
206  IDownloadJob **retval )
207 {
208  FIXME("\n");
209  return E_NOTIMPL;
210 }
211 
213  IUpdateDownloader *This,
214  IDownloadResult **retval )
215 {
216  FIXME("\n");
217  return E_NOTIMPL;
218 }
219 
221  IUpdateDownloader *This,
222  IDownloadJob *value,
223  IDownloadResult **retval )
224 {
225  FIXME("\n");
226  return E_NOTIMPL;
227 }
228 
229 static const struct IUpdateDownloaderVtbl update_downloader_vtbl =
230 {
249 };
250 
252 {
253  update_downloader *downloader;
254 
255  TRACE("(%p)\n", ppObj);
256 
257  downloader = HeapAlloc( GetProcessHeap(), 0, sizeof(*downloader) );
258  if (!downloader) return E_OUTOFMEMORY;
259 
260  downloader->IUpdateDownloader_iface.lpVtbl = &update_downloader_vtbl;
261  downloader->refs = 1;
262 
263  *ppObj = &downloader->IUpdateDownloader_iface;
264 
265  TRACE("returning iface %p\n", *ppObj);
266  return S_OK;
267 }
#define REFIID
Definition: guiddef.h:118
#define E_NOINTERFACE
Definition: winerror.h:2364
static HRESULT WINAPI update_downloader_BeginDownload(IUpdateDownloader *This, IUnknown *onProgressChanged, IUnknown *onCompleted, VARIANT state, IDownloadJob **retval)
Definition: downloader.c:201
IUpdateDownloader IUpdateDownloader_iface
Definition: downloader.c:39
static HRESULT WINAPI update_downloader_Download(IUpdateDownloader *This, IDownloadResult **retval)
Definition: downloader.c:212
enum WUApiLib::tagDownloadPriority DownloadPriority
static HRESULT WINAPI update_downloader_put_IsForced(IUpdateDownloader *This, VARIANT_BOOL value)
Definition: downloader.c:145
REFIID riid
Definition: precomp.h:44
static ULONG WINAPI update_downloader_AddRef(IUpdateDownloader *iface)
Definition: downloader.c:48
static const struct IUpdateDownloaderVtbl update_downloader_vtbl
Definition: downloader.c:229
static HRESULT WINAPI update_downloader_EndDownload(IUpdateDownloader *This, IDownloadJob *value, IDownloadResult **retval)
Definition: downloader.c:220
DWORD LCID
Definition: nls.h:13
OLECHAR * BSTR
Definition: compat.h:2041
static LPOLESTR
Definition: stg_prop.c:27
short VARIANT_BOOL
Definition: compat.h:2038
HRESULT UpdateDownloader_create(LPVOID *ppObj)
Definition: downloader.c:251
static HRESULT WINAPI update_downloader_get_Updates(IUpdateDownloader *This, IUpdateCollection **retval)
Definition: downloader.c:185
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
static HRESULT WINAPI update_downloader_get_IsForced(IUpdateDownloader *This, VARIANT_BOOL *retval)
Definition: downloader.c:137
struct _update_downloader update_downloader
static ULONG WINAPI update_downloader_Release(IUpdateDownloader *iface)
Definition: downloader.c:55
static HRESULT WINAPI update_downloader_GetTypeInfo(IUpdateDownloader *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: downloader.c:100
#define debugstr_guid
Definition: kernel32.h:35
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
static HRESULT WINAPI update_downloader_put_Updates(IUpdateDownloader *This, IUpdateCollection *value)
Definition: downloader.c:193
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:79
const GUID IID_IUnknown
#define WINAPI
Definition: msvc.h:6
unsigned short WORD
Definition: ntddk_ex.h:93
const GUID IID_IDispatch
static update_downloader * impl_from_IUpdateDownloader(IUpdateDownloader *iface)
Definition: downloader.c:43
#define InterlockedDecrement
Definition: armddk.h:52
static int state
Definition: maze.c:121
REFIID LPVOID * ppvObject
Definition: precomp.h:44
static HRESULT WINAPI update_downloader_GetTypeInfoCount(IUpdateDownloader *iface, UINT *pctinfo)
Definition: downloader.c:92
static HRESULT WINAPI update_downloader_get_Priority(IUpdateDownloader *This, DownloadPriority *retval)
Definition: downloader.c:169
static HRESULT WINAPI update_downloader_GetIDsOfNames(IUpdateDownloader *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: downloader.c:110
static HRESULT WINAPI update_downloader_put_Priority(IUpdateDownloader *This, DownloadPriority value)
Definition: downloader.c:177
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:534
struct stdole::EXCEPINFO EXCEPINFO
static VARIANTARG static DISPID
Definition: ordinal.c:49
#define S_OK
Definition: intsafe.h:51
#define InterlockedIncrement
Definition: armddk.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static HRESULT WINAPI update_downloader_get_ClientApplicationID(IUpdateDownloader *This, BSTR *retval)
Definition: downloader.c:153
struct stdole::DISPPARAMS DISPPARAMS
unsigned int ULONG
Definition: retypes.h:1
static HRESULT WINAPI update_downloader_Invoke(IUpdateDownloader *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: downloader.c:122
static HRESULT WINAPI update_downloader_put_ClientApplicationID(IUpdateDownloader *This, BSTR value)
Definition: downloader.c:161
#define HeapFree(x, y, z)
Definition: compat.h:483
static HRESULT WINAPI update_downloader_QueryInterface(IUpdateDownloader *iface, REFIID riid, void **ppvObject)
Definition: downloader.c:68
WINE_DEFAULT_DEBUG_CHANNEL(wuapi)