server: Don't clip update regions to the desktop window.
[wine.git] / dlls / inseng / inseng_main.c
blob93649e20e94c2c885ec94d7d76b4e8eb3a397ac2
1 /*
2 * INSENG Implementation
4 * Copyright 2006 Mike McCormack
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 "config.h"
25 #include <stdarg.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winuser.h"
30 #include "ole2.h"
31 #include "rpcproxy.h"
32 #include "initguid.h"
33 #include "inseng.h"
35 #include "wine/debug.h"
36 #include "wine/heap.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(inseng);
40 static HINSTANCE instance;
42 struct InstallEngine {
43 IInstallEngine2 IInstallEngine2_iface;
44 LONG ref;
47 static inline InstallEngine *impl_from_IInstallEngine2(IInstallEngine2 *iface)
49 return CONTAINING_RECORD(iface, InstallEngine, IInstallEngine2_iface);
52 static HRESULT WINAPI InstallEngine_QueryInterface(IInstallEngine2 *iface, REFIID riid, void **ppv)
54 InstallEngine *This = impl_from_IInstallEngine2(iface);
56 if(IsEqualGUID(&IID_IUnknown, riid)) {
57 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
58 *ppv = &This->IInstallEngine2_iface;
59 }else if(IsEqualGUID(&IID_IInstallEngine, riid)) {
60 TRACE("(%p)->(IID_IInstallEngine %p)\n", This, ppv);
61 *ppv = &This->IInstallEngine2_iface;
62 }else if(IsEqualGUID(&IID_IInstallEngine2, riid)) {
63 TRACE("(%p)->(IID_IInstallEngine2 %p)\n", This, ppv);
64 *ppv = &This->IInstallEngine2_iface;
65 }else {
66 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
67 *ppv = NULL;
68 return E_NOINTERFACE;
71 IUnknown_AddRef((IUnknown*)*ppv);
72 return S_OK;
75 static ULONG WINAPI InstallEngine_AddRef(IInstallEngine2 *iface)
77 InstallEngine *This = impl_from_IInstallEngine2(iface);
78 LONG ref = InterlockedIncrement(&This->ref);
80 TRACE("(%p) ref=%d\n", This, ref);
82 return ref;
85 static ULONG WINAPI InstallEngine_Release(IInstallEngine2 *iface)
87 InstallEngine *This = impl_from_IInstallEngine2(iface);
88 LONG ref = InterlockedDecrement(&This->ref);
90 TRACE("(%p) ref=%d\n", This, ref);
92 if(!ref)
93 heap_free(This);
95 return ref;
98 static HRESULT WINAPI InstallEngine_GetEngineStatus(IInstallEngine2 *iface, DWORD *status)
100 InstallEngine *This = impl_from_IInstallEngine2(iface);
101 FIXME("(%p)->(%p)\n", This, status);
102 return E_NOTIMPL;
105 static HRESULT WINAPI InstallEngine_SetCifFile(IInstallEngine2 *iface, const char *cab_name, const char *cif_name)
107 InstallEngine *This = impl_from_IInstallEngine2(iface);
108 FIXME("(%p)->(%s %s)\n", This, debugstr_a(cab_name), debugstr_a(cif_name));
109 return E_NOTIMPL;
112 static HRESULT WINAPI InstallEngine_DownloadComponents(IInstallEngine2 *iface, DWORD flags)
114 InstallEngine *This = impl_from_IInstallEngine2(iface);
115 FIXME("(%p)->(%x)\n", This, flags);
116 return E_NOTIMPL;
119 static HRESULT WINAPI InstallEngine_InstallComponents(IInstallEngine2 *iface, DWORD flags)
121 InstallEngine *This = impl_from_IInstallEngine2(iface);
122 FIXME("(%p)->(%x)\n", This, flags);
123 return E_NOTIMPL;
126 static HRESULT WINAPI InstallEngine_EnumInstallIDs(IInstallEngine2 *iface, UINT index, char **id)
128 InstallEngine *This = impl_from_IInstallEngine2(iface);
129 FIXME("(%p)->(%d %p)\n", This, index, id);
130 return E_NOTIMPL;
133 static HRESULT WINAPI InstallEngine_EnumDownloadIDs(IInstallEngine2 *iface, UINT index, char **id)
135 InstallEngine *This = impl_from_IInstallEngine2(iface);
136 FIXME("(%p)->(%d %p)\n", This, index, id);
137 return E_NOTIMPL;
140 static HRESULT WINAPI InstallEngine_IsComponentInstalled(IInstallEngine2 *iface, const char *id, DWORD *status)
142 InstallEngine *This = impl_from_IInstallEngine2(iface);
143 FIXME("(%p)->(%s %p)\n", This, debugstr_a(id), status);
144 return E_NOTIMPL;
147 static HRESULT WINAPI InstallEngine_RegisterInstallEngineCallback(IInstallEngine2 *iface, IInstallEngineCallback *callback)
149 InstallEngine *This = impl_from_IInstallEngine2(iface);
150 FIXME("(%p)->(%p)\n", This, callback);
151 return E_NOTIMPL;
154 static HRESULT WINAPI InstallEngine_UnregisterInstallEngineCallback(IInstallEngine2 *iface)
156 InstallEngine *This = impl_from_IInstallEngine2(iface);
157 FIXME("(%p)\n", This);
158 return E_NOTIMPL;
161 static HRESULT WINAPI InstallEngine_SetAction(IInstallEngine2 *iface, const char *id, DWORD action, DWORD priority)
163 InstallEngine *This = impl_from_IInstallEngine2(iface);
164 FIXME("(%p)->(%s %d %d)\n", This, debugstr_a(id), action, priority);
165 return E_NOTIMPL;
168 static HRESULT WINAPI InstallEngine_GetSizes(IInstallEngine2 *iface, const char *id, COMPONENT_SIZES *sizes)
170 InstallEngine *This = impl_from_IInstallEngine2(iface);
171 FIXME("(%p)->(%s %p)\n", This, debugstr_a(id), sizes);
172 return E_NOTIMPL;
175 static HRESULT WINAPI InstallEngine_LaunchExtraCommand(IInstallEngine2 *iface, const char *inf_name, const char *section)
177 InstallEngine *This = impl_from_IInstallEngine2(iface);
178 FIXME("(%p)->(%s %s)\n", This, debugstr_a(inf_name), debugstr_a(section));
179 return E_NOTIMPL;
182 static HRESULT WINAPI InstallEngine_GetDisplayName(IInstallEngine2 *iface, const char *id, const char *name)
184 InstallEngine *This = impl_from_IInstallEngine2(iface);
185 FIXME("(%p)->(%s %s)\n", This, debugstr_a(id), debugstr_a(name));
186 return E_NOTIMPL;
189 static HRESULT WINAPI InstallEngine_SetBaseUrl(IInstallEngine2 *iface, const char *base_name)
191 InstallEngine *This = impl_from_IInstallEngine2(iface);
192 FIXME("(%p)->(%s)\n", This, debugstr_a(base_name));
193 return E_NOTIMPL;
196 static HRESULT WINAPI InstallEngine_SetDownloadDir(IInstallEngine2 *iface, const char *download_dir)
198 InstallEngine *This = impl_from_IInstallEngine2(iface);
199 FIXME("(%p)->(%s)\n", This, debugstr_a(download_dir));
200 return E_NOTIMPL;
203 static HRESULT WINAPI InstallEngine_SetInstallDrive(IInstallEngine2 *iface, char drive)
205 InstallEngine *This = impl_from_IInstallEngine2(iface);
206 FIXME("(%p)->(%c)\n", This, drive);
207 return E_NOTIMPL;
210 static HRESULT WINAPI InstallEngine_SetInstallOptions(IInstallEngine2 *iface, DWORD flags)
212 InstallEngine *This = impl_from_IInstallEngine2(iface);
213 FIXME("(%p)->(%x)\n", This, flags);
214 return E_NOTIMPL;
217 static HRESULT WINAPI InstallEngine_SetHWND(IInstallEngine2 *iface, HWND hwnd)
219 InstallEngine *This = impl_from_IInstallEngine2(iface);
220 FIXME("(%p)->(%p)\n", This, hwnd);
221 return E_NOTIMPL;
224 static HRESULT WINAPI InstallEngine_SetIStream(IInstallEngine2 *iface, IStream *stream)
226 InstallEngine *This = impl_from_IInstallEngine2(iface);
227 FIXME("(%p)->(%p)\n", This, stream);
228 return E_NOTIMPL;
231 static HRESULT WINAPI InstallEngine_Abort(IInstallEngine2 *iface, DWORD flags)
233 InstallEngine *This = impl_from_IInstallEngine2(iface);
234 FIXME("(%p)->(%x)\n", This, flags);
235 return E_NOTIMPL;
238 static HRESULT WINAPI InstallEngine_Suspend(IInstallEngine2 *iface)
240 InstallEngine *This = impl_from_IInstallEngine2(iface);
241 FIXME("(%p)\n", This);
242 return E_NOTIMPL;
245 static HRESULT WINAPI InstallEngine_Resume(IInstallEngine2 *iface)
247 InstallEngine *This = impl_from_IInstallEngine2(iface);
248 FIXME("(%p)\n", This);
249 return E_NOTIMPL;
252 static HRESULT WINAPI InstallEngine2_SetLocalCif(IInstallEngine2 *iface, const char *cif)
254 InstallEngine *This = impl_from_IInstallEngine2(iface);
255 FIXME("(%p)->(%s)\n", This, debugstr_a(cif));
256 return E_NOTIMPL;
259 static HRESULT WINAPI InstallEngine2_GetICifFile(IInstallEngine2 *iface, ICifFile **cif_file)
261 InstallEngine *This = impl_from_IInstallEngine2(iface);
262 FIXME("(%p)->(%p)\n", This, cif_file);
263 return E_NOTIMPL;
266 static const IInstallEngine2Vtbl InstallEngine2Vtbl = {
267 InstallEngine_QueryInterface,
268 InstallEngine_AddRef,
269 InstallEngine_Release,
270 InstallEngine_GetEngineStatus,
271 InstallEngine_SetCifFile,
272 InstallEngine_DownloadComponents,
273 InstallEngine_InstallComponents,
274 InstallEngine_EnumInstallIDs,
275 InstallEngine_EnumDownloadIDs,
276 InstallEngine_IsComponentInstalled,
277 InstallEngine_RegisterInstallEngineCallback,
278 InstallEngine_UnregisterInstallEngineCallback,
279 InstallEngine_SetAction,
280 InstallEngine_GetSizes,
281 InstallEngine_LaunchExtraCommand,
282 InstallEngine_GetDisplayName,
283 InstallEngine_SetBaseUrl,
284 InstallEngine_SetDownloadDir,
285 InstallEngine_SetInstallDrive,
286 InstallEngine_SetInstallOptions,
287 InstallEngine_SetHWND,
288 InstallEngine_SetIStream,
289 InstallEngine_Abort,
290 InstallEngine_Suspend,
291 InstallEngine_Resume,
292 InstallEngine2_SetLocalCif,
293 InstallEngine2_GetICifFile
296 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
298 *ppv = NULL;
300 if(IsEqualGUID(&IID_IUnknown, riid)) {
301 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
302 *ppv = iface;
303 }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
304 TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
305 *ppv = iface;
308 if(*ppv) {
309 IUnknown_AddRef((IUnknown*)*ppv);
310 return S_OK;
313 FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
314 return E_NOINTERFACE;
317 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
319 return 2;
322 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
324 return 1;
327 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
329 return S_OK;
332 static HRESULT WINAPI InstallEngineCF_CreateInstance(IClassFactory *iface, IUnknown *outer,
333 REFIID riid, void **ppv)
335 InstallEngine *engine;
336 HRESULT hres;
338 TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv);
340 engine = heap_alloc(sizeof(*engine));
341 if(!engine)
342 return E_OUTOFMEMORY;
344 engine->IInstallEngine2_iface.lpVtbl = &InstallEngine2Vtbl;
345 engine->ref = 1;
347 hres = IInstallEngine2_QueryInterface(&engine->IInstallEngine2_iface, riid, ppv);
348 IInstallEngine2_Release(&engine->IInstallEngine2_iface);
349 return hres;
352 static const IClassFactoryVtbl InstallEngineCFVtbl = {
353 ClassFactory_QueryInterface,
354 ClassFactory_AddRef,
355 ClassFactory_Release,
356 InstallEngineCF_CreateInstance,
357 ClassFactory_LockServer
360 static IClassFactory InstallEngineCF = { &InstallEngineCFVtbl };
362 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
364 switch(fdwReason)
366 case DLL_WINE_PREATTACH:
367 return FALSE; /* prefer native version */
368 case DLL_PROCESS_ATTACH:
369 instance = hInstDLL;
370 DisableThreadLibraryCalls(hInstDLL);
371 break;
373 return TRUE;
376 /***********************************************************************
377 * DllGetClassObject (INSENG.@)
379 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
381 if(IsEqualGUID(rclsid, &CLSID_InstallEngine)) {
382 TRACE("(CLSID_InstallEngine %s %p)\n", debugstr_guid(iid), ppv);
383 return IClassFactory_QueryInterface(&InstallEngineCF, iid, ppv);
386 FIXME("(%s %s %p)\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
387 return CLASS_E_CLASSNOTAVAILABLE;
390 /***********************************************************************
391 * DllCanUnloadNow (INSENG.@)
393 HRESULT WINAPI DllCanUnloadNow(void)
395 return S_FALSE;
398 /***********************************************************************
399 * DllRegisterServer (INSENG.@)
401 HRESULT WINAPI DllRegisterServer(void)
403 return __wine_register_resources( instance );
406 /***********************************************************************
407 * DllUnregisterServer (INSENG.@)
409 HRESULT WINAPI DllUnregisterServer(void)
411 return __wine_unregister_resources( instance );
414 BOOL WINAPI CheckTrustEx( LPVOID a, LPVOID b, LPVOID c, LPVOID d, LPVOID e )
416 FIXME("%p %p %p %p %p\n", a, b, c, d, e );
417 return TRUE;
420 /***********************************************************************
421 * DllInstall (INSENG.@)
423 HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
425 FIXME("(%s, %s): stub\n", bInstall ? "TRUE" : "FALSE", debugstr_w(cmdline));
426 return S_OK;