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"
37 WINE_DEFAULT_DEBUG_CHANNEL(inseng
);
39 static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t size
)
41 return HeapAlloc(GetProcessHeap(), 0, size
);
44 static inline BOOL
heap_free(void *mem
)
46 return HeapFree(GetProcessHeap(), 0, mem
);
49 static HINSTANCE instance
;
51 struct InstallEngine
{
52 IInstallEngine2 IInstallEngine2_iface
;
56 static inline InstallEngine
*impl_from_IInstallEngine2(IInstallEngine2
*iface
)
58 return CONTAINING_RECORD(iface
, InstallEngine
, IInstallEngine2_iface
);
61 static HRESULT WINAPI
InstallEngine_QueryInterface(IInstallEngine2
*iface
, REFIID riid
, void **ppv
)
63 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
65 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
66 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
67 *ppv
= &This
->IInstallEngine2_iface
;
68 }else if(IsEqualGUID(&IID_IInstallEngine
, riid
)) {
69 TRACE("(%p)->(IID_IInstallEngine %p)\n", This
, ppv
);
70 *ppv
= &This
->IInstallEngine2_iface
;
71 }else if(IsEqualGUID(&IID_IInstallEngine2
, riid
)) {
72 TRACE("(%p)->(IID_IInstallEngine2 %p)\n", This
, ppv
);
73 *ppv
= &This
->IInstallEngine2_iface
;
75 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
80 IUnknown_AddRef((IUnknown
*)*ppv
);
84 static ULONG WINAPI
InstallEngine_AddRef(IInstallEngine2
*iface
)
86 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
87 LONG ref
= InterlockedIncrement(&This
->ref
);
89 TRACE("(%p) ref=%d\n", This
, ref
);
94 static ULONG WINAPI
InstallEngine_Release(IInstallEngine2
*iface
)
96 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
97 LONG ref
= InterlockedDecrement(&This
->ref
);
99 TRACE("(%p) ref=%d\n", This
, ref
);
107 static HRESULT WINAPI
InstallEngine_GetEngineStatus(IInstallEngine2
*iface
, DWORD
*status
)
109 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
110 FIXME("(%p)->(%p)\n", This
, status
);
114 static HRESULT WINAPI
InstallEngine_SetCifFile(IInstallEngine2
*iface
, const char *cab_name
, const char *cif_name
)
116 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
117 FIXME("(%p)->(%s %s)\n", This
, debugstr_a(cab_name
), debugstr_a(cif_name
));
121 static HRESULT WINAPI
InstallEngine_DownloadComponents(IInstallEngine2
*iface
, DWORD flags
)
123 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
124 FIXME("(%p)->(%x)\n", This
, flags
);
128 static HRESULT WINAPI
InstallEngine_InstallComponents(IInstallEngine2
*iface
, DWORD flags
)
130 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
131 FIXME("(%p)->(%x)\n", This
, flags
);
135 static HRESULT WINAPI
InstallEngine_EnumInstallIDs(IInstallEngine2
*iface
, UINT index
, char **id
)
137 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
138 FIXME("(%p)->(%d %p)\n", This
, index
, id
);
142 static HRESULT WINAPI
InstallEngine_EnumDownloadIDs(IInstallEngine2
*iface
, UINT index
, char **id
)
144 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
145 FIXME("(%p)->(%d %p)\n", This
, index
, id
);
149 static HRESULT WINAPI
InstallEngine_IsComponentInstalled(IInstallEngine2
*iface
, const char *id
, DWORD
*status
)
151 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
152 FIXME("(%p)->(%s %p)\n", This
, debugstr_a(id
), status
);
156 static HRESULT WINAPI
InstallEngine_RegisterInstallEngineCallback(IInstallEngine2
*iface
, IInstallEngineCallback
*callback
)
158 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
159 FIXME("(%p)->(%p)\n", This
, callback
);
163 static HRESULT WINAPI
InstallEngine_UnregisterInstallEngineCallback(IInstallEngine2
*iface
)
165 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
166 FIXME("(%p)\n", This
);
170 static HRESULT WINAPI
InstallEngine_SetAction(IInstallEngine2
*iface
, const char *id
, DWORD action
, DWORD priority
)
172 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
173 FIXME("(%p)->(%s %d %d)\n", This
, debugstr_a(id
), action
, priority
);
177 static HRESULT WINAPI
InstallEngine_GetSizes(IInstallEngine2
*iface
, const char *id
, COMPONENT_SIZES
*sizes
)
179 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
180 FIXME("(%p)->(%s %p)\n", This
, debugstr_a(id
), sizes
);
184 static HRESULT WINAPI
InstallEngine_LaunchExtraCommand(IInstallEngine2
*iface
, const char *inf_name
, const char *section
)
186 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
187 FIXME("(%p)->(%s %s)\n", This
, debugstr_a(inf_name
), debugstr_a(section
));
191 static HRESULT WINAPI
InstallEngine_GetDisplayName(IInstallEngine2
*iface
, const char *id
, const char *name
)
193 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
194 FIXME("(%p)->(%s %s)\n", This
, debugstr_a(id
), debugstr_a(name
));
198 static HRESULT WINAPI
InstallEngine_SetBaseUrl(IInstallEngine2
*iface
, const char *base_name
)
200 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
201 FIXME("(%p)->(%s)\n", This
, debugstr_a(base_name
));
205 static HRESULT WINAPI
InstallEngine_SetDownloadDir(IInstallEngine2
*iface
, const char *download_dir
)
207 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
208 FIXME("(%p)->(%s)\n", This
, debugstr_a(download_dir
));
212 static HRESULT WINAPI
InstallEngine_SetInstallDrive(IInstallEngine2
*iface
, char drive
)
214 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
215 FIXME("(%p)->(%c)\n", This
, drive
);
219 static HRESULT WINAPI
InstallEngine_SetInstallOptions(IInstallEngine2
*iface
, DWORD flags
)
221 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
222 FIXME("(%p)->(%x)\n", This
, flags
);
226 static HRESULT WINAPI
InstallEngine_SetHWND(IInstallEngine2
*iface
, HWND hwnd
)
228 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
229 FIXME("(%p)->(%p)\n", This
, hwnd
);
233 static HRESULT WINAPI
InstallEngine_SetIStream(IInstallEngine2
*iface
, IStream
*stream
)
235 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
236 FIXME("(%p)->(%p)\n", This
, stream
);
240 static HRESULT WINAPI
InstallEngine_Abort(IInstallEngine2
*iface
, DWORD flags
)
242 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
243 FIXME("(%p)->(%x)\n", This
, flags
);
247 static HRESULT WINAPI
InstallEngine_Suspend(IInstallEngine2
*iface
)
249 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
250 FIXME("(%p)\n", This
);
254 static HRESULT WINAPI
InstallEngine_Resume(IInstallEngine2
*iface
)
256 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
257 FIXME("(%p)\n", This
);
261 static HRESULT WINAPI
InstallEngine2_SetLocalCif(IInstallEngine2
*iface
, const char *cif
)
263 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
264 FIXME("(%p)->(%s)\n", This
, debugstr_a(cif
));
268 static HRESULT WINAPI
InstallEngine2_GetICifFile(IInstallEngine2
*iface
, ICifFile
**cif_file
)
270 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
271 FIXME("(%p)->(%p)\n", This
, cif_file
);
275 static const IInstallEngine2Vtbl InstallEngine2Vtbl
= {
276 InstallEngine_QueryInterface
,
277 InstallEngine_AddRef
,
278 InstallEngine_Release
,
279 InstallEngine_GetEngineStatus
,
280 InstallEngine_SetCifFile
,
281 InstallEngine_DownloadComponents
,
282 InstallEngine_InstallComponents
,
283 InstallEngine_EnumInstallIDs
,
284 InstallEngine_EnumDownloadIDs
,
285 InstallEngine_IsComponentInstalled
,
286 InstallEngine_RegisterInstallEngineCallback
,
287 InstallEngine_UnregisterInstallEngineCallback
,
288 InstallEngine_SetAction
,
289 InstallEngine_GetSizes
,
290 InstallEngine_LaunchExtraCommand
,
291 InstallEngine_GetDisplayName
,
292 InstallEngine_SetBaseUrl
,
293 InstallEngine_SetDownloadDir
,
294 InstallEngine_SetInstallDrive
,
295 InstallEngine_SetInstallOptions
,
296 InstallEngine_SetHWND
,
297 InstallEngine_SetIStream
,
299 InstallEngine_Suspend
,
300 InstallEngine_Resume
,
301 InstallEngine2_SetLocalCif
,
302 InstallEngine2_GetICifFile
305 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
309 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
310 TRACE("(%p)->(IID_IUnknown %p)\n", iface
, ppv
);
312 }else if(IsEqualGUID(&IID_IClassFactory
, riid
)) {
313 TRACE("(%p)->(IID_IClassFactory %p)\n", iface
, ppv
);
318 IUnknown_AddRef((IUnknown
*)*ppv
);
322 FIXME("(%p)->(%s %p)\n", iface
, debugstr_guid(riid
), ppv
);
323 return E_NOINTERFACE
;
326 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
331 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
336 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL fLock
)
341 static HRESULT WINAPI
InstallEngineCF_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
,
342 REFIID riid
, void **ppv
)
344 InstallEngine
*engine
;
347 TRACE("(%p %s %p)\n", outer
, debugstr_guid(riid
), ppv
);
349 engine
= heap_alloc(sizeof(*engine
));
351 return E_OUTOFMEMORY
;
353 engine
->IInstallEngine2_iface
.lpVtbl
= &InstallEngine2Vtbl
;
356 hres
= IInstallEngine2_QueryInterface(&engine
->IInstallEngine2_iface
, riid
, ppv
);
357 IInstallEngine2_Release(&engine
->IInstallEngine2_iface
);
361 static const IClassFactoryVtbl InstallEngineCFVtbl
= {
362 ClassFactory_QueryInterface
,
364 ClassFactory_Release
,
365 InstallEngineCF_CreateInstance
,
366 ClassFactory_LockServer
369 static IClassFactory InstallEngineCF
= { &InstallEngineCFVtbl
};
371 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpv
)
375 case DLL_WINE_PREATTACH
:
376 return FALSE
; /* prefer native version */
377 case DLL_PROCESS_ATTACH
:
379 DisableThreadLibraryCalls(hInstDLL
);
385 /***********************************************************************
386 * DllGetClassObject (INSENG.@)
388 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID iid
, LPVOID
*ppv
)
390 if(IsEqualGUID(rclsid
, &CLSID_InstallEngine
)) {
391 TRACE("(CLSID_InstallEngine %s %p)\n", debugstr_guid(iid
), ppv
);
392 return IClassFactory_QueryInterface(&InstallEngineCF
, iid
, ppv
);
395 FIXME("(%s %s %p)\n", debugstr_guid(rclsid
), debugstr_guid(iid
), ppv
);
396 return CLASS_E_CLASSNOTAVAILABLE
;
399 /***********************************************************************
400 * DllCanUnloadNow (INSENG.@)
402 HRESULT WINAPI
DllCanUnloadNow(void)
407 /***********************************************************************
408 * DllRegisterServer (INSENG.@)
410 HRESULT WINAPI
DllRegisterServer(void)
412 return __wine_register_resources( instance
);
415 /***********************************************************************
416 * DllUnregisterServer (INSENG.@)
418 HRESULT WINAPI
DllUnregisterServer(void)
420 return __wine_unregister_resources( instance
);
423 BOOL WINAPI
CheckTrustEx( LPVOID a
, LPVOID b
, LPVOID c
, LPVOID d
, LPVOID e
)
425 FIXME("%p %p %p %p %p\n", a
, b
, c
, d
, e
);
429 /***********************************************************************
430 * DllInstall (INSENG.@)
432 HRESULT WINAPI
DllInstall(BOOL bInstall
, LPCWSTR cmdline
)
434 FIXME("(%s, %s): stub\n", bInstall
? "TRUE" : "FALSE", debugstr_w(cmdline
));