Synchronize with trunk r58528.
[reactos.git] / dll / win32 / wuapi / installer.c
1 /*
2 * IUpdateInstaller 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 WIN32_NO_STATUS
22 #define _INC_WINDOWS
23
24 #define COBJMACROS
25
26 #include <config.h>
27 #include <stdarg.h>
28
29 #include <windef.h>
30 #include <winbase.h>
31 //#include "winuser.h"
32 #include <ole2.h>
33 #include <wuapi.h>
34
35 #include <wine/debug.h>
36
37 WINE_DEFAULT_DEBUG_CHANNEL(wuapi);
38
39 typedef struct _update_installer
40 {
41 IUpdateInstaller IUpdateInstaller_iface;
42 LONG refs;
43 } update_installer;
44
45 static inline update_installer *impl_from_IUpdateInstaller( IUpdateInstaller *iface )
46 {
47 return CONTAINING_RECORD(iface, update_installer, IUpdateInstaller_iface);
48 }
49
50 static ULONG WINAPI update_installer_AddRef(
51 IUpdateInstaller *iface )
52 {
53 update_installer *update_installer = impl_from_IUpdateInstaller( iface );
54 return InterlockedIncrement( &update_installer->refs );
55 }
56
57 static ULONG WINAPI update_installer_Release(
58 IUpdateInstaller *iface )
59 {
60 update_installer *update_installer = impl_from_IUpdateInstaller( iface );
61 LONG refs = InterlockedDecrement( &update_installer->refs );
62 if (!refs)
63 {
64 TRACE("destroying %p\n", update_installer);
65 HeapFree( GetProcessHeap(), 0, update_installer );
66 }
67 return refs;
68 }
69
70 static HRESULT WINAPI update_installer_QueryInterface(
71 IUpdateInstaller *iface,
72 REFIID riid,
73 void **ppvObject )
74 {
75 update_installer *This = impl_from_IUpdateInstaller( iface );
76
77 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
78
79 if ( IsEqualGUID( riid, &IID_IUpdateInstaller ) ||
80 IsEqualGUID( riid, &IID_IDispatch ) ||
81 IsEqualGUID( riid, &IID_IUnknown ) )
82 {
83 *ppvObject = iface;
84 }
85 else
86 {
87 FIXME("interface %s not implemented\n", debugstr_guid(riid));
88 return E_NOINTERFACE;
89 }
90 IUpdateInstaller_AddRef( iface );
91 return S_OK;
92 }
93
94 static HRESULT WINAPI update_installer_GetTypeInfoCount(
95 IUpdateInstaller *iface,
96 UINT *pctinfo )
97 {
98 FIXME("\n");
99 return E_NOTIMPL;
100 }
101
102 static HRESULT WINAPI update_installer_GetTypeInfo(
103 IUpdateInstaller *iface,
104 UINT iTInfo,
105 LCID lcid,
106 ITypeInfo **ppTInfo )
107 {
108 FIXME("\n");
109 return E_NOTIMPL;
110 }
111
112 static HRESULT WINAPI update_installer_GetIDsOfNames(
113 IUpdateInstaller *iface,
114 REFIID riid,
115 LPOLESTR *rgszNames,
116 UINT cNames,
117 LCID lcid,
118 DISPID *rgDispId )
119 {
120 FIXME("\n");
121 return E_NOTIMPL;
122 }
123
124 static HRESULT WINAPI update_installer_Invoke(
125 IUpdateInstaller *iface,
126 DISPID dispIdMember,
127 REFIID riid,
128 LCID lcid,
129 WORD wFlags,
130 DISPPARAMS *pDispParams,
131 VARIANT *pVarResult,
132 EXCEPINFO *pExcepInfo,
133 UINT *puArgErr )
134 {
135 FIXME("\n");
136 return E_NOTIMPL;
137 }
138
139 static HRESULT WINAPI update_installer_get_ClientApplicationID(
140 IUpdateInstaller *This,
141 BSTR *retval )
142 {
143 FIXME("\n");
144 return E_NOTIMPL;
145 }
146
147 static HRESULT WINAPI update_installer_put_ClientApplicationID(
148 IUpdateInstaller *This,
149 BSTR value )
150 {
151 FIXME("%p, %s\n", This, debugstr_w(value));
152 return E_NOTIMPL;
153 }
154
155 static HRESULT WINAPI update_installer_get_IsForced(
156 IUpdateInstaller *This,
157 VARIANT_BOOL *retval )
158 {
159 FIXME("\n");
160 return E_NOTIMPL;
161 }
162
163 static HRESULT WINAPI update_installer_put_IsForced(
164 IUpdateInstaller *This,
165 VARIANT_BOOL value )
166 {
167 FIXME("\n");
168 return E_NOTIMPL;
169 }
170
171 static HRESULT WINAPI update_installer_get_ParentHwnd(
172 IUpdateInstaller *This,
173 HWND *retval )
174 {
175 FIXME("\n");
176 return E_NOTIMPL;
177 }
178
179 static HRESULT WINAPI update_installer_put_ParentHwnd(
180 IUpdateInstaller *This,
181 HWND value )
182 {
183 FIXME("\n");
184 return E_NOTIMPL;
185 }
186
187 static HRESULT WINAPI update_installer_put_ParentWindow(
188 IUpdateInstaller *This,
189 IUnknown *value )
190 {
191 FIXME("\n");
192 return E_NOTIMPL;
193 }
194
195 static HRESULT WINAPI update_installer_get_ParentWindow(
196 IUpdateInstaller *This,
197 IUnknown **retval )
198 {
199 FIXME("\n");
200 return E_NOTIMPL;
201 }
202
203 static HRESULT WINAPI update_installer_get_Updates(
204 IUpdateInstaller *This,
205 IUpdateCollection **retval )
206 {
207 FIXME("\n");
208 return E_NOTIMPL;
209 }
210
211 static HRESULT WINAPI update_installer_put_Updates(
212 IUpdateInstaller *This,
213 IUpdateCollection *value )
214 {
215 FIXME("\n");
216 return E_NOTIMPL;
217 }
218
219 static HRESULT WINAPI update_installer_BeginInstall(
220 IUpdateInstaller *This,
221 IUnknown *onProgressChanged,
222 IUnknown *onCompleted,
223 VARIANT state,
224 IInstallationJob **retval )
225 {
226 FIXME("\n");
227 return E_NOTIMPL;
228 }
229
230 static HRESULT WINAPI update_installer_BeginUninstall(
231 IUpdateInstaller *This,
232 IUnknown *onProgressChanged,
233 IUnknown *onCompleted,
234 VARIANT state,
235 IInstallationJob **retval )
236 {
237 FIXME("\n");
238 return E_NOTIMPL;
239 }
240
241 static HRESULT WINAPI update_installer_EndInstall(
242 IUpdateInstaller *This,
243 IInstallationJob *value,
244 IInstallationResult **retval )
245 {
246 FIXME("\n");
247 return E_NOTIMPL;
248 }
249
250 static HRESULT WINAPI update_installer_EndUninstall(
251 IUpdateInstaller *This,
252 IInstallationJob *value,
253 IInstallationResult **retval )
254 {
255 FIXME("\n");
256 return E_NOTIMPL;
257 }
258
259 static HRESULT WINAPI update_installer_Install(
260 IUpdateInstaller *This,
261 IInstallationResult **retval )
262 {
263 FIXME("\n");
264 return E_NOTIMPL;
265 }
266
267 static HRESULT WINAPI update_installer_RunWizard(
268 IUpdateInstaller *This,
269 BSTR dialogTitle,
270 IInstallationResult **retval )
271 {
272 FIXME("\n");
273 return E_NOTIMPL;
274 }
275
276 static HRESULT WINAPI update_installer_get_IsBusy(
277 IUpdateInstaller *This,
278 VARIANT_BOOL *retval )
279 {
280 FIXME("\n");
281 return E_NOTIMPL;
282 }
283
284 static HRESULT WINAPI update_installer_Uninstall(
285 IUpdateInstaller *This,
286 IInstallationResult **retval )
287 {
288 FIXME("\n");
289 return E_NOTIMPL;
290 }
291
292 static HRESULT WINAPI update_installer_get_AllowSourcePrompts(
293 IUpdateInstaller *This,
294 VARIANT_BOOL *retval )
295 {
296 FIXME("\n");
297 return E_NOTIMPL;
298 }
299
300 static HRESULT WINAPI update_installer_put_AllowSourcePrompts(
301 IUpdateInstaller *This,
302 VARIANT_BOOL value )
303 {
304 FIXME("\n");
305 return E_NOTIMPL;
306 }
307
308 static HRESULT WINAPI update_installer_get_RebootRequiredBeforeInstallation(
309 IUpdateInstaller *This,
310 VARIANT_BOOL *retval )
311 {
312 FIXME("\n");
313 return E_NOTIMPL;
314 }
315
316 static const struct IUpdateInstallerVtbl update_installer_vtbl =
317 {
318 update_installer_QueryInterface,
319 update_installer_AddRef,
320 update_installer_Release,
321 update_installer_GetTypeInfoCount,
322 update_installer_GetTypeInfo,
323 update_installer_GetIDsOfNames,
324 update_installer_Invoke,
325 update_installer_get_ClientApplicationID,
326 update_installer_put_ClientApplicationID,
327 update_installer_get_IsForced,
328 update_installer_put_IsForced,
329 update_installer_get_ParentHwnd,
330 update_installer_put_ParentHwnd,
331 update_installer_put_ParentWindow,
332 update_installer_get_ParentWindow,
333 update_installer_get_Updates,
334 update_installer_put_Updates,
335 update_installer_BeginInstall,
336 update_installer_BeginUninstall,
337 update_installer_EndInstall,
338 update_installer_EndUninstall,
339 update_installer_Install,
340 update_installer_RunWizard,
341 update_installer_get_IsBusy,
342 update_installer_Uninstall,
343 update_installer_get_AllowSourcePrompts,
344 update_installer_put_AllowSourcePrompts,
345 update_installer_get_RebootRequiredBeforeInstallation
346 };
347
348 HRESULT UpdateInstaller_create( IUnknown *pUnkOuter, LPVOID *ppObj )
349 {
350 update_installer *installer;
351
352 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
353
354 installer = HeapAlloc( GetProcessHeap(), 0, sizeof(*installer) );
355 if (!installer) return E_OUTOFMEMORY;
356
357 installer->IUpdateInstaller_iface.lpVtbl = &update_installer_vtbl;
358 installer->refs = 1;
359
360 *ppObj = &installer->IUpdateInstaller_iface;
361
362 TRACE("returning iface %p\n", *ppObj);
363 return S_OK;
364 }