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
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
;
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
;
66 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
71 IUnknown_AddRef((IUnknown
*)*ppv
);
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
);
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
);
98 static HRESULT WINAPI
InstallEngine_GetEngineStatus(IInstallEngine2
*iface
, DWORD
*status
)
100 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
101 FIXME("(%p)->(%p)\n", This
, status
);
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
));
112 static HRESULT WINAPI
InstallEngine_DownloadComponents(IInstallEngine2
*iface
, DWORD flags
)
114 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
115 FIXME("(%p)->(%x)\n", This
, flags
);
119 static HRESULT WINAPI
InstallEngine_InstallComponents(IInstallEngine2
*iface
, DWORD flags
)
121 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
122 FIXME("(%p)->(%x)\n", This
, flags
);
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
);
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
);
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
);
147 static HRESULT WINAPI
InstallEngine_RegisterInstallEngineCallback(IInstallEngine2
*iface
, IInstallEngineCallback
*callback
)
149 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
150 FIXME("(%p)->(%p)\n", This
, callback
);
154 static HRESULT WINAPI
InstallEngine_UnregisterInstallEngineCallback(IInstallEngine2
*iface
)
156 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
157 FIXME("(%p)\n", This
);
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
);
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
);
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
));
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
));
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
));
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
));
203 static HRESULT WINAPI
InstallEngine_SetInstallDrive(IInstallEngine2
*iface
, char drive
)
205 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
206 FIXME("(%p)->(%c)\n", This
, drive
);
210 static HRESULT WINAPI
InstallEngine_SetInstallOptions(IInstallEngine2
*iface
, DWORD flags
)
212 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
213 FIXME("(%p)->(%x)\n", This
, flags
);
217 static HRESULT WINAPI
InstallEngine_SetHWND(IInstallEngine2
*iface
, HWND hwnd
)
219 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
220 FIXME("(%p)->(%p)\n", This
, hwnd
);
224 static HRESULT WINAPI
InstallEngine_SetIStream(IInstallEngine2
*iface
, IStream
*stream
)
226 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
227 FIXME("(%p)->(%p)\n", This
, stream
);
231 static HRESULT WINAPI
InstallEngine_Abort(IInstallEngine2
*iface
, DWORD flags
)
233 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
234 FIXME("(%p)->(%x)\n", This
, flags
);
238 static HRESULT WINAPI
InstallEngine_Suspend(IInstallEngine2
*iface
)
240 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
241 FIXME("(%p)\n", This
);
245 static HRESULT WINAPI
InstallEngine_Resume(IInstallEngine2
*iface
)
247 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
248 FIXME("(%p)\n", This
);
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
));
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
);
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
,
290 InstallEngine_Suspend
,
291 InstallEngine_Resume
,
292 InstallEngine2_SetLocalCif
,
293 InstallEngine2_GetICifFile
296 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
300 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
301 TRACE("(%p)->(IID_IUnknown %p)\n", iface
, ppv
);
303 }else if(IsEqualGUID(&IID_IClassFactory
, riid
)) {
304 TRACE("(%p)->(IID_IClassFactory %p)\n", iface
, ppv
);
309 IUnknown_AddRef((IUnknown
*)*ppv
);
313 FIXME("(%p)->(%s %p)\n", iface
, debugstr_guid(riid
), ppv
);
314 return E_NOINTERFACE
;
317 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
322 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
327 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL fLock
)
332 static HRESULT WINAPI
InstallEngineCF_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
,
333 REFIID riid
, void **ppv
)
335 InstallEngine
*engine
;
338 TRACE("(%p %s %p)\n", outer
, debugstr_guid(riid
), ppv
);
340 engine
= heap_alloc(sizeof(*engine
));
342 return E_OUTOFMEMORY
;
344 engine
->IInstallEngine2_iface
.lpVtbl
= &InstallEngine2Vtbl
;
347 hres
= IInstallEngine2_QueryInterface(&engine
->IInstallEngine2_iface
, riid
, ppv
);
348 IInstallEngine2_Release(&engine
->IInstallEngine2_iface
);
352 static const IClassFactoryVtbl InstallEngineCFVtbl
= {
353 ClassFactory_QueryInterface
,
355 ClassFactory_Release
,
356 InstallEngineCF_CreateInstance
,
357 ClassFactory_LockServer
360 static IClassFactory InstallEngineCF
= { &InstallEngineCFVtbl
};
362 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpv
)
366 case DLL_WINE_PREATTACH
:
367 return FALSE
; /* prefer native version */
368 case DLL_PROCESS_ATTACH
:
370 DisableThreadLibraryCalls(hInstDLL
);
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)
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
);
420 /***********************************************************************
421 * DllInstall (INSENG.@)
423 HRESULT WINAPI
DllInstall(BOOL bInstall
, LPCWSTR cmdline
)
425 FIXME("(%s, %s): stub\n", bInstall
? "TRUE" : "FALSE", debugstr_w(cmdline
));